-
Notifications
You must be signed in to change notification settings - Fork 4
Use path pattern #1
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
base: master
Are you sure you want to change the base?
Conversation
uudashr
commented
May 7, 2020
- Use path as pattern if found, fallback to url.
- Test added
|
Also... it would be great if we can run the test on Github Action |
|
@uudashr are you still interested in updating this PR? I've added an Action to run tests. |
|
@lucacome conflict resolved |
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.
PR Overview
This PR refactors the middleware to use the request path as the operation name pattern if available, with a fallback to the URL, and adds tests to validate the behavior of the middleware options.
- Updates middleware implementation to support OperationNameFunc, SpanFilter, SpanObserver, URLTagFunc, and ComponentName options.
- Updates examples and README to use the new middleware signature with GlobalTracer and ComponentName.
- Introduces additional tests in middleware_test.go to validate operation naming, URL tagging, span filtering, error handling, and performance.
Reviewed Changes
| File | Description |
|---|---|
| middleware_test.go | Adds tests covering operation naming, span observation, filtering, URL tagging, error handling, and panic recovery. |
| examples/server.go | Updates middleware initialization to use opentracing.GlobalTracer and ComponentName option. |
| README.md | Updates usage instructions to match the updated middleware signature. |
| middleware.go | Refactors middleware implementation to leverage new options and fallback logic for operation name and URL tags. |
| examples/tracer/init.go | Improves error logging in tracer initialization by switching from fmt.Println to fmt.Printf. |
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.