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

add option to disable asgi intern trace #815

Closed
wants to merge 1 commit into from
Closed

add option to disable asgi intern trace #815

wants to merge 1 commit into from

Conversation

raphaelauv
Copy link

@raphaelauv raphaelauv commented Nov 22, 2021

Description

Add an option to disable intern trace of the asgi instrumentation

Fixes #831

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

  • Test A

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

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 22, 2021

CLA Signed

The committers are authorized under a signed CLA.

@raphaelauv raphaelauv marked this pull request as ready for review December 29, 2021 10:53
@raphaelauv raphaelauv requested a review from a team December 29, 2021 10:53
@owais
Copy link
Contributor

owais commented Dec 29, 2021

@raphaelauv could you please add some explanation about this or create an issue? It would be nice to know what problem this solves or why having those spans can be a problem in the first place. Normally a custom processor/exporter or Otel collector should be used to drop specific spans.

@raphaelauv
Copy link
Author

The current ASGI instrumentation produce 3 spans :

Screenshot from 2021-12-30 13-44-17

So I was proposing to add an option to disable the two internal spans. Like ask with this issue -> #831

custom processor/exporter or Otel collector should be used to drop specific spans.

never heard about that before , do you have any example ? Thank you

@owais
Copy link
Contributor

owais commented Dec 30, 2021

Thanks. Yes, I understand you'd like to disable generation of the two spans but what I'm trying to understand is why those spans are a problem in the first place?

@raphaelauv
Copy link
Author

why those spans are a problem in the first place?
I do not need them and I propose to add an option to disable theses internal spans.

@lzchen
Copy link
Contributor

lzchen commented Jan 4, 2022

@raphaelauv
Is it possible to create a custom sampler that drop spans based off of name or kind? You can also create a custom span processor that drops the spans that you don't need.

@raphaelauv raphaelauv closed this Feb 5, 2022
@raphaelauv raphaelauv deleted the fix/disable_asgi_intern_trace branch February 5, 2022 17:24
@shwetasah-cape
Copy link

@raphaelauv Is it possible to create a custom sampler that drop spans based off of name or kind? You can also create a custom span processor that drops the spans that you don't need.

I am trying to create a custom span processor by overriding the on_end method in SpanProcessor, but it doesn't seem to be dropping the span. Is there any example in the docs for a customSpanProcessor to drop spans or prevent them from being exported?

class SpanDroppingProcessor(SpanProcessor):
    def on_end(self, span: ReadableSpan) -> None:
        if span.kind == SpanKind.INTERNAL and span.attributes.get("type") == "http.response.body":
            return

@bsmedberg-xometry
Copy link

@shwetasah-cape did you ever come across a solution to suppress these spans? Context for our organization is that for larger requests or responses, we are sometimes seeing dozens or more little "send" and "receive" spans coming from the ASGI integration, and this is causing is cost+load issues in our opentelemetry collector for little actual value, so I'd like to ASAP figure out a way to suppress these at the application level before they get to our collector.

@shwetasah-cape
Copy link

I am sorry I couldn't figure out how to suppress them. We too have the exact same context as yours.

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.

FastApi auto-instrumentation send extra spans for a single API execution
5 participants