webdevops / azure-metrics-exporter

Azure Monitor metrics exporter for Prometheus with dimension support, template engine and ServiceDiscovery
MIT License
124 stars 25 forks source link

Log automatic retries from SDK #55

Open jkroepke opened 1 year ago

jkroepke commented 1 year ago

Hi,

we guess, we are hitting sometimes rate-limits from Azure. Since the SDK has automatic retries enabled, we are getting sometime the error context deadline exceeded, since the request took longer than the configured scrapeInterval.

Is it possible to log an warning, if a retry appears? Logging the response, which reason we are getting for the 429 would be awesome to identity the root cause.

jkroepke commented 1 year ago

It should be something like this?

https://github.com/Azure/azure-sdk-for-go/blob/main/sdk/azidentity/README.md#logging

import azlog "github.com/Azure/azure-sdk-for-go/sdk/azcore/log"

azlog.SetEvents(log.EventRetryPolicy)
azlog.SetListener(func(cls azlog.Event, msg string) {
    if cls == azlog.EventRetryPolicy {
        // suggar logger
        logger.Warnln(err)
    }
})
Neurobion commented 5 months ago

Hi,

we guess, we are hitting sometimes rate-limits from Azure. Since the SDK has automatic retries enabled, we are getting sometime the error context deadline exceeded, since the request took longer than the configured scrapeInterval.

Is it possible to log an warning, if a retry appears? Logging the response, which reason we are getting for the 429 would be awesome to identity the root cause.

I'm not sure if the error context deadline exceeded means a problem with limits. I have set only one resource and one metric and it keeps returning this error. https://gosamples.dev/context-deadline-exceeded/

test.json

Neurobion commented 5 months ago

Can you take a look at this, please? It's acting strange.