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

Use auto-instrumentation SDK in global tracing #5920

Merged
merged 11 commits into from
Nov 21, 2024

Conversation

MrAlias
Copy link
Contributor

@MrAlias MrAlias commented Oct 24, 2024

When the auto-instrumentation attaches to a process using the global TracerProvider, and there has not been a delegate set, create a span from the go.opentelemetry.io/auto/sdk package so the OTel Go auto-instrumentation can instrument the application by default.

Resolve #5702

Benchmarks

goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/internal/global
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
                    │   old.txt    │            new.txt             │
                    │    sec/op    │    sec/op     vs base          │
StartEndSpanNoSDK-8   244.2n ± 21%   250.2n ± 23%  ~ (p=0.739 n=10)

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.1%. Comparing base (b99d2b8) to head (ffbc715).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #5920     +/-   ##
=======================================
- Coverage   84.6%   82.1%   -2.6%     
=======================================
  Files        272     273      +1     
  Lines      22883   23615    +732     
=======================================
+ Hits       19381   19397     +16     
- Misses      3157    3873    +716     
  Partials     345     345             

see 5 files with indirect coverage changes

---- 🚨 Try these New Features:

When the auto-instrumentation attaches to a process using the global
TracerProvider, and there has not been a delegate set, create a span
from the go.opentelemetry.io/auto/sdk package so the OTel Go
auto-instrumentation can instrument the application by default.
@MrAlias MrAlias marked this pull request as ready for review October 25, 2024 14:59
go.mod Outdated Show resolved Hide resolved
internal/global/trace.go Outdated Show resolved Hide resolved
MrAlias and others added 2 commits October 28, 2024 10:39
Do not allow use of auto/sdk outside of global pkg.
Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline with @MrAlias.

We think that before merging this it would be good to:

  1. rename sdk.GetTracerProvider to sdk.TracerProvider; reason: https://go.dev/doc/effective_go#Getters
  2. make a v1 release of go.opentelemetry.io/auto/sdk

.golangci.yml Outdated Show resolved Hide resolved
.golangci.yml Outdated Show resolved Hide resolved
@MrAlias MrAlias merged commit 99c3c66 into open-telemetry:main Nov 21, 2024
31 of 32 checks passed
@MrAlias MrAlias deleted the global-auto-sdk branch November 21, 2024 18:55
@pellared pellared added this to the v1.33.0 milestone Nov 25, 2024
@MrAlias MrAlias mentioned this pull request Dec 12, 2024
MrAlias added a commit that referenced this pull request Dec 12, 2024
### Added

- Add `Reset` method to `SpanRecorder` in
`go.opentelemetry.io/otel/sdk/trace/tracetest`. (#5994)
- Add `EnabledInstrument` interface in
`go.opentelemetry.io/otel/sdk/metric/internal/x`. This is an
experimental interface that is implemented by synchronous instruments
provided by `go.opentelemetry.io/otel/sdk/metric`. Users can use it to
avoid performing computationally expensive operations when recording
measurements. It does not fall within the scope of the OpenTelemetry Go
versioning and stability [policy](./VERSIONING.md) and it may be changed
in backwards incompatible ways or removed in feature releases. (#6016)

### Changed

- The default global API now supports full auto-instrumentation from the
`go.opentelemetry.io/auto` package. See that package for more
information. (#5920)
- Propagate non-retryable error messages to client in
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#5929)
- Propagate non-retryable error messages to client in
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`.
(#5929)
- Propagate non-retryable error messages to client in
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`.
(#5929)
- Performance improvements for attribute value `AsStringSlice`,
`AsFloat64Slice`, `AsInt64Slice`, `AsBoolSlice`. (#6011)
- Change `EnabledParameters` to have a `Severity` field instead of a
getter and setter in `go.opentelemetry.io/otel/log`. (#6009)

### Fixed

- Fix inconsistent request body closing in
`go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#5954)
- Fix inconsistent request body closing in
`go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`.
(#5954)
- Fix inconsistent request body closing in
`go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`.
(#5954)
- Fix invalid exemplar keys in
`go.opentelemetry.io/otel/exporters/prometheus`. (#5995)
- Fix attribute value truncation in
`go.opentelemetry.io/otel/sdk/trace`. (#5997)
- Fix attribute value truncation in `go.opentelemetry.io/otel/sdk/log`.
(#6032)
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.

Update the no-op trace implementations to support auto-instrumentation
5 participants