Skip to content

Request/Response hooks for Tornado server and client#426

Merged
codeboten merged 1 commit intoopen-telemetry:mainfrom
owais:tornado-hooks-2
Apr 16, 2021
Merged

Request/Response hooks for Tornado server and client#426
codeboten merged 1 commit intoopen-telemetry:mainfrom
owais:tornado-hooks-2

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

# 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?

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 :)

@owais owais force-pushed the tornado-hooks-2 branch from 22c7cc5 to 55663c6 Compare April 13, 2021 06:09
@owais owais requested review from codeboten and lzchen April 13, 2021 06:09
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 owais force-pushed the tornado-hooks-2 branch from 55663c6 to 70efe10 Compare April 16, 2021 19:03
@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