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

Fix ASGI instrumentation default span name #418

Merged
merged 6 commits into from
May 27, 2021

Conversation

adamantike
Copy link
Contributor

@adamantike adamantike commented Apr 6, 2021

Description

Fixes ASGI default span name for SERVER spans, to be HTTP <method>.

Fixes #146.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Updated unit tests, executed with tox -e test-instrumentation-asgi.

Does This PR Require a Core Repo Change?

  • 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

@adamantike adamantike requested review from a team, codeboten and hectorhdzg and removed request for a team April 6, 2021 13:50
@@ -205,7 +206,7 @@ async def __call__(self, scope, receive, send):
@wraps(receive)
async def wrapped_receive():
with self.tracer.start_as_current_span(
span_name + " asgi." + scope["type"] + ".receive"
span_name + " " + scope["type"] + ".receive"
Copy link
Contributor

Choose a reason for hiding this comment

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

scope["type"].receive is not defined in the specs. I am wondering what we should do with these spans.
@codeboten thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

im wondering if the SpanKind should be set here in addition to having the name of the span reflect the sender/receiver as per the messaging semantic conventions: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/messaging.md#span-name

Copy link
Contributor

Choose a reason for hiding this comment

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

@adamantike
According to the specs, we should use a space instead of a period to separate destination name and operation name.

@codeboten
I think we actually should do that, following the specs, however might be out of scope for this pr.

@lzchen
Copy link
Contributor

lzchen commented May 3, 2021

@adamantike
Any updates on this PR?

@adamantike
Copy link
Contributor Author

@lzchen, sorry for the delay, I was waiting for a follow-up regarding the comment on scope["type"].receive.

I have rebased, and applied your other comment.

@codeboten
Copy link
Contributor

@adamantike apologies for the delay, i completely missed this in my notifications.

@codeboten
Copy link
Contributor

@adamantike have you had a chance to look at @lzchen's comment?

@adamantike
Copy link
Contributor Author

@lzchen @codeboten, I have replaced the separator for destination and operation names. Please, let me know if that's what we expect based on the specs.

Copy link
Contributor

@lzchen lzchen 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. Please rebase.

@adamantike
Copy link
Contributor Author

Rebased and fixed conflicts!

@lzchen
Copy link
Contributor

lzchen commented May 26, 2021

@adamantike

Please fix the lint issues, then we can merge this :)

@adamantike
Copy link
Contributor Author

adamantike commented May 26, 2021

Can it be that the CI error on the lint stage is failing globally for all PRs? It seems opentelemetry-test has been removed from PyPI:

lint run-test-pre: commands[37] | python -m pip install -e '/home/runner/work/opentelemetry-python-contrib/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-tornado[test]'
Obtaining file:///home/runner/work/opentelemetry-python-contrib/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-tornado
Collecting tornado>=6.0
  Downloading tornado-6.1-cp38-cp38-manylinux2010_x86_64.whl (427 kB)
Collecting opentelemetry-instrumentation==0.21b0
  Downloading opentelemetry_instrumentation-0.21b0-py3-none-any.whl (16 kB)
Collecting opentelemetry-api==1.2.0
  Downloading opentelemetry_api-1.2.0-py3-none-any.whl (37 kB)
Collecting opentelemetry-semantic-conventions==0.21b0
  Downloading opentelemetry_semantic_conventions-0.21b0-py3-none-any.whl (20 kB)
Collecting opentelemetry-util-http==0.21b0
  Downloading opentelemetry_util_http-0.21b0-py3-none-any.whl (3.6 kB)
ERROR: Could not find a version that satisfies the requirement opentelemetry-test==0.21b0 (from opentelemetry-instrumentation-tornado[test]) (from versions: none)
ERROR: No matching distribution found for opentelemetry-test==0.21b0
ERROR: InvocationError for command /home/runner/work/opentelemetry-python-contrib/opentelemetry-python-contrib/.tox/lint/bin/python -m pip install -e '/home/runner/work/opentelemetry-python-contrib/opentelemetry-python-contrib/instrumentation/opentelemetry-instrumentation-tornado[test]' (exited with code 1)

@lzchen
Copy link
Contributor

lzchen commented May 26, 2021

Ahh I see, should be fixed after this.

@codeboten codeboten merged commit 3bb28ab into open-telemetry:main May 27, 2021
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.

Fix asgi instrumentation default span name
4 participants