-
Notifications
You must be signed in to change notification settings - Fork 551
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(instrumentation/asgi): add target to metrics #1323
Merged
Merged
Commits on Sep 10, 2022
-
feat(instrumentation/asgi): add target to metrics
This PR adds the target information for metrics reported by instrumentation/asgi. Unfortunately, there's no ASGI standard to reliably get this information, and I was only able to get it for FastAPI. I also tried to get the info with Sanic and Starlette (encode/starlette#685), but there's nothing in the scope allowing to recreate the route. Besides the included unit tests, the logic was tested using the following app: ```python import io import fastapi app = fastapi.FastAPI() def dump_scope(scope): b = io.StringIO() print(scope, file=b) return b.getvalue() @app.get("/test/{id}") def test(id: str, req: fastapi.Request): print(req.scope) return {"target": _collect_target_attribute(req.scope), "scope": dump_scope(req.scope)} sub_app = fastapi.FastAPI() @sub_app.get("/test/{id}") def sub_test(id: str, req: fastapi.Request): print(req.scope) return {"target": _collect_target_attribute(req.scope), "scope": dump_scope(req.scope)} app.mount("/sub", sub_app) ``` Partially fixes open-telemetry#1116 Note to reviewers: I tried to touch as less as possible, so that we don;t require a refactor before this change. However, we could consider changing `collect_request_attributes` so that it returns both a trace attributes and a metrics attributes. Wihout that change we cannot add the `HTTP_TARGET` attribute to the list of metric atttributes, because it will be present but with high cardinality.
Configuration menu - View commit details
-
Copy full SHA for 086213c - Browse repository at this point
Copy the full SHA 086213cView commit details -
Configuration menu - View commit details
-
Copy full SHA for c411055 - Browse repository at this point
Copy the full SHA c411055View commit details
Commits on Sep 15, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 0770591 - Browse repository at this point
Copy the full SHA 0770591View commit details
Commits on Sep 20, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 96316a6 - Browse repository at this point
Copy the full SHA 96316a6View commit details
Commits on Oct 9, 2022
-
Update instrumentation/opentelemetry-instrumentation-asgi/tests/test_…
…asgi_middleware.py Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 6bc84c9 - Browse repository at this point
Copy the full SHA 6bc84c9View commit details -
Update instrumentation/opentelemetry-instrumentation-asgi/src/opentel…
…emetry/instrumentation/asgi/__init__.py Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 97b7d0e - Browse repository at this point
Copy the full SHA 97b7d0eView commit details
Commits on Oct 16, 2022
-
Configuration menu - View commit details
-
Copy full SHA for ee55441 - Browse repository at this point
Copy the full SHA ee55441View commit details
Commits on Oct 21, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 8462428 - Browse repository at this point
Copy the full SHA 8462428View commit details -
Configuration menu - View commit details
-
Copy full SHA for e3f8de5 - Browse repository at this point
Copy the full SHA e3f8de5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8b313b3 - Browse repository at this point
Copy the full SHA 8b313b3View commit details
Commits on Oct 22, 2022
-
Configuration menu - View commit details
-
Copy full SHA for feb46b1 - Browse repository at this point
Copy the full SHA feb46b1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 96782ea - Browse repository at this point
Copy the full SHA 96782eaView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.