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

switch to go.opentelemetry.io/otel/semconv/v1.17.0 #46645

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

thaJeztah
Copy link
Member

While updating the docker/docker dependency in BuildKit, I noticed that the dependency tree showed two separate versions of the semconv package; BuildKit and containerd were using the v1.17.0 version and docker/docker was using v1.7.0.

This patch updates the version we use to align with BuildKit and containerd.

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah thaJeztah added this to the 25.0.0 milestone Oct 14, 2023
client/hijack.go Outdated
@@ -66,7 +66,8 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (_ net.Conn,
}

ctx, span := tp.Tracer("").Start(ctx, req.Method+" "+req.URL.Path)
span.SetAttributes(semconv.HTTPClientAttributesFromHTTPRequest(req)...)
// TODO(thaJeztah): should this also set trace.SpanKindClient like containerd's tracing package does (or use containerd's tracing.WithHTTPRequest?; https://github.com/containerd/containerd/blob/8c087663b0233f6e6e2f4515cee61d49f14746a8/tracing/tracing.go#L38-L47)
Copy link
Member Author

Choose a reason for hiding this comment

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

I stumbled upon that containerd code when looking how the other projects used this code (containerd/containerd@5082fb3), and noticed the code in containerd also set that property;

// WithHTTPRequest marks span as a HTTP request operation from client to server.
// It'll append attributes from the HTTP request object and mark it with `SpanKindClient` type.
func WithHTTPRequest(request *http.Request) SpanOpt {
return func(config *StartConfig) {
config.spanOpts = append(config.spanOpts,
trace.WithSpanKind(trace.SpanKindClient), // A client making a request to a server
trace.WithAttributes(httpconv.ClientRequest(request)...), // Add HTTP attributes
)
}
}

That code was originally added as part of containerd/containerd@3b87d46#diff-d6dd575a9d10716db9ac385bf5f394a2e65d638311159e8726b3200fcc596989R572-R577, but perhaps someone more familiar with this knows if we should add the same

/cc @cpuguy83 @tonistiigi

Copy link
Member

Choose a reason for hiding this comment

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

Yes this should set the span kind.

@thaJeztah thaJeztah marked this pull request as ready for review October 14, 2023 12:49
While updating the docker/docker dependency in BuildKit, I noticed that the
dependency tree showed _two_ separate versions of the semconv package;
BuildKit and containerd were using the v1.17.0 version and docker/docker was
using v1.7.0.

This patch updates the version we use to align with BuildKit and containerd.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@@ -65,8 +65,8 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (_ net.Conn,
}
}

ctx, span := tp.Tracer("").Start(ctx, req.Method+" "+req.URL.Path)
span.SetAttributes(semconv.HTTPClientAttributesFromHTTPRequest(req)...)
ctx, span := tp.Tracer("").Start(ctx, req.Method+" "+req.URL.Path, trace.WithSpanKind(trace.SpanKindClient))
Copy link
Member Author

Choose a reason for hiding this comment

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

@cpuguy83 I added trace.WithSpanKind(trace.SpanKindClient) here

Do you think we should look at using containerd's tracing package as well (in a follow-up)? I can make create a tracking issue for that if it makes sense to do.

@thaJeztah thaJeztah merged commit 91cb91a into moby:master Oct 16, 2023
@thaJeztah thaJeztah deleted the otel_semconv branch October 16, 2023 18:10
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.

3 participants