prometheus-engine icon indicating copy to clipboard operation
prometheus-engine copied to clipboard

Honor labels option

Open danielkucera opened this issue 2 years ago • 9 comments

Hello,

I am trying to scrape pushgateway using PodMonitoring object. In general it works but it does relabel job and instance labels.

To prevent relabeling, one can specify honor_labels: true in scrape config but this is currently not possible with PodMonitoring object.

Can you please add an option to enable configuration of honor_labels?

danielkucera avatar May 06 '22 15:05 danielkucera

Hey Daniel, could you talk a little about your use case for not relabeling the job and instance labels?

e.g. what labels do you want, and what labels are you getting from GMP?

lyanco avatar May 09 '22 20:05 lyanco

Hi Lee,

I want to ingest metrics from external servers. For this purpose I have deployed pushgateway and I am pushing metrics from node_exporter as described here

When I use PodMonitoring for that pushgateway,

apiVersion: monitoring.googleapis.com/v1alpha1
kind: PodMonitoring
metadata:
  name: pushgateway
  namespace: gmp-frontend
spec:
  selector:
    matchLabels:
      app: pushgateway
  endpoints:
  - port: http
    interval: 60s
    path: /metrics

everything works correctly but the original instance and job labels are changed to external_instance and external_job and the standard dashboard no longer works.

I would prefer having the option to keep the original labels rather than manually modifying all dashboards.

danielkucera avatar May 09 '22 20:05 danielkucera

We are likely to implement this by creating a RawPodMonitoring resource that honors all labels set on the metric. Stay posted :-)

lyanco avatar Jun 16 '22 20:06 lyanco

Happy to hear that! I'll follow closely :)

danielkucera avatar Jun 16 '22 20:06 danielkucera

@lyanco Any news on this? I've created a deployment for kube-state-metrics but the metrics that come from it have "exported_namespace" and other "exported_XXXX" labels that mess up my rules and dashboard configurations.

Migueljfs avatar Sep 22 '22 10:09 Migueljfs

No progress on this. On your specific note - have you looked at our copy-pastable config for ksm? It should avoid triggering those relabeling rules: https://cloud.google.com/stackdriver/docs/managed-prometheus/exporters#expandable-1

lyanco avatar Sep 22 '22 14:09 lyanco

Hi @danielkucera, I believe you mean exported_instance and exported_job, correct?

@Migueljfs, you should be able to use our recommended ClusterPodMonitoring for proper relabeling of KSM metrics.

pintohutch avatar Sep 23 '22 19:09 pintohutch

Hey @pintohutch @lyanco

Indeed those are the labels. After replacing my kube-state-metrics with the one in the link given by @lyanco , I no longer see those exported labels, it's now properly labeled.

Thank you!

Migueljfs avatar Sep 23 '22 19:09 Migueljfs

Yes, exported_instance and exported_job.

danielkucera avatar Sep 23 '22 19:09 danielkucera