Skip to content

Commit

Permalink
Disable Azure blob exception logging (#3331)
Browse files Browse the repository at this point in the history
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 <phcrva@gmail.com>
  • Loading branch information
pharaujo committed Oct 19, 2020
1 parent 5627150 commit 7ec45ef
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions pkg/objstore/azure/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"regexp"
"time"

"github.com/Azure/azure-pipeline-go/pipeline"
blob "github.com/Azure/azure-storage-blob-go/azblob"
)

Expand All @@ -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 {
Expand Down

0 comments on commit 7ec45ef

Please sign in to comment.