-
Notifications
You must be signed in to change notification settings - Fork 202
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
Telemetry filters on span events #3375
Comments
@ivan-zaitsev span #2 above, current telemetry processor supports it. {
"type": "attribute",
"include": {
"matchType": "strict",
"attributes": [
{
"key": "http.status_code",
"value": 404
}
]
},
"actions": [
{
"action": "insert",
"key": "controlledError",
"value": true
}
],
"id": "mark as not an error for status codes"
} Are you asking for supporting filtering |
Yes. Second span is there just as an example. The first one has actual events. |
From different thread @heyams said that it won`t be supported. It's sad that this won't be supported, because currently it is not possible to filter on events or exceptions (they added as span events). If I would submit merge request, would you consider adding this feature? I think it is pretty easy to add, because EventData already contains How i think it can be added:
Then it would be possible to filter on event attributes like this (only new type is added, everything else is the same):
It is possible to filter on "exception.type" and "exception.message" event attributes because they are added automatically by ImmutableExceptionEventData. |
@ivan-zaitsev I'm going to work on the sample app using OTEL extensions. if it doesn't work, i will discuss it with my team and then get back to you. |
Hello @heyams Tried to create OTEL extension, but it didn't work. I can see that my custom Code example:
Run app
|
Figured it out. Usual otel extension creation guidelines with span exporters are not applicable here. But this way it is not possible to do any conditions on spans, because:
Code example:
Either I missed something, or it seems pretty limited that it is not possible to add span processors/exporters which would modify span for the I think if it a custom exporter as a delegate for existing one would be added here then it should be possible to check/modify spans right away before exporting. |
Happy new year! Will get back to you soon. Sorry was out of office during the holidays. Thank you for trying :) |
@ivan-zaitsev I tried something similar here. My extension code gets applied, but it requires some code change in the Java agent in order to make it full-functional. |
Hello @heyams Thank you for your help. |
@ivan-zaitsev yes, that's the part I need to fix in our java agent. But |
Hello @heyams, any update on this? Seems that there no other way at the moment to add any custom span processing on top of this java agent. |
@ivan-zaitsev yes, #3493 is intended to support OpenTelemetry Extension. I will test it in my sample and get back to you soon. |
@heyams Thanks! Sorry for pinging you too often, I just thought it was abandoned :) |
@ivan-zaitsev no, we're working on it.. It's a bit tricky though. I will make sure i test it and then confirm it's working in my sample.. then once this is released next week, you can use it. you have been super helpful assisting me getting to the bottom of this. I appreciate your patience. |
@ivan-zaitsev good news! it seems to be working. Azure-Samples/ApplicationInsights-Java-Samples#272 will generate this payload: {
"ver": 1,
"name": "RemoteDependency",
"time": "2024-01-16T22:55:00.503Z",
"iKey": "<REDACTED>",
"tags": {
"ai.internal.sdkVersion": "java:3.5-SNAPSHOT",
"ai.operation.id": "d1d540898b5bc6697637561c9dea25db",
"ai.cloud.roleInstance": "<REDACTED>"
},
"data": {
"baseType": "RemoteDependencyData",
"baseData": {
"ver": 2,
"id": "018c905b75ea7b3f",
"name": "mySpan",
"type": "InProc",
"duration": "00:00:10.297740",
"success": true,
"properties": {
"controlledError": "true", **// this is added via the Telemetry Processor**
"myCustomAttributeKey2": "myCustomAttributeValue2", **// added via the extension via the Sample above**
"myCustomAttributeKey": "myCustomAttributeValue"
}
}
}
} You can reproduce it if you follow my readme . It will be part of 3.5 GA release probably next week if no delay. I'll give you an update. |
@ivan-zaitsev just a heads up: 3.5 GA release is delayed to the week of Feb 21. We are waiting for a couple of fixes in upstream to be released in OpenTelemetry 2.1. Thank you for your patience. |
3.5.0 is live today. |
Thanks, it means we can close this issue? |
i can close it for you. i will update the sample too. thank you! |
@ivan-zaitsev I've updated the sample app using the latest java agent. Azure-Samples/ApplicationInsights-Java-Samples#272. It is working as expected. Please follow the readme for detail on build command and kusto query instructions. |
@heyams Thank you. |
Is your feature request related to a problem? Please describe.
Currently only filtering on attributes is supported
ApplicationInsights-Java/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/processors/SpanExporterWithAttributeProcessor.java
Lines 38 to 47 in 547ec61
Describe the solution you would like
It would be good to have filtering also on span events. For example, if span event contains some fields and it is specified as include or exclude option the span processor actions such as adding new attribute should be executed.
Example (azure blob storage deleteIfExists):
Code:
Produced spans:
My use case is to add additional attribute if any of these spans are found. As azure marks these spans as "success = false", and I want to add additional attribute to mark this as "controlled error".
Also, for all attributes operation "and" is applied (all include filters should be true), it would be good to configure it somehow to have ability to specify some "or" conditions. Currently it is possible to do that only by creating duplicate sections for processors, what leads to complexity. This would give ability to filter multiple spans using only one processor. See example with azure blob storage deleteIfExists which produces multiple spans.
The text was updated successfully, but these errors were encountered: