azure-metrics-exporter icon indicating copy to clipboard operation
azure-metrics-exporter copied to clipboard

Log automatic retries from SDK

Open jkroepke opened this issue 2 years ago • 3 comments

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 avatar Jul 08 '23 06:07 jkroepke

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)
	}
})

jkroepke avatar Jul 08 '23 06:07 jkroepke

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

jiriwetter avatar Apr 30 '24 08:04 jiriwetter

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

jiriwetter avatar May 06 '24 07:05 jiriwetter