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

Change enable property on Instrumenter to a Predicate<Instrumenter> or a Supplier<Boolean> #11927

Open
osvaldopina opened this issue Jul 30, 2024 · 8 comments
Labels
enhancement New feature or request needs triage New issue that requires triage

Comments

@osvaldopina
Copy link

Is your feature request related to a problem? Please describe.

Allows a fine grain control over span creation for a Instrumenter.

Describe the solution you'd like

...
private final Predicate<Instrumenter> enabled;
...

...

 public boolean shouldStart(Context parentContext, REQUEST request) {
     if (!enabled.test(this)) {
      return false;
    }

...

Or

...
private final Supplier<Boolean> enabled;
...

...

 public boolean shouldStart(Context parentContext, REQUEST request) {
     if (!enabled.get()) {
      return false;
    }

...

Describe alternatives you've considered

I could not find any other way to enable or disable Instrumenter span creation on th fly. If there is such a mecanism this feature request would not be necessary.

Additional context

No response

@osvaldopina osvaldopina added enhancement New feature or request needs triage New issue that requires triage labels Jul 30, 2024
@osvaldopina osvaldopina changed the title Change enable property on Instrumenter to a Predicate<Instrumenter> or a Supplyer<Boolean> Change enable property on Instrumenter to a Predicate<Instrumenter> or a Supplier<Boolean> Jul 30, 2024
@laurit
Copy link
Contributor

laurit commented Jul 31, 2024

Please describe why you would need this.

@laurit laurit added the needs author feedback Waiting for additional feedback from the author label Jul 31, 2024
@osvaldopina
Copy link
Author

In my use case I create the instrumenters, both the ones provided by otel instrumentation and the ones that we develped internally, and I would like to be able to enable or disable a specific Instrumenter at runtime.

@github-actions github-actions bot removed the needs author feedback Waiting for additional feedback from the author label Jul 31, 2024
@trask
Copy link
Member

trask commented Oct 2, 2024

hi @osvaldopina, is this to support dynamic configuration? e.g. #12251 (comment)

@osvaldopina
Copy link
Author

Hi @trask. Yes, that's the goal.

@trask
Copy link
Member

trask commented Oct 11, 2024

there's a broader effort happening that I think may address your use case, check out open-telemetry/opentelemetry-java#6687 and #12251 (comment)

@osvaldopina
Copy link
Author

I took a look at the issues you pointed out. The 6687 has a broader effect of enabling or disabling all traces. I need something tied to each instrumenter allowing a much finer control. I saw 12251 and, as it is now, it is a list of intentions and my proposition could address one aspect of it. Looking at 6687 I realize that I can achieve what I need if the final clause is removed from the enabled attribute.

@trask
Copy link
Member

trask commented Oct 16, 2024

The 6687 has a broader effect of enabling or disabling all traces

it is per tracer (i.e. per instrumentation)

@trask
Copy link
Member

trask commented Oct 16, 2024

you can see more thoughts about 6687 in the spec work behind it: open-telemetry/opentelemetry-specification#3867

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs triage New issue that requires triage
Projects
None yet
Development

No branches or pull requests

3 participants