-
Notifications
You must be signed in to change notification settings - Fork 722
fix excluded_urls in instrumentation-asgi #3567
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: main
Are you sure you want to change the base?
Conversation
0185d60
to
7ec4b9a
Compare
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.
CI is failing. Maybe we should instead check if excluded_urls is already an ExcludeList?
My fault, you are right, the problem: The fix check if excluded_urls isistance of string, if not use the object without changes: if isinstance(excluded_urls, str):
excluded_urls = parse_excluded_urls(excluded_urls) |
Right. Can you add a changelog entry? |
Sorry for the wait, I just did 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.
LGTM, the change is small and non-invasive. From what I understand, ExcludeList accepts Iterable[str], and it’s a common pattern to use strings in regex format for that. The helper function parse_excluded_urls splits the string accordingly, so the init function would now accept a string as well.
Two unit tests were added, covering the cases of an excluded URL and a non-excluded URL. I suggest adding tests with multiple exclusions in a single string, but I'm unsure if that is really necessary.
Description
If set value "excluded_urls" in OpenTelemetryMiddleware, in instrumentation-asgi. class fails: 'str' object has no attribute 'url_disabled'.
Fixes #3562
excluded_urls with parse_excluded_urls
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
In instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.