Skip to content

Commit

Permalink
Prevent map lookups in traceglobal probe when using Go >= 1.24 (#1573)
Browse files Browse the repository at this point in the history
* Add pkg constraint for Go swiss maps

Do no load the traceglobal direct global API instrumentation if the Go
version being used means swiss maps back the Go map implementation. The
probe does not handle this implementation but requires map parsing.

* Add warning to COMPATIBILITY.md

* Add a changelog entry
  • Loading branch information
MrAlias authored Jan 10, 2025
1 parent a965395 commit 70a9938
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ OpenTelemetry Go Automatic Instrumentation adheres to [Semantic Versioning](http
- Support `golang.org/x/net` `0.34.0`. ([#1552](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1552))
- Support `google.golang.org/grpc` `1.71.0-dev`. ([#1467](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1467))

### Changed

- Preemptively drop support for the `traceglobal` probe when `Go >= 1.24` is used. ([#1573](https://github.com/open-telemetry/opentelemetry-go-instrumentation/pull/1573))

## [v0.19.0-alpha] - 2024-12-05

### Added
Expand Down
4 changes: 4 additions & 0 deletions COMPATIBILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ Supported versions of [`otel`]:

- `v0.14.0` to `v1.33.0`

**Note**: Versions of `go.opentelemetry.io/otel < v1.33.0` are not supported
when using Go >= `1.24`. See [this issue] for details.

[`otel`]: https://pkg.go.dev/go.opentelemetry.io/otel
[this issue]: https://github.com/open-telemetry/opentelemetry-go-instrumentation/issues/1318

## Instrumented Library Compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const (
// Minimum version of go.opentelemetry.io/otel that supports using the
// go.opentelemetry.io/auto/sdk in the global API.
minAutoSDK = "1.33.0"
minGoMaps = "1.24.0"
)

var (
Expand All @@ -56,6 +57,14 @@ var (
),
FailureMode: probe.FailureModeIgnore,
}
goWithoutSwissMaps = probe.PackageConstrainst{
Package: "std",
Constraints: version.MustConstraints(
version.NewConstraint(fmt.Sprintf("< %s", minGoMaps)),
),
// Warn in logs that this is not supported.
FailureMode: probe.FailureModeWarn,
}
)

// New returns a new [probe.Probe].
Expand Down Expand Up @@ -151,13 +160,15 @@ func New(logger *slog.Logger) probe.Probe {
ReturnProbe: "uprobe_Start_Returns",
PackageConstrainsts: []probe.PackageConstrainst{
otelWithoutAutoSDK,
goWithoutSwissMaps,
},
},
{
Sym: "go.opentelemetry.io/otel/internal/global.(*nonRecordingSpan).End",
EntryProbe: "uprobe_End",
PackageConstrainsts: []probe.PackageConstrainst{
otelWithoutAutoSDK,
goWithoutSwissMaps,
},
},
{
Expand All @@ -166,6 +177,7 @@ func New(logger *slog.Logger) probe.Probe {
FailureMode: probe.FailureModeIgnore,
PackageConstrainsts: []probe.PackageConstrainst{
otelWithoutAutoSDK,
goWithoutSwissMaps,
},
},
{
Expand All @@ -174,6 +186,7 @@ func New(logger *slog.Logger) probe.Probe {
FailureMode: probe.FailureModeIgnore,
PackageConstrainsts: []probe.PackageConstrainst{
otelWithoutAutoSDK,
goWithoutSwissMaps,
},
},
{
Expand All @@ -182,6 +195,7 @@ func New(logger *slog.Logger) probe.Probe {
FailureMode: probe.FailureModeIgnore,
PackageConstrainsts: []probe.PackageConstrainst{
otelWithoutAutoSDK,
goWithoutSwissMaps,
},
},
},
Expand Down

0 comments on commit 70a9938

Please sign in to comment.