From fb8d81d9e50a24e13b0ccf021bb534591f8210ec Mon Sep 17 00:00:00 2001 From: Pedro Araujo Date: Fri, 16 Oct 2020 14:35:56 +0100 Subject: [PATCH] Disable Azure blob exception logging Ever since the introduction of the deletion marker, Thanos compact has been filling the logs with Azure blob storage exceptions. As discussed in #2565, the error logging should be handled by Thanos itself, so this patch turns off standard logging from the Azure library. However, [due to the way logging is set up in the library][1], it will always log errors to syslog, regardless of how `ShouldLog` is configured. As such, and until that can be a configurable behavior, care should be taken to handle that from the syslog side as well. [1]: https://github.com/Azure/azure-storage-blob-go/blob/48358e1de5110852097ebbc11c53581d64d47300/azblob/zc_policy_request_log.go#L100-L102 Signed-off-by: Pedro Araujo --- CHANGELOG.md | 1 + go.mod | 1 + pkg/objstore/azure/helpers.go | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f46c0c168..6ce02f9fac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re ### Fixed - [#3257](https://github.com/thanos-io/thanos/pull/3257) Ruler: Prevent Ruler from crashing when using default DNS to lookup hosts that results in "No such hosts" errors. +- [#3331](https://github.com/thanos-io/thanos/pull/3331) Disable Azure blob exception logging ## [v0.16.0](https://github.com/thanos-io/thanos/releases) - Release in progress diff --git a/go.mod b/go.mod index 87554f58f9..78c2d54090 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/thanos-io/thanos require ( cloud.google.com/go v0.56.0 cloud.google.com/go/storage v1.6.0 + github.com/Azure/azure-pipeline-go v0.2.2 github.com/Azure/azure-storage-blob-go v0.8.0 github.com/NYTimes/gziphandler v1.1.1 github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d diff --git a/pkg/objstore/azure/helpers.go b/pkg/objstore/azure/helpers.go index 0189a49acf..a372878ac9 100644 --- a/pkg/objstore/azure/helpers.go +++ b/pkg/objstore/azure/helpers.go @@ -10,6 +10,7 @@ import ( "regexp" "time" + "github.com/Azure/azure-pipeline-go/pipeline" blob "github.com/Azure/azure-storage-blob-go/azblob" ) @@ -34,6 +35,14 @@ func getContainerURL(ctx context.Context, conf Config) (blob.ContainerURL, error p := blob.NewPipeline(c, blob.PipelineOptions{ Retry: retryOptions, Telemetry: blob.TelemetryOptions{Value: "Thanos"}, + RequestLog: blob.RequestLogOptions{ + // Log a warning if an operation takes longer than the specified duration. + // (-1=no logging; 0=default 3s threshold) + LogWarningIfTryOverThreshold: -1, + }, + Log: pipeline.LogOptions{ + ShouldLog: nil, + }, }) u, err := url.Parse(fmt.Sprintf("https://%s.%s", conf.StorageAccountName, conf.Endpoint)) if err != nil {