From ea06455c78316ff9c9ec9e7c71404730c280c886 Mon Sep 17 00:00:00 2001 From: chenlujjj <953546398@qq.com> Date: Tue, 14 Jan 2025 14:21:59 +0800 Subject: [PATCH] feat: include request url in the datasource unexpected status code error message --- CHANGELOG.md | 7 +++++-- pkg/plugin/datasource.go | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1367db76..762956bf 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ ## tip +* FEATURE: include request url in the `got unexpected response status code` error message for troubleshooting. + Thanks to @chenlujjj for [the pull request](https://github.com/VictoriaMetrics/victoriametrics-datasource/pull/243). + ## [v0.10.3](https://github.com/VictoriaMetrics/victoriametrics-datasource/releases/tag/v0.10.3) * BUGFIX: fix query loading when using multiple visible queries in a panel. See [this issue](https://github.com/VictoriaMetrics/victoriametrics-datasource/issues/223). @@ -20,7 +23,7 @@ * BUGFIX: fixed healthcheck -## [v0.10.0](https://github.com/VictoriaMetrics/victoriametrics-datasource/releases/tag/v0.10.0) +## [v0.10.0](https://github.com/VictoriaMetrics/victoriametrics-datasource/releases/tag/v0.10.0) * FEATURE: set the default query type to `instant` when creating alerting rules. See [this issue](https://github.com/VictoriaMetrics/victoriametrics-datasource/issues/205). @@ -38,7 +41,7 @@ ## [v0.8.5](https://github.com/VictoriaMetrics/victoriametrics-datasource/releases/tag/v0.8.5) * BUGFIX: restore support for Grafana versions below `10.0.0`. See [this issue](https://github.com/VictoriaMetrics/victoriametrics-datasource/issues/159). -* BUGFIX: fix issue with forwarding headers from datasource to the backend or proxy. +* BUGFIX: fix issue with forwarding headers from datasource to the backend or proxy. It might be helpful if a user wants to use some kind of authentication. See [this issue](https://github.com/VictoriaMetrics/victorialogs-datasource/issues/54). ## [v0.8.4](https://github.com/VictoriaMetrics/victoriametrics-datasource/releases/tag/v0.8.4) diff --git a/pkg/plugin/datasource.go b/pkg/plugin/datasource.go index 59dea5ee..a0586e56 100644 --- a/pkg/plugin/datasource.go +++ b/pkg/plugin/datasource.go @@ -142,7 +142,7 @@ func (d *Datasource) query(ctx context.Context, query backend.DataQuery) backend }() if resp.StatusCode != http.StatusOK { - err = fmt.Errorf("got unexpected response status code: %d", resp.StatusCode) + err = fmt.Errorf("got unexpected response status code: %d with request url: %q", resp.StatusCode, reqURL) return newResponseError(err, backend.Status(resp.StatusCode)) }