Skip to content

Conversation

@csmarchbanks
Copy link
Contributor

@csmarchbanks csmarchbanks commented Sep 8, 2025

Description

Allow the Tail Sampling Processor to use extensions that implement an interface simply containing NewEvaluator. To use an extension all that needs to be done is specify the extension's type/name such as my_extension or my_extension/my_name in the type field of the policy configuration. When configuration is loaded or updated NewEvaluator will be called.

Extensions can be configured in two places. First, in the extensions section like all other extensions. This is useful for configuration such as if an extension needs to connect to an external service. In addition, configuration can be defined in the policy config under a key matching the type of the extension for anything related to one instance, following the pattern for all other policy types. This is useful when reusing the same extension e.g. different params for different services. For example:

type: custom_policy
custom_policy:
  foo: bar

What this ends up with is that extensions look exactly like all other policy types with no need for users to know about some sort of extension container.

I have tested this out with an extension in a custom build and it is working well, I am sure we will iterate on the interfaces a bit as we write more. Specifically a way to stop the extension when policies are updated may be necessary to clean up any background processes. @yvrhdn is working on an extension we plan to add to contrib as well.

Link to tracking issue

Part of #31582

@github-actions github-actions bot added the first-time contributor PRs made by new contributors label Sep 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2025

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better!

@atoulme atoulme added the processor/tailsampling Tail sampling processor label Sep 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

Welcome, contributor! Thank you for your contribution to opentelemetry-collector-contrib.

Important reminders:

A maintainer will review your pull request soon. Thank you for helping make OpenTelemetry better!

Allow the Tail Sampling Processor to use extensions that implement an
interface simply containing NewEvaluator. To use an extension all that
needs to be done is specify the extension's type/name such as
my_extension or my_extension/my_name in the type field of the policy
configuration. When configuration is loaded/updated the extension will
be called in order to create a new evaluator.

Extensions can be configured in two places. First, in the extensions
section like all other extensions. This is useful for configuration such
as if an extension needs to connect to an external service. In addition,
an object can defined under the "extension" key the policy config for
anything related to one instance. This is useful when reusing the same
extension e.g. different params for different services.
This matches all of the other policy types where the key for the
configuration matches the type of the policy. E.g. you configure
ottl_condition by setting ottl_condition: {...}
It can be useful for an instance of an evaluator to know the name of the
policy for debugging or reporting purposes. Since a single type can be
used multiple times with different configuration.
@csmarchbanks csmarchbanks force-pushed the tsp-extensions branch 2 times, most recently from e8f1241 to e6fe359 Compare September 10, 2025 16:04
@csmarchbanks csmarchbanks marked this pull request as ready for review September 10, 2025 17:27
@csmarchbanks csmarchbanks requested a review from a team as a code owner September 10, 2025 17:27
@github-actions github-actions bot requested a review from portertech September 10, 2025 17:27
@atoulme
Copy link
Contributor

atoulme commented Sep 17, 2025

@portertech please review as codeowner, thanks!

@csmarchbanks
Copy link
Contributor Author

This has codeowner approval now, anything else needed before merge?

@ArthurSens ArthurSens added ready to merge Code review completed; ready to merge by maintainers and removed waiting-for-code-owners labels Oct 3, 2025
@atoulme atoulme merged commit f77eb42 into open-telemetry:main Oct 4, 2025
238 of 241 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 4, 2025
@otelbot
Copy link
Contributor

otelbot bot commented Oct 4, 2025

Thank you for your contribution @csmarchbanks! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time contributor PRs made by new contributors processor/tailsampling Tail sampling processor ready to merge Code review completed; ready to merge by maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants