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

Added Falcon 2.0+ instrumentation #1039

Merged
merged 5 commits into from
Sep 16, 2020

Conversation

owais
Copy link
Contributor

@owais owais commented Aug 25, 2020

Add instrumentation for Falcon 2.0+

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • 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

  • Ships with automated tests
  • Tested with a demo app

Checklist:

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

@owais owais force-pushed the falcon-instrumentation branch 12 times, most recently from 1ad6ea6 to dca4987 Compare August 25, 2020 10:17
@owais owais marked this pull request as ready for review August 25, 2020 12:37
@owais owais requested a review from a team August 25, 2020 12:37
Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks pretty good, just a couple of things that need to be fixed.

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@codeboten codeboten added the instrumentation Related to the instrumentation of third party libraries or frameworks label Sep 3, 2020
@owais
Copy link
Contributor Author

owais commented Sep 8, 2020

@open-telemetry/python-approvers would appreciate if someone could help review this.

@owais owais force-pushed the falcon-instrumentation branch from 47fc481 to 7e84041 Compare September 8, 2020 22:31
Comment on lines 28 to 32
entry_points={
"opentelemetry_instrumentor": [
"falcon = opentelemetry.instrumentation.falcon:FalconInstrumentor"
]
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved to setup.cfg.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved.

try:
return super().__call__(env, _start_response)
except Exception as exc:
activation.__exit__(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am assuming that line 132 ends up calling _start_response. What if an exception is raised during the execution of start_response inside _start_response? Would that exception be caught here and activation.__exit__ end up being called twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Fixed to call exit after start_response finishes.

FalconInstrumentor().uninstrument()

def test_methods(self):
for method in ["GET", "POST", "PATCH", "PUT", "DELETE", "HEAD"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a comment, it can be worthy to have this separated in a test_X method for every method, so that if one of these tests fail, it gets reported in the results which method failed.

@owais owais force-pushed the falcon-instrumentation branch 4 times, most recently from 358d78c to 511c0d6 Compare September 11, 2020 10:19
@owais owais force-pushed the falcon-instrumentation branch from 511c0d6 to 678f27e Compare September 11, 2020 10:20
@codeboten codeboten merged commit 553f6e8 into open-telemetry:master Sep 16, 2020
@owais owais deleted the falcon-instrumentation branch September 16, 2020 17:39
alertedsnake pushed a commit to alertedsnake/opentelemetry-python that referenced this pull request Sep 25, 2020
adamantike added a commit to adamantike/opentelemetry-python-contrib that referenced this pull request Oct 25, 2021
Remove unwanted support for Python versions <3.6.
This integration mistakenly lists Python 3.4 support, because it was
merged in
open-telemetry/opentelemetry-python#1039,
after the merge of
open-telemetry/opentelemetry-python#1099, so the
latter didn't consider `falcon`.

Python 3.4 is broken nevertheless, as this integration already includes
f-strings and other `opentelemetry` dependencies, which require Python 3.6.

Fixes open-telemetry#772.
adamantike added a commit to adamantike/opentelemetry-python-contrib that referenced this pull request Oct 25, 2021
Remove unwanted support for Python versions <3.6.
This integration mistakenly lists Python 3.4 support, because it was
merged in
open-telemetry/opentelemetry-python#1039,
after the merge of
open-telemetry/opentelemetry-python#1099, so the
latter didn't consider `falcon`.

Python 3.4 is broken nevertheless, as this integration already includes
f-strings and other `opentelemetry` dependencies, which require Python 3.6.

Fixes open-telemetry#772.
owais pushed a commit to open-telemetry/opentelemetry-python-contrib that referenced this pull request Oct 25, 2021
Remove unwanted support for Python versions <3.6.
This integration mistakenly lists Python 3.4 support, because it was
merged in
open-telemetry/opentelemetry-python#1039,
after the merge of
open-telemetry/opentelemetry-python#1099, so the
latter didn't consider `falcon`.

Python 3.4 is broken nevertheless, as this integration already includes
f-strings and other `opentelemetry` dependencies, which require Python 3.6.

Fixes #772.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
instrumentation Related to the instrumentation of third party libraries or frameworks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants