-
Notifications
You must be signed in to change notification settings - Fork 810
Add Support for Detecting Synthetic Source #3674
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?
Add Support for Detecting Synthetic Source #3674
Conversation
...pentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py
Outdated
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-requests/tests/test_user_agent_synthetic.py
Show resolved
Hide resolved
...pentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py
Outdated
Show resolved
Hide resolved
xrmx
left a comment
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.
Since there's nothing requests specific here I think this should go into opentelemetry-util-http instead. Said that I'm not sure we should ship our own experimental semantic conventions. I don't see any PR in the semantic-conventions repo adding this stuff, so could you please elaborate a bit what's your plan?
So I had seen this PR in semconv repo open-telemetry/semantic-conventions#1523 before writing that comment but I only read the PR description with an old attribute name and not the title with the updated one that matches this. So since we already have the attribute in the semconv since a few (https://github.com/open-telemetry/opentelemetry-python/blob/05343a5c8848f5f55a69100a0becf61766b33051/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/user_agent_attributes.py#L41) we should just import it from there and not opencode it. |
|
Thanks for the point out here, the guidance in OTel JS works a bit differently (they ask to hard-code these kinds of experimental semantic conventions in order to avoid breaking customers using the old experimental attributes). I'll update these imports. |
...pentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py
Outdated
Show resolved
Hide resolved
...pentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py
Show resolved
Hide resolved
...pentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/__init__.py
Outdated
Show resolved
Hide resolved
…github.com/JacksonWeber/opentelemetry-python-contrib into jacksonweber/populate-synthetic-attributes
Description
This pull request introduces synthetic user agent detection to OpenTelemetry Python instrumentation for HTTP requests, ASGI, and WSGI. The main goal is to automatically identify and annotate telemetry data with a synthetic type (such as "bot" or "test") based on the request's user agent string. This helps distinguish traffic from bots, monitoring systems, and tests versus real user traffic. The changes include updates to core instrumentation logic and comprehensive new test coverage.
Synthetic user agent detection and annotation:
opentelemetry-instrumentation-requests,opentelemetry-instrumentation-asgi, andopentelemetry-instrumentation-wsgi. When detected, the span attributeUSER_AGENT_SYNTHETIC_TYPEis set accordingly. [1] [2] [3]USER_AGENT_SYNTHETIC_TYPEand detection utility in the relevant modules. [1] [2] [3] [4] [5] [6]Testing and validation:
requestsinstrumentation, covering bots, test agents, case insensitivity, normal browsers, and priority rules.Test infrastructure updates:
Please delete options that are not relevant.
How Has This Been Tested?
Tested via unit tests included in
test_user_agent_synthetic.pyDoes This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.