fix excluded_urls in instrumentation-asgi#3567
Conversation
0185d60 to
7ec4b9a
Compare
emdneto
left a comment
There was a problem hiding this comment.
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. |
schneider8357
left a comment
There was a problem hiding this comment.
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.
* fix excluded_urls in instrumentation-asgi * fix ExcludeList or str * chhangelog --------- Co-authored-by: Riccardo Magliocchetti <[email protected]>
* fix excluded_urls in instrumentation-asgi * fix ExcludeList or str * chhangelog --------- Co-authored-by: Riccardo Magliocchetti <[email protected]>
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.