Skip to content

Conversation

s3714110
Copy link

@s3714110 s3714110 commented Jul 4, 2025

I'm adding extra method parameter for PrometheusConnect class (default is GET), so that users can toggle to use POST for Prometheus APIs that support it, such as /query, /query_range and /labels, as some prefer POST due to it being able to handle larger and more complex queries.

Other APIs, such as /label/{1}/values, /targets, /targets/metadata and /metadata, will still only use GET method and are not affected by the method parameter. I also switch to use request() method for the session object across all requests to make it consistent.

I used the official Prometheus documentation as the main reference: https://prometheus.io/docs/prometheus/latest/querying/api/

@4n4nd
Copy link
Owner

4n4nd commented Jul 10, 2025

@s3714110 would it be possible to add some test cases for the POST method?

@s3714110
Copy link
Author

@s3714110 would it be possible to add some test cases for the POST method?

Hi @4n4nd , I just added a couple of simple tests, all passed on my end. Please review, thanks

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 this pull request may close these issues.

3 participants