PrometheusConnect.check_prometheus_connection() does not work
See original GitHub issueDescribe the bug
I can get metrics but PrometheusConnect.check_prometheus_connection()
always returns false.
To Reproduce
>>> from prometheus_api_client.utils import parse_datetime
>>> from prometheus_api_client import PrometheusConnect
>>> from datetime import timedelta
>>>
>>> prom = PrometheusConnect(url="http://localhost:8481/select/1/prometheus", disable_ssl=True)
>>> start_time = parse_datetime("10min")
>>> end_time = parse_datetime("now")
>>> chunk_size = timedelta(seconds=60)
>>>
>>> metric_data = prom.get_metric_range_data(
... 'nginx_ingress_controller_requests{service="as01-prd01-oma"}',
... start_time=start_time,
... end_time=end_time,
... chunk_size=chunk_size,
... )
>>> len(metric_data)
2940
>>> prom.check_prometheus_connection()
False
>>>
Expected behavior
PrometheusConnect.check_prometheus_connection()
to return True
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Prometheus Python Client - GitHub
Prometheus client libraries presume a threaded model, where metrics are shared across workers. This doesn't work so well for languages such as Python...
Read more >prometheus-api-client - PyPI
Connecting and Collecting Metrics from a Prometheus host. The PrometheusConnect module of the library can be used to connect to a Prometheus host....
Read more >How to clear all metrics it python prometheus client
I am trying to clear all metric instances and i am using .clear() to clear all labels and values. But the problem is...
Read more >Getting started - Prometheus.io
Configure rules for aggregating scraped data into new time series. Though not a problem in our example, queries that aggregate over thousands of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK I see what you mean, yes
get_current_metric_value
is cleaner. Thanks!oh my bad, i meant to say that you can use
get_current_metric_value
instead ofget_metric_range_data
to make it look cleaner