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

Move to OpenTelemetry (#735) #778

Merged
merged 1 commit into from Jul 13, 2021
Merged

Conversation

Alvise88
Copy link
Contributor

@Alvise88 Alvise88 commented Jul 2, 2021

Signed-off-by: Alvise vitalvise@gmail.com

@Alvise88
Copy link
Contributor Author

Alvise88 commented Jul 2, 2021

There is no tagged buildkit release with opentelemetry integration

To fix (horrible) i have to do:

github.com/moby/buildkit => github.com/moby/buildkit v0.8.2-0.20210702052944-9cf28dcf2640

and modify the check to use only the first result:

check-buildkit-version:
	@test \
		"$(shell grep buildkit ./go.mod | head -1 | cut -d' ' -f2)" = \
		"$(shell grep ' = "v' ./util/buildkitd/buildkitd.go | sed -E 's/^.*version.*=.*\"(v.*)\"/\1/' )" \
		|| { echo buildkit version mismatch go.mod != util/buildkitd/buildkitd.go ; exit 1; }

The difference remains at runtime

@aluzzardi
Copy link
Member

Thanks @Alvise88, will review shortly!

Regarding buildkit: maybe we can continue using the same version of buildkit, and upgrade once the new one comes out. We will lose some tracing information but not too much.

@Alvise88
Copy link
Contributor Author

Alvise88 commented Jul 5, 2021

Thanks @Alvise88, will review shortly!

Regarding buildkit: maybe we can continue using the same version of buildkit, and upgrade once the new one comes out. We will lose some tracing information but not too much.

Ok, i disabled tracing to buildkit and reverted to v0.8.3.

@aluzzardi
Copy link
Member

@Alvise88 I'm looking at moby/buildkit#2152 trying to understand how they integrated OpenTelemetry to BuildKit.

I see for instance they're using trace.SpanFromContext(ctx) (from go.opentelemetry.io/otel/trace), whereas in this PR it's otel.Tracer() and I'm confused about the difference.

Do you have an idea of what's the difference?

Also, did you get a chance to try with Jaeger, and if so, are the spans from a dagger command combined into a single trace?

Thanks!

@Alvise88
Copy link
Contributor Author

Alvise88 commented Jul 7, 2021

@Alvise88 I'm looking at moby/buildkit#2152 trying to understand how they integrated OpenTelemetry to BuildKit.

I see for instance they're using trace.SpanFromContext(ctx) (from go.opentelemetry.io/otel/trace), whereas in this PR it's otel.Tracer() and I'm confused about the difference.

Do you have an idea of what's the difference?

Also, did you get a chance to try with Jaeger, and if so, are the spans from a dagger command combined into a single trace?

Thanks!

Hi, tomorrow i will show you how spans are genereted.
In opentelemetry you can define different traces; this should allow you to selectively disable tracing.

I think this instruction span := trace.SpanFromContext(ctx) permits you to retrive the active span in the context instead tr.Start permits you to create a child span.

I replaced your opentracing calls by analogy, i'm not 100% sure it's correct:
opentracing.StartSpanFromContext -> tr.Start
opentracing.SpanFromContext -> trace.SpanFromContext(ctx) (like buildkit)

I follow this documentation

@Alvise88
Copy link
Contributor Author

Alvise88 commented Jul 8, 2021

Hi @aluzzardi, i used docker compose to test tracing, the following images show you the result:

OpenTracing
opentracing

OpenTelemetry
opentelemetry

OpenTelemetry "Details"
opentelemetry-detail

New Buildkit integration
newbuildkit

@aluzzardi
Copy link
Member

Thanks for the explanation, and the screenshots you sent look good!

For some reason, with OpenTracing, Dagger and Buildkitd show up as separate (different color in Jaeger), but they appear the same with the OpenTelemetry version, not sure why.

Here's the OpenTracing details screenshot:

Screen Shot 2021-07-08 at 11 27 47 AM

However it's a very minor difference, I think we don't care

@Alvise88
Copy link
Contributor Author

Alvise88 commented Jul 8, 2021

I think the new integration uses the same traceprovider in the buildkit client:

append(opts, bk.WithTracerProvider(span.TracerProvider()))

currently i used only one traceprovider named Dagger, i don't know if it is better to instantiate a new provider named buildkit or consider traces as part of Dagger; the colors are related with the name of the provider

@aluzzardi
Copy link
Member

I think the PR is good as is!

Good for me to merge as soon as you remove "WIP" from the title :)

Buildkit 0.9.0 is about to come out (-rc1 is out already), which means we'll be able to get OpenTracing support from there as well.

@Alvise88 Alvise88 changed the title WIP: Move to OpenTelemetry (#735) Move to OpenTelemetry (#735) Jul 8, 2021
@Alvise88
Copy link
Contributor Author

Alvise88 commented Jul 8, 2021

I think the PR is good as is!

Good for me to merge as soon as you remove "WIP" from the title :)

Buildkit 0.9.0 is about to come out (-rc1 is out already), which means we'll be able to get OpenTracing support from there as well.

Ok, i removed the wip annotation; tell me if you want to change the buildkit version or if it is needed a rebase.

@aluzzardi aluzzardi linked an issue Jul 8, 2021 that may be closed by this pull request
@aluzzardi
Copy link
Member

Okay I just reviewed the code, left a few comments, after that it's good to go.

Ok, i removed the wip annotation; tell me if you want to change the buildkit version or if it is needed a rebase.

I think it's ok, we will change the buildkit version once it comes out

@netlify
Copy link

netlify bot commented Jul 9, 2021

✔️ Deploy Preview for devel-docs-dagger-io ready!

🔨 Explore the source changes: e34c4ba

🔍 Inspect the deploy log: https://app.netlify.com/sites/devel-docs-dagger-io/deploys/60e7fe9c1acebe0007745dc8

😎 Browse the preview: https://deploy-preview-778--devel-docs-dagger-io.netlify.app

Signed-off-by: Alvise <vitalvise@gmail.com>
@aluzzardi aluzzardi merged commit b101e19 into dagger:main Jul 13, 2021
@aluzzardi aluzzardi deleted the move-to-opentelemetry branch July 13, 2021 11:50
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.

Move to OpenTelemetry
2 participants