-
Notifications
You must be signed in to change notification settings - Fork 776
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: add tracing middleware #5397
Conversation
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Codecov Report
@@ Coverage Diff @@
## main #5397 +/- ##
==========================================
- Coverage 36.37% 36.30% -0.07%
==========================================
Files 169 170 +1
Lines 19036 19072 +36
==========================================
Hits 6924 6924
- Misses 11320 11356 +36
Partials 792 792
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
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.
Looks good! Only naming stuff.
} | ||
|
||
// Span executes function doFn inside new span with `operationName` name and hooking as child to a span found within given context if any. | ||
func Span1[T any](ctx context.Context, tracerName string, operationName string, doFn func(context.Context, trace.Span) T, opts ...trace.SpanStartOption) T { |
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.
Maybe rename it to SpanAny()
?
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.
SpanAny
does not make sense, 1
here refers to the number of element in the return statement (we could have Span2
, Span3
, etc... if we want to support funcs that return multiple values).
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.
Got it, makes sense.
Explanation
This PR adds a tracing middleware to all admission request handlers.
Every request will have a trace starting from the beginning of the request handling chain.