Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

objstore.s3: add trace functionality #937

Merged
merged 4 commits into from
Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ config:
http_config:
idle_conn_timeout: 0s
insecure_skip_verify: false
trace:
enable: false
```

AWS region to endpoint mapping can be found in this [link](https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region)
Expand All @@ -62,6 +64,7 @@ For debug and testing purposes you can set

* `insecure: true` to switch to plain insecure HTTP instead of HTTPS
* `http_config.insecure_skip_verify: true` to disable TLS certificate verification (if your S3 based storage is using a self-signed certificate, for example)
* `trace.enable: true` to enable the minio client's verbose logging. Each request and response will be logged into the debug logger, so debug level logging must be enabled for this functionality.

### Credentials
By default Thanos will try to retrieve credentials from the following sources:
Expand Down
10 changes: 10 additions & 0 deletions pkg/objstore/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ type Config struct {
SecretKey string `yaml:"secret_key"`
PutUserMetadata map[string]string `yaml:"put_user_metadata"`
HTTPConfig HTTPConfig `yaml:"http_config"`
TraceConfig TraceConfig `yaml:"trace"`
}

type TraceConfig struct {
Enable bool `yaml:"enable"`
}

// HTTPConfig stores the http.Transport configuration for the s3 minio client.
Expand Down Expand Up @@ -152,6 +157,11 @@ func NewBucketWithConfig(logger log.Logger, config Config, component string) (*B
sse = encrypt.NewSSE()
}

if config.TraceConfig.Enable {
logWriter := log.NewStdlibAdapter(level.Debug(logger), log.MessageKey("s3TraceMsg"))
GiedriusS marked this conversation as resolved.
Show resolved Hide resolved
client.TraceOn(logWriter)
}

bkt := &Bucket{
logger: logger,
name: config.Bucket,
Expand Down