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 Tornado server and client #426

Merged
merged 1 commit into from
Apr 16, 2021

Conversation

owais
Copy link
Contributor

@owais owais commented Apr 8, 2021

Description

Adds support for request and response hooks to Falcon instrumentation. Given how tornado works, we only have a single hook that gets called once per request. It gets passed the active handler instead of request/response objects.

Fixes #132

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 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 review from a team, codeboten and lzchen and removed request for a team April 8, 2021 10:20
CHANGELOG.md Outdated Show resolved Hide resolved
@@ -24,7 +24,7 @@
from opentelemetry.instrumentation.tornado import TornadoInstrumentor

# apply tornado instrumentation
TornadoInstrumentor().instrument()
# TornadoInstrumentor().instrument()
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this to be commented?

@@ -65,15 +65,21 @@ def fetch_async(tracer, func, _, args, kwargs):
span.set_attribute(key, value)

with trace.use_span(span):
if request_hook:
Copy link
Contributor

Choose a reason for hiding this comment

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

Any difference between calling request_hook within the use_span vs outside?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should be called right after the span is created right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No difference really. I'll move it out to avoid any future confusion.

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.

PR looks good @owais, just one question about the rst file and please address leighton's comments

@@ -0,0 +1,7 @@
OpenTelemetry Tornado Instrumentation
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the right place for this doc? i'm confused about the tornado/starlette/tornado.rst path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that. No idea how that happened. My guess is an unintentional drag in vscode sidebar :)

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.

Thanks for addressing my comment!

@codeboten
Copy link
Contributor

@owais please address the conflicts so we can get this merged

@owais
Copy link
Contributor Author

owais commented Apr 16, 2021

@codeboten updated.

@codeboten codeboten merged commit 4aec1e4 into open-telemetry:main Apr 16, 2021
@owais owais deleted the tornado-hooks-2 branch April 17, 2021 05:23
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.

Add request and response hooks to tornado instrumentation
3 participants