-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat: support opentelemetry for grpc tracing #7539
Conversation
19cc92c
to
5d7c1ab
Compare
Looks like it is not working due to the grpc version upgrade. Will try to resolve it. |
Close this for now and hopefully we can work back on this once grpc version is newer |
Reopening this as we now have updated gRPC runtime library to the latest version (v1.45.0) in ArgoCD. |
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.
Please revert some of the changes (I added a proper comment in those) before rebasing to avoid dealing with unnecessary conflicts.
cmd/util/trace.go
Outdated
) | ||
|
||
func InitTracer(serviceName, otlpAddress string) (trace.TracerProvider, func(), error) { | ||
ctx := context.Background() |
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.
We should probably receive the context from the main server build the resource with it.
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.
Updated.
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.
Sorry but it seems that this is still not using the context from the server.
This is the context that I was referring to:
ctx, cancel := context.WithCancel(ctx) |
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.
Sorry I missed that. One question here, why do we need the for loop?
for { |
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.
The for-loop is mainly to automatically restart the server if it eventually stops for any reason. You can not move the ctx
out of the for loop. Note that argocd.Run(...)
is a blocking call. Ideally the initialization of the tracer should be inside the Run()
function just like how it is done for the prometheus metric server.
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.
Thanks for the detailed reply. Then I think this is fixed.
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.
Sorry but you can't move the ctx out of the for-loop. A new context need to be build on every iteration and the initTracer
call needs to happen somewhere inside this loop.
Signed-off-by: Ben Ye <ben.ye@bytedance.com>
Signed-off-by: Ben Ye <ben.ye@bytedance.com>
5d7c1ab
to
c9c86b8
Compare
Signed-off-by: Ben Ye <ben.ye@bytedance.com>
Signed-off-by: Ben Ye <ben.ye@bytedance.com>
Codecov Report
@@ Coverage Diff @@
## master #7539 +/- ##
==========================================
- Coverage 45.63% 45.50% -0.14%
==========================================
Files 217 219 +2
Lines 25696 25895 +199
==========================================
+ Hits 11727 11783 +56
- Misses 12337 12473 +136
- Partials 1632 1639 +7
Continue to review full report at Codecov.
|
Signed-off-by: Ben Ye <ben.ye@bytedance.com>
ctx := context.Background() | ||
ctx, cancel := context.WithCancel(ctx) |
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.
This can't be moved outside this loop.
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.
If this cannot be moved, then the InitTracer
call should be inside the loop as well? Because it needs the server context
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.
Correct. A new context needs to be built on every loop iteration and the InitTracer
call needs to happen somewhere inside this loop.
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.
This seems a little bit weird to me. But anyway I updated the code.
Signed-off-by: Ben Ye <ben.ye@bytedance.com>
Hello @leoluz, is there any action item left for this PR? |
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.
LGTM
Fixes #4972
This pr adds support for basic grpc level tracing using
otelgrpc
to send traces to opentelemetry collector.Checklist: