diff --git a/README.md b/README.md index 054aa7ab..785e241d 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ If you are still using the legacy [Access scopes][access-scopes], the `https://w | Flag | Required | Default | Description | | --------------------------------- | -------- | ------- | ----------- | | `google.project-id` | No | GCloud SDK auto-discovery | Comma seperated list of Google Project IDs | +| `monitoring.metrics-ingest-delay` | No | | Offsets metric collection by a delay appropriate for each metric type, e.g. because bigquery metrics are slow to appear | | `monitoring.metrics-type-prefixes | Yes | | Comma separated Google Stackdriver Monitoring Metric Type prefixes (see [example][metrics-prefix-example] and [available metrics][metrics-list]) | | `monitoring.metrics-interval` | No | `5m` | Metric's timestamp interval to request from the Google Stackdriver Monitoring Metrics API. Only the most recent data point is used | | `monitoring.metrics-offset` | No | `0s` | Offset (into the past) for the metric's timestamp interval to request from the Google Stackdriver Monitoring Metrics API, to handle latency in published metrics | diff --git a/collectors/monitoring_collector.go b/collectors/monitoring_collector.go index 5f6f1698..c5c9fa08 100644 --- a/collectors/monitoring_collector.go +++ b/collectors/monitoring_collector.go @@ -277,8 +277,8 @@ func (c *MonitoringCollector) reportMonitoringMetrics(ch chan<- prometheus.Metri return } level.Debug(c.logger).Log("msg", "adding ingest delay", "descriptor", metricDescriptor.Type, "delay", ingestDelay) - endTime.Add(ingestDelayDuration) - startTime.Add(ingestDelayDuration) + endTime = endTime.Add(ingestDelayDuration * -1) + startTime = startTime.Add(ingestDelayDuration * -1) } for _, ef := range c.metricsFilters {