Skip to content
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

Merged
merged 1 commit into from
Apr 13, 2021

Conversation

owais
Copy link
Contributor

@owais owais commented Apr 5, 2021

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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

  • Added new tests

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@owais owais requested a review from a team as a code owner April 5, 2021 23:15
@owais owais requested review from codeboten and aabmass and removed request for a team April 5, 2021 23:15
@owais owais force-pushed the falcon-request-hooks branch 8 times, most recently from 882c13f to 35232e0 Compare April 6, 2021 00:39
.github/workflows/test.yml 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)
Copy link
Contributor

@lzchen lzchen Apr 9, 2021

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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:
Copy link
Contributor

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?

@lzchen lzchen merged commit 9e99618 into open-telemetry:main Apr 13, 2021
@owais owais deleted the falcon-request-hooks branch April 13, 2021 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing Falcon instrumentation docs Add request and response hook to falcon instrumentation
4 participants