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

starlette instrumentation #777

Conversation

toumorokoshi
Copy link
Member

Addresses part of #710.

@toumorokoshi toumorokoshi requested a review from a team June 4, 2020 16:37
@toumorokoshi toumorokoshi changed the title Have a basic starlette instrumentation working. [WIP] Have a basic starlette instrumentation working. Jun 4, 2020
@toumorokoshi toumorokoshi changed the title [WIP] Have a basic starlette instrumentation working. [WIP] starlette instrumentation. Jun 5, 2020
@toumorokoshi toumorokoshi changed the title [WIP] starlette instrumentation. [WIP] starlette instrumentation Jun 5, 2020
toumorokoshi and others added 16 commits June 8, 2020 20:45

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
tox does exact match on fields delimited by a dash. Thus,
any instrumentation that includes "instrumentation" in the name
would collide with testing of the "opentelemetry-instrumentation"
package.

Renaming the tox environment resolves the issue.
@toumorokoshi toumorokoshi changed the title [WIP] starlette instrumentation starlette instrumentation Jun 11, 2020
Copy link
Member

@cnnradams cnnradams left a comment

Choose a reason for hiding this comment

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

Looks good overall, a few nits + questions I'm not sure about. There is some formatting stuff that isn't really relevant to starlette, but it looks good to me so 🤷

removing remaining asgi references.
Copy link
Member

@cnnradams cnnradams left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Looks pretty good! Just a couple of nits. The request for changes is on the typo in the tox file.

ext/opentelemetry-ext-asgi/setup.cfg Outdated Show resolved Hide resolved
ext/opentelemetry-instrumentation-starlette/setup.cfg Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
"""
if not getattr(app, "is_instrumented_by_opentelemetry", False):
app.add_middleware(
OpenTelemetryMiddleware,
Copy link
Contributor

Choose a reason for hiding this comment

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

Just out of curiosity, are we creating a starlette instrumentation (even though we can use asgi) for the same reason we have a flask instrumentation (when we could have recommended wsgi)?

Copy link
Member Author

@toumorokoshi toumorokoshi Jun 15, 2020

Choose a reason for hiding this comment

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

Kind of. We need a language-specific instrumentation no matter what, to add the "http.route" span attribute (there is no generic way to express route either wsgi or asgi).

Flask has an extended reason: to avoid calling updateName. However, I finally have an OTEP drafted that I believe will eliminate the deferred updateName requirement: open-telemetry/oteps#115. At that point we can extend wsgi to create the flask instrumentation, in a very similar way to how this instrumentation works.

Co-authored-by: alrex <aboten@lightstep.com>
Co-authored-by: Leighton Chen <lechen@microsoft.com>
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.

👍

@toumorokoshi toumorokoshi merged commit 39fa078 into open-telemetry:master Jun 15, 2020
@toumorokoshi toumorokoshi deleted the feature/starlette-instrumentation branch June 15, 2020 21:00
@hawkaa
Copy link
Contributor

hawkaa commented Jun 23, 2020

Looks really good, excited to try!

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.

None yet

5 participants