PyPI
pypi.org › project › prometheus-api-client
prometheus-api-client · PyPI
The prometheus-api-client library consists of multiple modules which assist in connecting to a Prometheus host, fetching the required metrics and performing various aggregation operations on the time series data.
» pip install prometheus-api-client
Published: Apr 13, 2026
Version: 0.7.2
Readthedocs
prometheus-api-client-python.readthedocs.io › en › latest › source › prometheus_api_client.html
prometheus_api_client package — Prometheus Client API Python 0.0.1 documentation
This method takes as input a string which will be sent as a query to the specified Prometheus Host. This query is a PromQL query. ... params – (dict) Optional dictionary containing GET parameters to be sent along with the API request, such as “timeout”
05:42
PROMETHEUS Metrics for your Python FastAPI App - YouTube
Observing Python Applications Using Prometheus - Jessica ...
11:47
Introduction to Python monitoring with Prometheus - YouTube
31:57
Monitor Your Python Applications with Prometheus & Grafana - YouTube
12:35
Add custom metrics to FastAPI Server with prometheus_client | Python ...
47:59
Webinar: Collecting Docker metrics with Python and Prometheus - ...
Readthedocs
prometheus-api-client-python.readthedocs.io › en › latest › _modules › prometheus_api_client › prometheus_connect.html
prometheus_api_client.prometheus_connect — Prometheus Client API Python 0.0.1 documentation
For example, setting it to timedelta(hours=3) will download 3 hours worth of data in each request made to the prometheus host :param store_locally: (bool) If set to True, will store data locally at, `"./metrics/hostname/metric_date/name_time.json.bz2"` :param params: (dict) Optional dictionary containing GET parameters to be sent along with the API request, such as "time" :return: (list) A list of metric data for the specified metric in the given time range :raises: (RequestException) Raises an exception in case of a connection error (PrometheusApiClientException) Raises in case of non 200 res
Medium
ledinhcuong99.medium.com › prometheus-api-client-in-python-ec54291aa1a
Prometheus API Client in Python - Donald Le - Medium
January 19, 2021 - def print_metrics(): from prometheus_api_client import PrometheusConnect prom = PrometheusConnect(url="http://3.19.55.237:9090", disable_ssl=True) # Get the list of all the metrics that the Prometheus host scrapes print(prom.all_metrics()) # Press the green button in the gutter to run the script.
Starred by 274 users
Forked by 90 users
Languages: Python
Readthedocs
prometheus-api-client-python.readthedocs.io › en › latest
Welcome to Prometheus Client API Python’s documentation! — Prometheus Client API Python 0.0.1 documentation
Welcome to Prometheus Client API Python’s documentation!
Read the Docs
app.readthedocs.org › projects › prometheus-api-client-python
Prometheus API client python - Read the Docs Community
Prometheus API client python · EN · artificial-intelligence prometheus prometheus-api prometheus-metrics · Maintainers · Repository 4n4nd/prometheus-api-client-python · Versions 3 Builds 46 ·
Prometheus
prometheus.io › docs › instrumenting › clientlibs
Client libraries | Prometheus
Choose a Prometheus client library that matches the language in which your application is written. This lets you define and expose internal metrics via an HTTP endpoint on your application’s instance: Go · Java or Scala · Python · Ruby · Rust · Unofficial third-party client libraries: Bash ·
client_python
prometheus.github.io › client_python
client_python
This tutorial shows the quickest way to get started with the Prometheus Python library. ... from prometheus_client import start_http_server, Summary import random import time # Create a metric to track time spent and requests made. REQUEST_TIME = Summary('request_processing_seconds', 'Time spent processing request') # Decorate function with metric.
GitHub
github.com › 4n4nd › prometheus-api-client-python › tree › master › prometheus_api_client
prometheus-api-client-python/prometheus_api_client at master · 4n4nd/prometheus-api-client-python
A python wrapper for the prometheus http api. Contribute to 4n4nd/prometheus-api-client-python development by creating an account on GitHub.
Author: 4n4nd
PyPI
pypi.org › project › prometheus-client
prometheus-client · PyPI
Python client for the Prometheus monitoring system.
» pip install prometheus-client
DBI Services
dbi-services.com › accueil › instrument your python application with prometheus (part1)
Instrument your python application with Prometheus (Part1)
July 10, 2023 - Prometheus has several official client libraries written in Go, Java, Python, Ruby, and Rust. Additionally, there are unofficial third-party client libraries available for other languages. Moreover, if desired, you can even write your own client library for any unsupported language. Throughout this blog, I will explain how to instrument a Python application and collect metrics from an API...
Embrace
embrace.io › code samples
Metrics API Code Samples - Embrace.io
from datetime import datetime from prometheus_api_client import PrometheusConnect, MetricsList, Metric, MetricSnapshotDataFrame, MetricRangeDataFrame from prometheus_api_client.utils import parse_datetime # Constants # Embrace prometheus public URL metrics_api_endpoint = 'https://api.embrace.io/metrics' # API-Token token = '<your token>' # Embrace AppId app_id = '<your app id>' # Connect library to Embrace prometheus host prom = PrometheusConnect(url=metrics_api_endpoint, headers={'Authorization': 'Bearer ' + token}) # Get the list of all available metrics metrics = prom.all_metrics() print(me
Top answer 1 of 3
9
The code looks true, However,the query in your response command is wrong . the true formate is :
response =requests.get(PROMETHEUS + '/api/v1/query', params={'query': 'container_cpu_user_seconds_total'})
you can change "container_cpu_user_seconds_total" to any query that you want to read. .. good luck
2 of 3
4
Performing a GET request at <prom-server-ip>:9090/metrics returns the Prometheus metrics (not in JSON format) of the Prometheus server itself.
Since you're trying to perform query, you need to use the HTTP API endpoints like /api/v1/query or /api/v1/query_range instead of using /metrics.
$ curl 'http://localhost:9090/api/v1/query?query=up&time=2015-07-01T20:10:51.781Z'
{
"status" : "success",
"data" : {
"resultType" : "vector",
"result" : [
{
"metric" : {
"__name__" : "up",
"job" : "prometheus",
"instance" : "localhost:9090"
},
"value": [ 1435781451.781, "1" ]
},
{
"metric" : {
"__name__" : "up",
"job" : "node",
"instance" : "localhost:9100"
},
"value" : [ 1435781451.781, "0" ]
}
]
}
}
For more detailed information visit Prometheus official docs.