open-telemetry / opentelemetry-configuration

JSON Schema definitions for OpenTelemetry file configuration
Apache License 2.0
36 stars 17 forks source link

Best way to support record only configuration #83

Open codeboten opened 6 months ago

codeboten commented 6 months ago

The OTel specification allows users to set a recording only option for sampler configuration. This option is not available via environment variables today: https://github.com/open-telemetry/opentelemetry-specification/blob/700f5138f4b10c6e9d11b41153f6e164c61f581d/specification/configuration/sdk-environment-variables.md#general-sdk-configuration

Should this use-case be supported by the configuration file? If so would it be as simple as adding one more type of sampler here: https://github.com/open-telemetry/opentelemetry-configuration/blob/6215d43ee00c4ebe32ca8cbaf4c2807600b73945/schema/tracer_provider.json#L57

jack-berg commented 6 months ago

I don't think we should support this directly. We should focus on allowing samplers to be configured, both built in and custom implementations. The samplers we directly reference in the schema are defined in Built-in sampler. If there were to be one which was "AlwaysRecordOnly" or something like that, we ought to support it.

Short of that, the way to use file configuration to get a sampler which returns RECORD_ONLY is to implement a custom sampler which returns the response, ensure its registered with an associated component provider, and reference it by name in the configuration file.