-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[processor/traces] Action/sampling on resources attributes based on span attributes #20294
Comments
cc: @TylerHelmuth |
Pinging code owners for processor/tailsampling: @jpkrohling. See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@jpkrohling I'm not familiar with the tailsamplingprocessor config, but when I hear "I wish I had access to this piece of telemetry" I think of OTTL. Is there a place in tailsamplingprocessor where we could utilize OTTL conditions? |
That's an interesting thought. Perhaps we could do a brainstorming session, looking at the current policies and seeing which ones could be replaced by an "OTTL policy". |
Hi @jpkrohling @TylerHelmuth any updates on this? Are we expecting OTTL policy for tail sampling processor soon? |
I think OTTL can help here, but I won't be able to work on it soon. |
Same. I'm happy to review your PR, @yehaotian, in case you want to send one, but I don't have time to work on it myself. |
@yehaotian CMIIW, the expected configuration should be something like this? processors:
tail_sampling:
...
policies:
[
{
name: ottl_policy_1,
type: ottl_policy,
query: sample(attributes["your.custom.attributes"] = "/health") # or something else meets OTTL standard
}, I feel like we could replace @jpkrohling I'm pretty interested in implementing this. May I have your suggestion, like:
|
Couple quick suggestions:
Hopefully the tailsamplingprocesor would be able to take advantage of @jpkrohling I haven't read through the tailsamplingprocessor code myself, but if |
Yes, it boils down to that. We have more states than just booleans, but a policy can decide to return only a "sample" or "not sampled" if it wants. |
@yehaotian Please check the OTTL condition policy and see if it mets your requirement :P |
Closing this for now as the OTTL condition policy will allow conditions based any telemetry field. Please ping me if you think it should be reopened. |
@TylerHelmuth Thanks for the change!!
btw no error messages. |
Debug log:
The span does have debug-id attribute |
@yehaotian is |
Yes, this is something can be added in the business logic for debug. |
@yehaotian Out of curiosity what happens if you do == instead? I want to make sure we didn't accidentally inverse the condition. |
@TylerHelmuth @yehaotian I believe this should work. test case as below: {
"OTTL conditions inverse match(!=) span attributes 2",
[]string{"attributes[\"attr_k_1\"] != \"attr_v_1\""}, // this is my ottl condition
[]string{},
[]spanWithAttributes{{SpanAttributes: map[string]string{"attr_k_1": "attr_v_2"}}}, // span attributes
false,
Sampled, // it should be sampled
}, I will check it again today with " != nil" condition. |
After enabling debug logging exporter, I notice sometimes the attributes fail to be reported to otel collector which seems super wired to me. |
For our testing purposes we need to reduce variability. Can you use the attributeprocessor or transformprocessor to add the attribute to the telemetry before the tailsamplingprocessor to ensure that it is always present? |
Thanks for clarifying this. I checked the {
Desc: "OTTL conditions 1",
SpanConditions: []string{"attributes[\"attr_k_1\"] == \"attr_v_1\""},
SpanEventConditions: []string{},
Spans: []spanWithAttributes{{SpanAttributes: map[string]string{"attr_k_1": "attr_v_1"}}},
WantErr: false,
Decision: Sampled,
},
{
Desc: "OTTL conditions 2",
SpanConditions: []string{"attributes[\"attr_k_1\"] != \"attr_v_1\""},
SpanEventConditions: []string{},
Spans: []spanWithAttributes{{SpanAttributes: map[string]string{"attr_k_1": "attr_v_1"}}},
WantErr: false,
Decision: NotSampled,
},
{
Desc: "OTTL conditions 3",
SpanConditions: []string{"attributes[\"attr_k_1\"] != nil"},
SpanEventConditions: []string{},
Spans: []spanWithAttributes{{SpanAttributes: map[string]string{"attr_k_1": "attr_v_1"}}},
WantErr: false,
Decision: Sampled,
}, |
Component(s)
traces related processors
Is your feature request related to a problem? Please describe.
Usecase:
We have some debug span attributes and would like to 100% sample it in
tailsamplingprocessor
policy. At this moment tail sampling processor does not support policy on span attributes but only on resource and recordstring_attribute
.Currently we do not have status code on span, so that the workaround is using
spanprocessor
to setERROR
status when match the debug span attribute and leveragestatus_code
policy for 100% sampling.However, we have a new case need to send the trace(debug trace) contains the debug span attribute to a different destination instead sending all ERROR cases, how can we use the current attribute/filter/span/resources/tailsampling processors to achieve that?
Note: The debug span attribute only exist in the root span, not all spans in the trace.
Describe the solution you'd like
If the current processors cannot make it happen, several solutions can be applied:
spanprocessor
able to set resource and record attributes instead of just status code.resourcesprocessor
able to insert/set resource and record attributes when match span attributes.attributesprocessor
able to insert/set resource and record attributes when match span attributes.tailsamplingprocessor
policy on span attributes (unlikely due to performance?)Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: