RobustPerception / azure_metrics_exporter

Azure metrics exporter for Prometheus
Apache License 2.0
133 stars 69 forks source link

Timestamp offset for metrics #79

Closed ChristianGottinger closed 4 years ago

ChristianGottinger commented 4 years ago

I'm running the exporter to collect azure application gateway metrics. I face an time offset of 4 minutes for all metrics gotten from azure monitor.

I found the GetTimes function for query delay in code

// GetTimes - Returns the endTime and startTime used for querying Azure Metrics API
func GetTimes() (string, string) {
    // Make sure we are using UTC
    now := time.Now().UTC()

    // Use query delay of 3 minutes when querying for latest metric data
    endTime := now.Add(time.Minute * time.Duration(-3)).Format(time.RFC3339)
    startTime := now.Add(time.Minute * time.Duration(-4)).Format(time.RFC3339)
    return endTime, startTime
}

The exposed metrics endpoint does not provide any timestamp information which might explain the offset in prometheus.

...
 HELP throughput_bytespersecond_total throughput_bytespersecond_total
# TYPE throughput_bytespersecond_total gauge
throughput_bytespersecond_total{resource_group="some-rg",resource_name="some-resource"} 74
...

What am I doing wrong?

brian-brazil commented 4 years ago

This is how it works, #75 is where to discuss this.