From 0e290081c94fa1d10fafceee2a568d3f05b86791 Mon Sep 17 00:00:00 2001 From: Tyler Lubeck Date: Wed, 21 Aug 2024 11:50:59 -0400 Subject: [PATCH] Add project ID to all logs from the collector When exporting metrics from multiple projects at once, it's useful to know which of the projects is generating metrics errors. Signed-off-by: Tyler Lubeck --- collectors/monitoring_collector.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/collectors/monitoring_collector.go b/collectors/monitoring_collector.go index 821c2438..b6228a9b 100644 --- a/collectors/monitoring_collector.go +++ b/collectors/monitoring_collector.go @@ -123,6 +123,8 @@ type DeltaHistogramStore interface { func NewMonitoringCollector(projectID string, monitoringService *monitoring.Service, opts MonitoringCollectorOptions, logger log.Logger, counterStore DeltaCounterStore, histogramStore DeltaHistogramStore) (*MonitoringCollector, error) { const subsystem = "monitoring" + logger = log.With(logger, "project_id", projectID) + apiCallsTotalMetric := prometheus.NewCounter( prometheus.CounterOpts{ Namespace: namespace,