-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[otel-tracing] Initial opentelemetry support #3481
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3481 +/- ##
==========================================
- Coverage 56.38% 55.78% -0.61%
==========================================
Files 102 103 +1
Lines 7324 7543 +219
==========================================
+ Hits 4130 4208 +78
- Misses 2541 2675 +134
- Partials 653 660 +7
Continue to review full report at Codecov.
|
@milosgajdos Hi,What else do I need to do about this PR。 |
It would also be great to support client-side tracing in the registry client. In a recent project, I had to fork much of the client code to use |
Yes, your idea is great, but I don't know whether the registry client is the part of the distribution code or the project. If you can write in more detail, I can add this part of the function together. @aaronlehmann |
It is in the |
2f5af10
to
1f423d6
Compare
registry/client/repository.go
Outdated
@@ -791,25 +947,33 @@ func (bs *blobs) Create(ctx context.Context, options ...distribution.BlobCreateO | |||
if err != nil { | |||
return nil, err | |||
} | |||
span.SetAttributes(attribute.String("URL", u)) | |||
span.SetAttributes(attribute.String("Method", http.MethodPost)) | |||
|
|||
req, err := http.NewRequest("POST", u, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this need to be changed to NewRequestWithContext
? There are also some uses of NewRequest
elsewhere in this file and in registry/client/auth/session.go
and registry/client/blob_writer.go
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for changing to NewRequestWithContext
here? If we are to achieve trace injection, I think it can be achieved by otel.GetTextMapPropagator().Inject(traceCtx,propagation.HeaderCarrier(req.Header))
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had thought that the transport would get the span information from the context, but if that's not how it works you can disregard the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't understand it wrong,
1、Obtain the trace from the context and create a span, if there is one, create a new span if not
span, traceCtx := tracing.StartSpan(ctx, "blobs.delete")
2、Inject trace into other http services, go through the following steps
otel.GetTextMapPropagator().Inject(traceCtx, propagation.HeaderCarrier(req.Header))
67fe946
to
d8866e1
Compare
This will need a rebase |
Can you please rebase @lengrongfu |
hey @lengrongfu do you mind rebasing please? |
@milosgajdos hi, I don't understand how to do rebase, can you tell me the steps? thanks. |
issues: #3451
Local Repose workflows result :