Questions about Gauge labels #896
Unanswered
1138559250
asked this question in
Q&A
Replies: 1 comment
-
Hello, You could probably define all of the labels on only one metric, and then set them to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm a newbie with Prometheus_client.
I would like to ask if it is possible to customize the label.
The example is as follows
metrics_one = prometheus_client.Gauge("mysql_data", "mysql_data", ["label1", "label2", "label3", "label4", "label5", "label6"])
metrics_two = prometheus_client.Gauge("mysql_data", "mysql_data", ["label1", "label2", ])
metrics_three = prometheus_client.Gauge("mysql_data", "mysql_data", ["label1", "label3", ])
metrics_four = prometheus_client.Gauge("mysql_data", "mysql_data", ["label1", "label2", "label4" ])
But I have a lot of labels, I only need to use a few of them when I insert data,
Do I have to write all the metrics like this? Is there another way to do it?
And in the end, I finally hope to use flask to respond to the latest data of all labels of metrics.
@app.route('/metrics')
def metrics():
set_data_to_prometheus()
return Response(prometheus_client.generate_latest(metrics), mimetype="text/plain")
If so, I can only pass out the data of one metric.
Looking forward for your reply, thank you
Beta Was this translation helpful? Give feedback.
All reactions