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

Option to suppress controller and view spans #3865

Merged

Conversation

trask
Copy link
Member

@trask trask commented Aug 18, 2021

Introduces two new options:

  • otel.instrumentation.common.experimental.suppress-controller-spans
  • otel.instrumentation.common.experimental.suppress-view-spans

to suppress the controller and view spans.

@trask trask force-pushed the add-option-to-suppress-internal-spans branch from fc1b222 to 4945738 Compare August 21, 2021 19:42
@trask trask changed the title Option to suppress spring-webmvc internal spans Option to suppress controller and view spans Aug 21, 2021
@trask
Copy link
Member Author

trask commented Aug 22, 2021

I explored using the new "instrumentation type" for this suppression, but I think the instrumentation type is nicely scoped to semantic conventions, and so this doesn't quite fit. And since there's not semantic conventions, or semantic convention attribute extractors for controllers and views, there's no way to auto-detect the instrumentation type in this case.

An open question I have is that it might be nicer to have a "noop" Instrumenter that can be used, instead of having setDisabled() on InstrumenterBuilder, but since Instrumenter is not an interface creating a "noop" Instrumenter is a bit awkward.

@trask trask marked this pull request as ready for review August 22, 2021 17:43
@trask
Copy link
Member Author

trask commented Aug 22, 2021

I went ahead and applied to all existing Instrumenters to get a fuller picture

import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;

public final class DropwizardSingletons {

private static final String INSTRUMENTATION_NAME = "io.opentelemetry.dropwizard-views-0.7";

private static final boolean SUPPRESS_CONTROLLER_SPANS =
Config.get()
.getBoolean("otel.instrumentation.common.experimental.suppress-controller-spans", false);
Copy link
Contributor

@anuraaga anuraaga Aug 23, 2021

Choose a reason for hiding this comment

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

We should somehow have this in the javaagent-api artifact rather than copying into every module I guess. Either a method on Config or something like JavaAgentConfig with all of them exposed rather than using the flags directly.

Comment on lines 12 to 14
// lazy initialized, so that javaagent can set it, and library instrumentation can fall back and
// read system properties
@Nullable private static ExperimentalConfig instance = null;
Copy link
Member

Choose a reason for hiding this comment

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

That's not true for this class - I think we can safely use a static final instance. It is Config that needs to have lazy initialization, because it's "real" instance is being set by the agent.

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed, thx!

@trask trask merged commit 6f22d90 into open-telemetry:main Aug 25, 2021
@trask trask deleted the add-option-to-suppress-internal-spans branch August 25, 2021 20:43
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

4 participants