Tom-Goong commented on issue #7820: [FLINK-11742][Metrics]Push metrics to 
Pushgateway without "instance"
URL: https://github.com/apache/flink/pull/7820#issuecomment-468116677
 
 
   @zentol
   I am sorry for the reckless submission of PR. As a newcomer, I am still not 
familiar with the norms of the community and will be more in line with the 
norms in the future. I will close this PR and JIRA later.
   
   By the way,  I will talk about the some information I found.
   https://github.com/prometheus/pushgateway#about-the-job-and-instance-labels
   
   > The Prometheus server will attach a job label and an instance label to 
each scraped metric. The value of the job label comes from the scrape 
configuration. When you configure the Pushgateway as a scrape target for your 
Prometheus server, you will probably pick a job name like pushgateway. The 
value of the instance label is automatically set to the host and port of the 
target scraped. Hence, all the metrics scraped from the Pushgateway will have 
the host and port of the Pushgateway as the instance label and a job label like 
pushgateway. The conflict with the job and instance labels you might have 
attached to the metrics pushed to the Pushgateway is solved by renaming those 
labels to exported_job and exported_instance.
   
   > However, this behavior is usually undesired when scraping a Pushgateway. 
Generally, you would like to retain the job and instance labels of the metrics 
pushed to the Pushgateway. That's why you have set honor_labels: true in the 
scrape config for the Pushgateway. It enables the desired behavior. See the 
documentation for details.
   
   > This leaves us with the case where the metrics pushed to the Pushgateway 
do not feature an instance label. This case is quite common as the pushed 
metrics are often on a service level and therefore not related to a particular 
instance. Even with honor_labels: true, the Prometheus server will attach an 
instance label if no instance label has been set in the first place. 
**Therefore, if a metric is pushed to the Pushgateway without an instance label 
(and without instance label in the grouping key, see below), the Pushgateway 
will export it with an emtpy instance label ({instance=""}), which is 
equivalent to having no instance label at all but prevents the server from 
attaching one.**
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to