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

Add otel tracing #45652

Merged
merged 4 commits into from
Sep 7, 2023
Merged

Add otel tracing #45652

merged 4 commits into from
Sep 7, 2023

Conversation

cpuguy83
Copy link
Member

  • Adds basic otel instrumentation to http transports/handlers
  • Adds OTLP/HTTP exporter
  • Updates tests to configure traces/spans automatically (as automatically as we can, anyway)
  • Exposes options in Makefile to pass through info needed to export traces from test daemon

@cpuguy83
Copy link
Member Author

image

Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

Tested this and it now logs "no trace recorder found, skipping" for every build. It happens because detect.Exporter() returns nil.

(This can be a follow-up as not directly related, but) I don't think client-side traces can work unless TraceCollector is set in control.NewController(control.Opt{

cmd/dockerd/tracing.go Outdated Show resolved Hide resolved
cmd/dockerd/tracing.go Outdated Show resolved Hide resolved
cmd/dockerd/tracing.go Outdated Show resolved Hide resolved
cmd/dockerd/daemon.go Outdated Show resolved Hide resolved
HistoryConfig: historyConf,
LeaseManager: wo.LeaseManager,
ContentStore: wo.ContentStore,
TraceCollector: getTraceExporter(ctx),
Copy link
Member

Choose a reason for hiding this comment

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

Note that the client trace delegation still doesn't work yet, but the issue is in buildx side where it is not enabled for all drivers. I'll make a patch for this tomorrow. Moby side looks correct.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

had a discussion in the maintainers call;

  • the integration tests already set the SERVICE_NAME (so for our own tests, it's not an issue to remove the daemon iD)
  • the current code moved "generating" the daemon-id only for OTEL (not ideal)
  • let's remove the ID for now, and work on other options in a follow-up

after that, "LGTM" (let's get this in!)

@thaJeztah thaJeztah added this to the 25.0.0 milestone Sep 7, 2023
This uses otel standard environment variables to configure tracing in
the daemon.
It also adds support for propagating trace contexts in the client and
reading those from the API server.

See
https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/
for details on otel environment variables.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Integration tests will now configure clients to propagate traces as well
as create spans for all tests.

Some extra changes were needed (or desired for trace propagation) in the
test helpers to pass through tracing spans via context.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This wires up the integration tests to export spans to a jager instance.
After tests are finished it exports the data out of jaeger and uploads
as an artifact to the action run.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This test ensures that we are able to propagate traces into buildkit's
history API.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83
Copy link
Member Author

cpuguy83 commented Sep 7, 2023

Updated and all is green.

@neersighted neersighted merged commit ce4e325 into moby:master Sep 7, 2023
103 checks passed
@thaJeztah
Copy link
Member

w000000000t! thank so much for this, @cpuguy83 !

@neersighted
Copy link
Member

@cpuguy83 I assume you'll be opening the GHA followup PRs?

@cpuguy83 cpuguy83 deleted the otel branch September 7, 2023 22:05
@thaJeztah
Copy link
Member

Now that this one's merged, I rebased, moved this one out of draft 😅 (wink wink, nudge nudge, say no more)

@cpuguy83
Copy link
Member Author

cpuguy83 commented Sep 8, 2023

@cpuguy83 I assume you'll be opening the GHA followup PRs?

#46429

kzys added a commit to superfly/flyctl that referenced this pull request Feb 15, 2024
Since moby/moby#45652,
client.NewClientWithOpts wraps its Transport with
otelhttp.NewTransport, but *otelhttp.Transport doesn't satisfy http.Transport.

Fixes #3274
kzys added a commit to superfly/flyctl that referenced this pull request Feb 15, 2024
Since moby/moby#45652,
client.NewClientWithOpts wraps its Transport with
otelhttp.NewTransport, but *otelhttp.Transport doesn't satisfy http.Transport.

Fixes #3274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants