diff --git a/CHANGELOG.md b/CHANGELOG.md index acab402d439..9bbd9d97378 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed - Update `go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc` to align gRPC server span status with the changes in the OpenTelemetry specification. (#3685) +- Adding the `db.statement` tag to spans in `go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo` is now disabled by default. (#3519) ### Fixed diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go index b9acefa11fe..ef8117de62b 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/config.go @@ -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) @@ -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 diff --git a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go index e749aa81f50..b50fc6bed6f 100644 --- a/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go +++ b/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/mongo.go @@ -107,7 +107,7 @@ func (m *monitor) Finished(evt *event.CommandFinishedEvent, err error) { span.End() } -// TODO sanitize values where possible +// TODO sanitize values where possible, then reenable `db.statement` span attributes default. // TODO limit maximum size. func sanitizeCommand(command bson.Raw) string { b, _ := bson.MarshalExtJSON(command, false, false)