-
Notifications
You must be signed in to change notification settings - Fork 641
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
Request/response hooks for Falcon #415
Conversation
882c13f
to
35232e0
Compare
35232e0
to
83dd3f7
Compare
...on/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/__init__.py
Outdated
Show resolved
Hide resolved
@@ -83,21 +130,25 @@ class FalconInstrumentor(BaseInstrumentor): | |||
|
|||
def _instrument(self, **kwargs): | |||
self._original_falcon_api = falcon.API | |||
falcon.API = _InstrumentedFalconAPI | |||
falcon.API = partial(_InstrumentedFalconAPI, **kwargs) |
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.
Should we have explicit kwargs
names like the other instrumentations?
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.
Do you mean something like:
falcon.API = partial(
_InstrumentedFalconAPI,
traced_request_attributes=kwargs.pop("traced_request_attributes", None),
request_hook=kwargs.pop("request_hook", None),
response_hook=kwargs.pop("response_hook", None),
)
?
We could but we have to do the same thing again below so don't see a lot of value in it. Still open to adding 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.
Not a strong opinion.
@@ -178,6 +240,9 @@ def process_response( | |||
self, req, resp, resource, req_succeeded=None | |||
): # pylint:disable=R0201 | |||
span = req.env.get(_ENVIRON_SPAN_KEY) | |||
if span and self._response_hook: |
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.
Should this be called right before the span ends?
20eb5f3
to
4014879
Compare
4014879
to
dc8eac3
Compare
Description
Adds support for request and response hooks to Falcon instrumentation.
Fixes #137
Fixes #362
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.