Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grafana API datasource health check returns 400 #208

Closed
eserte opened this issue Oct 10, 2024 · 7 comments · Fixed by #209
Closed

Grafana API datasource health check returns 400 #208

eserte opened this issue Oct 10, 2024 · 7 comments · Fixed by #209
Assignees

Comments

@eserte
Copy link

eserte commented Oct 10, 2024

When using the grafana API datasource health check against a datasource using the victoriametrics-datasource plugin, e.g. using /api/datasources/uid/abcdefghijklmn/health then it fails with a 400 status and a JSON body

{"message":"got response code 400","status":"ERROR"}

The datasource is configured with the URL http://vmselect-aggregator-clusterip.vm-output.svc.cluster.local:8481/select/1234/prometheus (note the multi-tenant setup) and otherwise works fine, only the above health check does not.

If I understand the source code correctly, then the health check is done in this function https://github.com/VictoriaMetrics/victoriametrics-datasource/blob/main/pkg/plugin/datasource.go#L169
The /-/healthy part is just added to the configured URL, so the result would be http://vmselect-aggregator-clusterip.vm-output.svc.cluster.local:8481/select/1234/prometheus/-/healthy which does not work. It returns an error message containing ... unsupported path requested: "/select/1234/prometheus/-/healthy" and the http status is 400 which looks like it is propagated.

@dmitryk-dk dmitryk-dk self-assigned this Oct 11, 2024
@dmitryk-dk
Copy link
Contributor

dmitryk-dk commented Oct 11, 2024

Hi @eserte ! Can you share how you configure the data source in the grafana?
vmselect has its own /-/health endpoint so it should response on test request from the grafana.

If it is possible, can you share the picture of how you set up your cluster. It will help to understand where the problem is

@eserte
Copy link
Author

eserte commented Oct 14, 2024

Hi @dmitryk-dk, grafana's datasource API returns the following for this datasource (obfuscated):

  {
    "id": 123,
    "uid": "abcdefghijklmn",
    "orgId": 1,
    "name": "test with victoriametrics-datasource",
    "type": "victoriametrics-datasource",
    "typeName": "VictoriaMetrics",
    "typeLogoUrl": "public/plugins/victoriametrics-datasource/img/vm_logo.svg",
    "access": "proxy",
    "url": "http://vmselect-aggregator-clusterip.vm-output.svc.cluster.local:8481/select/1234/prometheus",
    "user": "",
    "database": "",
    "basicAuth": false,
    "isDefault": false,
    "jsonData": {
      "httpMethod": "POST"
    },
    "readOnly": false
  },

Probably this is the URL which is built for the health check: http://vmselect-aggregator-clusterip.vm-output.svc.cluster.local:8481/select/1234/prometheus/-/healthy. This does not work. What would work: http://vmselect-aggregator-clusterip.vm-output.svc.cluster.local:8481/-/healthy (note the extra "y"!).

@dmitryk-dk
Copy link
Contributor

Hi @eserte ! The issue was fixed in the new release. Please reopen the issue if you find any problem with it.

@eserte
Copy link
Author

eserte commented Oct 18, 2024

@dmitryk-dk : the fix does not work. Problem is probably the usage of path.Join, as this transforms a http://... into http:/.... It is meant for filesystem paths, not URLs.

(And reopening issues in github does not seem to be possible, at least for non-owners)

@dmitryk-dk
Copy link
Contributor

dmitryk-dk commented Oct 18, 2024

HI @eserte! Could you please check the release v0.6.1, please?

@eserte
Copy link
Author

eserte commented Oct 18, 2024

Thanks, v0.10.1 works fine.

@dmitryk-dk
Copy link
Contributor

Thanks, v0.10.1 works fine.

Sorry made changes in the both repositories and mention victorialogs-datasource release :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants