stackdriver_exporter
stackdriver_exporter copied to clipboard
Fix "metric was collected before" error
Hello,
Since one or two weeks, our stackdriver_exporter errors out with logs similar to:
collected metric "stackdriver_network_security_policy_networksecurity_googleapis_com_https_request_count" { label:{name:"backend_target_name" value:"****-https-lb-spectrum-back"} label:{name:"blocked" value:"true"} label:{name:"location" value:"global"} label:{name:"policy_name" value:"preconfigured-rules-policy"} label:{name:"project_id" value:"****-production"} label:{name:"unit" value:"1"} gauge:{value:0} timestamp_ms:1746012857310} was collected before with the same name and label values
After investigation, it comes from the fact that some of these metrics are returned twice by Stackdriver.
This PR adds a filtering to reportTimeSeriesMetrics() in order to avoid sending duplicate time series to the Prometheus Collector.
I hope this helps and I hope it's good enough, I'm not very well-versed in Go.
Thanks!
@colinleroy Stack on this too. Try to use binary builded from your PR.
Lost other valid metrics.
Example stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_ack_latencies_bucket
I have a lot of subscribtion_ids.
Left with only on subscription metric.
Were they metrics with at least one unique key/value label ?