Skip to content

Commit 57bbaf2

Browse files
committed
otelmongo: default to new semconv
1 parent 6544466 commit 57bbaf2

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/internal/semconv/event_monitor.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ import (
1414
"go.mongodb.org/mongo-driver/event"
1515
"go.opentelemetry.io/otel/attribute"
1616
semconv1210 "go.opentelemetry.io/otel/semconv/v1.21.0"
17-
semconv "go.opentelemetry.io/otel/semconv/v1.37.0"
17+
semconv "go.opentelemetry.io/otel/semconv/v1.30.0"
1818
)
1919

2020
// Constants for environment variable keys and versions.
2121
const (
22-
semconvOptIn = "OTEL_SEMCONV_STABILITY_OPT_IN"
23-
semconvOptInDup = "database/dup"
24-
semconvOptIn1260 = "database"
22+
semconvOptIn = "OTEL_SEMCONV_STABILITY_OPT_IN"
23+
semconvOptInDup = "database/dup"
2524
)
2625

2726
// EventMonitor is responsible for monitoring events with a specified semantic
@@ -88,13 +87,7 @@ func (m EventMonitor) CommandStartedTraceAttrs(
8887
)
8988
}
9089

91-
// Check for the 1.26.0 opt-in
92-
if hasOptIn(m.version, semconvOptIn1260) {
93-
return commandStartedTraceAttrs(evt, opts...)
94-
}
95-
96-
// Fallback to v1.21.0
97-
return commandStartedTraceAttrsV1210(evt, opts...)
90+
return commandStartedTraceAttrs(evt, opts...)
9891
}
9992

10093
// peerInfo extracts the hostname and port from a CommandStartedEvent.

instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo/internal/semconv/event_monitor_test.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ func TestNewEventMonitor(t *testing.T) {
2727
version: "",
2828
want: "",
2929
},
30-
{
31-
name: "Version 1260",
32-
version: semconvOptIn1260,
33-
want: "database",
34-
},
3530
{
3631
name: "Duplicate Version",
3732
version: semconvOptInDup,
@@ -114,18 +109,12 @@ func TestCommandStartedTraceAttrs(t *testing.T) {
114109
name: "no version",
115110
initAttrs: []attribute.KeyValue{},
116111
version: "",
117-
want: v1210,
112+
want: v1260,
118113
},
119114
{
120115
name: "unsupported version",
121116
initAttrs: []attribute.KeyValue{},
122117
version: "database/foo",
123-
want: v1210,
124-
},
125-
{
126-
name: "database",
127-
initAttrs: []attribute.KeyValue{},
128-
version: "database",
129118
want: v1260,
130119
},
131120
{

0 commit comments

Comments
 (0)