GitHub Enterprise Server インスタンスの collectd -> collectd サーバー -> prometheus というデータフローでメトリクスを収集すると、GHES インスタンスから来たメトリクスには instance
とは別に exported_instance
というラベルがついていて、ここに GHES インスタンスのホスト名が入っている。
exported_instance
はどのようにして付与されるのか?scrape_config の honor_labels
オプションで説明されていた。
# honor_labels controls how Prometheus handles conflicts between labels that are # already present in scraped data and labels that Prometheus would attach # server-side ("job" and "instance" labels, manually configured target # labels, and labels generated by service discovery implementations). # # If honor_labels is set to "true", label conflicts are resolved by keeping label # values from the scraped data and ignoring the conflicting server-side labels. # # If honor_labels is set to "false", label conflicts are resolved by renaming # conflicting labels in the scraped data to "exported_<original-label>" (for # example "exported_instance", "exported_job") and then attaching server-side # labels. # # Setting honor_labels to "true" is useful for use cases such as federation and # scraping the Pushgateway, where all labels specified in the target should be # preserved. # # Note that any globally configured "external_labels" are unaffected by this # setting. In communication with external systems, they are always applied only # when a time series does not have a given label yet and are ignored otherwise. [ honor_labels: <boolean> | default = false ]
ここがキモ:
Setting honor_labels to "true" is useful for use cases such as federation and scraping the Pushgateway, where all labels specified in the target should be preserved.
要するに、collectd サーバーでデータを集約してるような場合は、honor_labels: true
にすべきっぽい。すると、ラベルの付け替えなどをしなくても、instance
などに普通に望ましい値が入ってくれると。