Questions tagged [prometheus-python-client]

12 questions
3
votes
0 answers

Prometheus push gateway how to increment message requests

I have a use case where we need to increment the number of requests received on a Nuclio serverless service. Pod is recreated each time the service is invoked. Following the examples from the Prometheus-client library, I am not able to increment…
Masterbuilder
  • 499
  • 2
  • 12
  • 24
2
votes
0 answers

How to clear `Summary` metric value in Python Prometheus client

I'm using Prometheus Python client here. How do you clear a Summary metric without any labels? Example metric = Summary("test_summary", "") metric.observe(10) # Do something metric.clear() The last line throws the following error: self =…
2
votes
1 answer

In the context o f prometheus instrumentation, should I use all prometheus labels when updating a metrics value

I have a prometheus metric with labels declared like errors_total = prometheus_client.Counter("errors_total", "Total errors", ["source", "code]) errors_total.labels("source"="initialization", code="100") errors_total.labels("source"="shutingdown",…
user2275693
  • 173
  • 2
  • 9
1
vote
0 answers

FileNotFoundError Prometheus Python Client write_to_textfile

I want to log something to a text file using the Prometheus Python Client, with the below code. Just these three lines for testing purposes: from prometheus_client import CollectorRegistry, write_to_textfile registry =…
Josephus87
  • 1,126
  • 9
  • 19
1
vote
1 answer

How to convert docker stats metrics to the Prometheus supported metrics type?

I'm trying to implement a docker monitoring solution in my organization, which will be used for internal monitoring. The problem is the box which is used, does not allow any http port to be exposed due to security reasons and also does not allow to…
0
votes
0 answers

Configure grafana-agent DaemonSet to scrape pods in hostNetwork=true mode

I'm finding a lack of examples in the docs with a specific configuration I have in one of my clusters. Basically my pods are running with hostNetwork: true enabled, which means that they share a port mapping with all of the pods with that flag set.…
0
votes
1 answer

Flask error after adding csrf protection - Python

I got the following sonar issue under security hotspots: Sonar recommended the following fix: So I added the following code: from flask_wtf.csrf import CSRFProtect ... app = Flask(__name__) # unchanged app.config['SECRET_KEY'] = os.urandom(32) #…
Nitesh
  • 180
  • 1
  • 11
0
votes
0 answers

Prometheus is giving "IndexError: list index out of range"

I am trying get metric in list form using prometheus_api_client It worked effectively a few days back but now it is throwing error for the same code. The error occur in the following line my_metric_object = metric_object_list[1] # one of the metrics…
0
votes
1 answer

Counting message (amount and type) per minutes in prometheus

I am trying to fine counting how many messages are received on my server (a custom UDP socket server). I made a Counter (in python) that just works fine (I can see the right value in Grafana): I can see how many messages are received for minute. Now…
0
votes
1 answer

Performing PromQL queries on prometheus metrics in a text file

I have a custom Prometheus exporter that is meant for extreme "hermeticity" - to operate at all times, even when there is not network connection, for a spectrum of reasons. Normally, I have a main Prometheus instance that scrapes nodes with this…
Lior Levin
  • 179
  • 1
  • 13
0
votes
1 answer

Prometheus metrics are not coming when it takes more time than scrap interval

Overview I am new to Prometheus. My Custom Exporter takes IP addresses as input. Does some stream processing and then registers new metrics to Prometheus registry. Below is the code, #!/usr/bin/env python3 from prometheus_client import…