@@ -36,6 +36,27 @@ import (
36
36
const (
37
37
// pkg is the package being instrumented.
38
38
pkg = "go.opentelemetry.io/otel/internal/global"
39
+
40
+ // Minimum version of go.opentelemetry.io/otel that supports using the
41
+ // go.opentelemetry.io/auto/sdk in the global API.
42
+ minAutoSDK = "1.33.0"
43
+ )
44
+
45
+ var (
46
+ otelWithAutoSDK = probe.PackageConstrainst {
47
+ Package : "go.opentelemetry.io/otel" ,
48
+ Constraints : version .MustConstraints (
49
+ version .NewConstraint (fmt .Sprintf (">= %s" , minAutoSDK )),
50
+ ),
51
+ FailureMode : probe .FailureModeIgnore ,
52
+ }
53
+ otelWithoutAutoSDK = probe.PackageConstrainst {
54
+ Package : "go.opentelemetry.io/otel" ,
55
+ Constraints : version .MustConstraints (
56
+ version .NewConstraint (fmt .Sprintf ("< %s" , minAutoSDK )),
57
+ ),
58
+ FailureMode : probe .FailureModeIgnore ,
59
+ }
39
60
)
40
61
41
62
// New returns a new [probe.Probe].
@@ -46,9 +67,11 @@ func New(logger *slog.Logger) probe.Probe {
46
67
}
47
68
48
69
uprobeNewStart := & probe.Uprobe {
49
- Sym : "go.opentelemetry.io/otel/internal/global.(*tracer).newSpan" ,
50
- EntryProbe : "uprobe_newStart" ,
51
- FailureMode : probe .FailureModeWarn ,
70
+ Sym : "go.opentelemetry.io/otel/internal/global.(*tracer).newSpan" ,
71
+ EntryProbe : "uprobe_newStart" ,
72
+ PackageConstrainsts : []probe.PackageConstrainst {
73
+ otelWithAutoSDK ,
74
+ },
52
75
}
53
76
54
77
c := & converter {
@@ -127,25 +150,40 @@ func New(logger *slog.Logger) probe.Probe {
127
150
Sym : "go.opentelemetry.io/otel/internal/global.(*tracer).Start" ,
128
151
EntryProbe : "uprobe_Start" ,
129
152
ReturnProbe : "uprobe_Start_Returns" ,
153
+ PackageConstrainsts : []probe.PackageConstrainst {
154
+ otelWithoutAutoSDK ,
155
+ },
130
156
},
131
157
{
132
158
Sym : "go.opentelemetry.io/otel/internal/global.(*nonRecordingSpan).End" ,
133
159
EntryProbe : "uprobe_End" ,
160
+ PackageConstrainsts : []probe.PackageConstrainst {
161
+ otelWithoutAutoSDK ,
162
+ },
134
163
},
135
164
{
136
165
Sym : "go.opentelemetry.io/otel/internal/global.(*nonRecordingSpan).SetAttributes" ,
137
166
EntryProbe : "uprobe_SetAttributes" ,
138
167
FailureMode : probe .FailureModeIgnore ,
168
+ PackageConstrainsts : []probe.PackageConstrainst {
169
+ otelWithoutAutoSDK ,
170
+ },
139
171
},
140
172
{
141
173
Sym : "go.opentelemetry.io/otel/internal/global.(*nonRecordingSpan).SetStatus" ,
142
174
EntryProbe : "uprobe_SetStatus" ,
143
175
FailureMode : probe .FailureModeIgnore ,
176
+ PackageConstrainsts : []probe.PackageConstrainst {
177
+ otelWithoutAutoSDK ,
178
+ },
144
179
},
145
180
{
146
181
Sym : "go.opentelemetry.io/otel/internal/global.(*nonRecordingSpan).SetName" ,
147
182
EntryProbe : "uprobe_SetName" ,
148
183
FailureMode : probe .FailureModeIgnore ,
184
+ PackageConstrainsts : []probe.PackageConstrainst {
185
+ otelWithoutAutoSDK ,
186
+ },
149
187
},
150
188
},
151
189
SpecFn : loadBpf ,
0 commit comments