Skip to content

Commit

Permalink
Disable adding the mongo 'db.statement' tag by default
Browse files Browse the repository at this point in the history
As of now, the 'db.statement' tag is not obfuscated, which can lead
to sensitive information being leaked through the tag.

See #3388
  • Loading branch information
dubonzi committed Mar 2, 2023
1 parent 3ffe346 commit b978ed7
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ type config struct {
// newConfig returns a config with all Options set.
func newConfig(opts ...Option) config {
cfg := config{
TracerProvider: otel.GetTracerProvider(),
TracerProvider: otel.GetTracerProvider(),
CommandAttributeDisabled: true,
}
for _, opt := range opts {
opt.apply(&cfg)
Expand Down Expand Up @@ -68,7 +69,8 @@ func WithTracerProvider(provider trace.TracerProvider) Option {
}

// WithCommandAttributeDisabled specifies if the MongoDB command is added as an attribute to Spans or not.
// The MongoDB command will be added as an attribute to Spans by default if this option is not provided.
// This is disabled by default and the MongoDB command will not be added as an attribute
// to Spans if this option is not provided.
func WithCommandAttributeDisabled(disabled bool) Option {
return optionFunc(func(cfg *config) {
cfg.CommandAttributeDisabled = disabled
Expand Down

0 comments on commit b978ed7

Please sign in to comment.