Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent map lookups in traceglobal probe when using Go >= 1.24 #1573

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Jan 9, 2025

Part of #1318

The traceglobal probe looks up tracers in a map. The current implementation will break for Go >= 1.24 where the map implementation will change. This adds a package constraint to ensure that probe is not loaded in that situation and documents this in COMPATIBILITY.md.

This was tested manually by setting the package constraint to Go >= 1.19 and building/running the rolldice example with appropriate versions. The appropriate warnings were logged.

go-auto-1   | {"time":"2025-01-09T22:20:37.982853153Z","level":"INFO","source":{"function":"main.main","file":"/app/cli/main.go","line":103},"msg":"building OpenTelemetry Go instrumentation ...","globalImpl":false,"version":{"Release":"v0.19.0-alpha","Revision":"060b385bd6615d86178576fcc00ce8a42fd1f173-dirty","Go":{"Version":"go1.23.4","OS":"linux","Arch":"amd64"}}}
go-auto-1   | {"time":"2025-01-09T22:20:40.003146178Z","level":"INFO","source":{"function":"go.opentelemetry.io/auto/internal/pkg/process.(*Analyzer).DiscoverProcessID","file":"/app/internal/pkg/process/discover.go","line":64},"msg":"found process","pid":813756}
go-auto-1   | {"time":"2025-01-09T22:20:40.014164784Z","level":"INFO","source":{"function":"go.opentelemetry.io/auto/internal/pkg/process.remoteAllocate.func1","file":"/app/internal/pkg/process/allocate.go","line":70},"msg":"Detaching from process","pid":813756}
go-auto-1   | {"time":"2025-01-09T22:20:40.014328357Z","level":"INFO","source":{"function":"go.opentelemetry.io/auto.NewInstrumentation","file":"/app/instrumentation.go","line":113},"msg":"target process analysis completed","pid":813756,"go_version":"1.22.10","dependencies":{"github.com/go-logr/logr":"1.4.2","github.com/go-logr/stdr":"1.2.2","go.opentelemetry.io/otel":"1.31.0","go.opentelemetry.io/otel/metric":"1.31.0","go.opentelemetry.io/otel/trace":"1.31.0","std":"1.22.10"},"total_functions_found":4}
go-auto-1   | {"time":"2025-01-09T22:20:40.020969534Z","level":"INFO","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation.(*Manager).loadProbes","file":"/app/internal/pkg/instrumentation/manager.go","line":374},"msg":"loading probe","name":{"SpanKind":2,"InstrumentedPkg":"net/http"}}
go-auto-1   | {"time":"2025-01-09T22:20:40.411866414Z","level":"INFO","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation.(*Manager).loadProbes","file":"/app/internal/pkg/instrumentation/manager.go","line":374},"msg":"loading probe","name":{"SpanKind":3,"InstrumentedPkg":"go.opentelemetry.io/otel/internal/global"}}
go-auto-1   | {"time":"2025-01-09T22:20:40.800743683Z","level":"WARN","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation/probe.(*Base[...]).loadUprobes","file":"/app/internal/pkg/instrumentation/probe/probe.go","line":187},"msg":"package constraint not meet, skipping uprobe","probe":{"SpanKind":3,"InstrumentedPkg":"go.opentelemetry.io/otel/internal/global"},"symbol":"go.opentelemetry.io/otel/internal/global.(*tracer).Start","package":"std","constraint":"< 1.19.0"}
go-auto-1   | {"time":"2025-01-09T22:20:40.800781614Z","level":"WARN","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation/probe.(*Base[...]).loadUprobes","file":"/app/internal/pkg/instrumentation/probe/probe.go","line":187},"msg":"package constraint not meet, skipping uprobe","probe":{"SpanKind":3,"InstrumentedPkg":"go.opentelemetry.io/otel/internal/global"},"symbol":"go.opentelemetry.io/otel/internal/global.(*nonRecordingSpan).End","package":"std","constraint":"< 1.19.0"}
go-auto-1   | {"time":"2025-01-09T22:20:40.80079266Z","level":"WARN","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation/probe.(*Base[...]).loadUprobes","file":"/app/internal/pkg/instrumentation/probe/probe.go","line":187},"msg":"package constraint not meet, skipping uprobe","probe":{"SpanKind":3,"InstrumentedPkg":"go.opentelemetry.io/otel/internal/global"},"symbol":"go.opentelemetry.io/otel/internal/global.(*nonRecordingSpan).SetAttributes","package":"std","constraint":"< 1.19.0"}
go-auto-1   | {"time":"2025-01-09T22:20:40.800804997Z","level":"WARN","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation/probe.(*Base[...]).loadUprobes","file":"/app/internal/pkg/instrumentation/probe/probe.go","line":187},"msg":"package constraint not meet, skipping uprobe","probe":{"SpanKind":3,"InstrumentedPkg":"go.opentelemetry.io/otel/internal/global"},"symbol":"go.opentelemetry.io/otel/internal/global.(*nonRecordingSpan).SetStatus","package":"std","constraint":"< 1.19.0"}
go-auto-1   | {"time":"2025-01-09T22:20:40.800819684Z","level":"WARN","source":{"function":"go.opentelemetry.io/auto/internal/pkg/instrumentation/probe.(*Base[...]).loadUprobes","file":"/app/internal/pkg/instrumentation/probe/probe.go","line":187},"msg":"package constraint not meet, skipping uprobe","probe":{"SpanKind":3,"InstrumentedPkg":"go.opentelemetry.io/otel/internal/global"},"symbol":"go.opentelemetry.io/otel/internal/global.(*nonRecordingSpan).SetName","package":"std","constraint":"< 1.19.0"}

Then the cut-off was reverted to 1.24 and the warnings were verified to no longer be logged.

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.
@MrAlias MrAlias marked this pull request as ready for review January 9, 2025 22:32
@MrAlias MrAlias requested a review from a team as a code owner January 9, 2025 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant