grafana / opensearch-datasource

Apache License 2.0
25 stars 20 forks source link

Use resource handler to get version #452

Closed iwysiu closed 1 week ago

iwysiu commented 3 weeks ago

What this PR does / why we need it: This pr sets up the resource handler (taken from elasticsearch) and uses it to get the opensearch version

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

njvrzm commented 2 weeks ago

Just to follow on from the above, there's a different error if you point to a valid http endpoint that's not opensearch. Maybe should use the same generic error here too.

Screenshot 2024-09-17 at 15 30 07
iwysiu commented 2 weeks ago

@njvrzm sorry for the messy history- i accidentally amended onto the last commit instead of making a new one. I made the renaming changes and added the Failed to connect to server error. Can you send me the valid endpoint you're using that doesn't return the correct data? I think we originally weren't handling that properly but i can add an error for it

njvrzm commented 1 week ago

Ah, sorry, when I said "valid endpoint" I just meant like if you point it to http://www.yahoo.com or the like. A valid HTTP endpoint that isn't an opensearch server.

iwysiu commented 1 week ago

double checked, it looks like the json error is already being supressed, so i think we're good!