-
Notifications
You must be signed in to change notification settings - Fork 195
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
Using Application Insights java Agent is impossible to suppress some handled exceptions #2941
Comments
hi @apescione! what version of Application Insights Java are you using? see https://github.com/microsoft/ApplicationInsights-Java/releases/tag/3.4.0:
|
oh, nevermind, I see you are using |
@apescione can you push a sample app to https://github.com/microsoft/ApplicationInsights-Java-Repros for a repro? thanks. |
Hi @heyams, I have no permission on that repo. Could you create one branch to push the example on it? |
hey @apescione, can you fork the repo and send PR from your fork? |
I've push in a my repo. You can find an example here. |
never mind, i was able to repro using |
@apescione can you try this applicationinsights-agent-3.4.11-SNAPSHOT.jar? |
@heyams
or this
it doesn't work. What is wrong in these configuration? Thank's. |
@apescione sorry, I forgot to mention, and it's configured like this: {
"preview": {
"captureRequestException" : false
}
} |
I've just tried and it works fine. It captures custom exceptions but not the suppress exceptions. When is it going to be available in a stable release? |
Yes, it will be part of our next GA release. Thank you for confirming. @apescione |
@apescione you can use sampling override to filter out exceptions on request. For your test app, here is the config: "preview": {
"sampling": {
"overrides": [
{
"telemetryType": "exception",
"attributes": [
{
"key": "exception.message",
"value": "An established connection was aborted by the software in your host machine",
"matchType": "strict"
}
],
"percentage": 0
}
]
}
} attributes can be found if you turn on self-diagnostics log to debug logging level and search for |
Thank you very much, "Broken pipe" is when the same application is raised from linux OS, instead your message, probably is from Windows machine. I'll try it just after you release 3.4.13 release. |
Context
I'm using a Spring Boot Application (Java) and WebFlux as the web layer (Reactor), and Tomcat is used as an Embedded web server.
In my application, I've Server-Sent-Event API like this:
This API sends events to clients using a HOT Stream.
I'm using the application insight java agent to instrument my application deployed into a docker container.
When a client disconnects himself from my application, the Spring application, in the next update through the client raises a
ClientAbortException and inner cause java.io.IOException: Broken pipe.
Expected behavior
Having a way to choose what exception I want to track. So, in my scenario, I don't want to consider this kind of exception "ClientAbortException and inner cause java.io.IOException: Broken pipe." on a particular API, because I know that sooner or later a client will disconnect itself (Close front end application, change page, etc...)
Actual behavior
Reading Microsoft documentation, it seems there is a way to choose the "Sampling" for each metric, so that, if you set percentage to 0, you can suppress the metric and avoid that agent sents it to cloud.
Here's the documentation: https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-sampling-overrides
Despite it is a preview, it works fine for AgentLogExporter, in fact, if the "exception" is coming from a log, it can be managed, but if the metric is from TelemetryItemExporter, it seems there is no way to suppress it.
Here's the metric that I'd like to suppress:
To Reproduce
It's very simple, create with web flux a server sent event api that produce an event every few seconds, connect the client (browser is enough) and close the browser. The next event that cannot be write on stream because the client is disconnected you are going to have a IOException: Broken pipe.
Sample Application
System information
Please provide the following information:
Consideration
Avoiding the sending of these metrics, I want to also reduce the cloud cost, because in my scenario I have always a huge number of this unuseful exceptions
Thank you in advance.
The text was updated successfully, but these errors were encountered: