-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Distinguish Tail Sampling Policies in Metrics by Prefixing Processor Name #34099
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Seems like an easy one to tackle. Do you want to give it a try? You can get the "componentID" from @codeboten, perhaps the component ID should be a parameter of the telemetry builder? I believe the same problem would occur to every other component. |
sure, I'll give it a go, can assign the issue to me |
This change includes the componentID as a dot prefix to the metrics 'policy' dimension when generating metrics for the processor. The change ensures that similarly named policys in the tail sampling processor that belong to different components also has a unique value. Resolves: open-telemetry#34099
…licy' (open-telemetry#34192) **Description:** Fixing a bug - This change includes the componentID as a dot prefix to the metrics `policy` dimension when generating metrics for the processor. The change ensures that similarly named policy's in the tail sampling processor that belong to different components also has a unique value in the `policy` field for the metrics. Also includes minor refactor change to rename `telemetry` to `telemetryBuilder` where applicable (return type == `NewTelemetryBuilder`) Resolves: open-telemetry#34099 **Link to tracking Issue:** <Issue number if applicable> **Testing:** Ran the collector locally with `make run` with the configuration below which uses the tail sampling processor and has metrics exposed in prometheus format. Sending sample zipkin spans to the receiver ```yaml receivers: zipkin: processors: tail_sampling: policies: [ { name: test-policy-1, type: always_sample } ] tail_sampling/custom_name: policies: [ { name: test-policy-1, type: always_sample } ] exporters: debug: service: telemetry: logs: metrics: pipelines: traces: receivers: [zipkin] processors: [tail_sampling, tail_sampling/custom_name] exporters: [debug] ``` Curling the metrics endpoint shows the policy name is unique for both tail sampling processors ```bash otelcol_processor_tail_sampling_sampling_decision_latency_bucket{policy="custom_name.test-policy-1",service_instance_id="X",service_name="otelcontribcol",service_version="0.105.0-dev",le="5000"} 1 otelcol_processor_tail_sampling_sampling_decision_latency_bucket{policy="test-policy-1",service_instance_id="X",service_name="otelcontribcol",service_version="0.105.0-dev",le="5000"} 1 ``` Tasks - [ ] Confirm prefix separator as `.` - [ ] Update change log entry
Component(s)
processor/tailsampling
Is your feature request related to a problem? Please describe.
Currently, the
otelcol_processor_tail_sampling_sampling_decision_latency_bucket
metric does not distinguish between different tail sampling policies if they share the same name. This is problematic because it makes it difficult to differentiate between metrics emitted by different policies, especially when they are defined in separate tail sampling processors. For example, bothtail_sampling/match
andtail_sampling/string
processors have a policy nameddefault-policy
, leading to identical metric labels and causing confusion in metric analysis.Describe the solution you'd like
To resolve this issue, I propose prefixing the policy label in the metric with the name of the tail sampling processor. This way, the metrics will be uniquely identifiable based on both the processor and the policy name. For instance:
The metric for the
default-policy
in thetail_sampling/match
processor would be labeled astail_sampling/match-default-policy
. (or remove the tail_sampling if it's too obvious and just use the name after the/
if any)The metric for the
default-policy
in thetail_sampling/string
processor would be labeled astail_sampling/string-default-policy
.Describe alternatives you've considered
Unique Names for Each Policy: One alternative is to ensure that each policy has a unique name across all processors. However, this approach is not scalable, especially when policies are defined across multiple files. It would require more coordination and management to avoid name collisions.
Additional context
Only raised the issue for
otelcol_processor_tail_sampling_sampling_decision_latency_bucket
but it's likely to be the case for the other metrics from the tail sampling processor unique to each policy definition.The text was updated successfully, but these errors were encountered: