Ah, that works perfectly. Thanks Ben! On Tuesday, July 7, 2020 at 11:43:15 AM UTC-4, Ben Kochie wrote: > > No, for the up metric, it needs to be in the target `relabel_configs` > phase. > > For things like namespace, assuming this is Kubernetes, it comes from the > k8s_sd_configs metadata. > > On Tue, Jul 7, 2020 at 5:40 PM Kevin Black <[email protected] > <javascript:>> wrote: > >> Since the "up" metric is somewhat of a special case, does a >> metric_relabel_configs rule still apply to it? If not, is there a way to >> relabel those? We attach a special label for items in certain namespaces, >> and I'd like to tag the up metric with the same label, but it does not seem >> to currently take. >> >> >> For my job scraping kubernetes pods, I have >> >> metric_relabel_configs: >> - source_labels: [namespace] >> separator: ; >> regex: (.+)(-test$) >> target_label: foo >> replacement: ${1} >> action: replace >> >> >> If I look at a list of metrics, I see the up metric does have the >> namespace label on it, but does not get the new foo label. Other metrics >> scraped by the same job do, but the automatic prometheus metrics (i.e. up, >> scrape_duration_seconds, etc.) do not seem to get the needed label. >> >> up{app="testfoo",component="test",instance="100.106.221.99:3000 >> ",job="kubernetes-pods",kubernetes_pod_name="testfoo-625644656d-pasp2",namespace="important-test",pod_template_hash="625458653a",release="testfoo"} >> >> >> Is there a way to force this label on these as well? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Prometheus Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/prometheus-users/1cace066-791f-4421-a3ca-9a866f72d6d7o%40googlegroups.com >> >> <https://groups.google.com/d/msgid/prometheus-users/1cace066-791f-4421-a3ca-9a866f72d6d7o%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >
-- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/597a5b8d-6cda-47d2-9529-4d0d1e4bf1bbo%40googlegroups.com.

