-
Notifications
You must be signed in to change notification settings - Fork 199
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
Suppressing autoinstrumentation properties do not have effect #3919
Comments
The OpenTelemetry way to suppress instrumentation is generally not supported today by the Application Insights Java agent, apart from a few cases: With the Application Insights Java agent, you can suppress instrumentation in this way: https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-config#suppress-specific-autocollected-telemetry
Thank you for having reported this. You can enable Application Insights self-diagnostics in this way: https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-config#self-diagnostics |
@jeanbisutti thank you for the useful link. I think I completely missed these configuration options. Now I tested them and, though substantially reduced, some alien telemetry is still coming:
My current configuration file lists all instrumentations, as in the document, with Also, is there any possibility (or any plans) to filter logs by logger name or in some other way? Currently I see two possibilities:
Both are not granular enough to pick only logs of your interest. I would like to disable a few particularly noisy loggers instead of these indiscriminate filters. |
You could also use the sampling overrides feature. An example to suppress HTTP requests: https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-sampling-overrides#example-suppress-collecting-telemetry-for-a-noisy-dependency-call
Could you please elaborate on what you mean by "own telemetry"? About the logs, can can today turn off the Logback instrumentation by setting the {
"instrumentation": {
"logging": {
"enabled": false
}
}
} When you say "Logback only", does it mean that you want to only turn off the Logback instrumentation, or only keep the Logback logging instrumentation? To filter by severity level, you could use this feature. |
Thank you @jeanbisutti,
Telemetry sent from our code through OpenTelemetry API. Not libraries and dependencies code.
When I said "Logback only" I just summarized what you said in the previous comment. For logging, you and the documentation mentioned:
I was saying that these settings are indiscriminate in a way that they enable/disable very large category of logs without the ability to fine tune. In particular, one can disable what's sent through Logback, but this is not very useful in my case. Your sampling overrides suggestion, however, provides an interesting idea. I did not think that sampling 0% is basically a filter. Logger name is sent as an attribute, which with with a regexp match could give me a way to shut off some loggers. I will give it a try. |
Yes This comment may interest you. |
You could use https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/monitor/azure-monitor-opentelemetry-exporter |
@jeanbisutti like I mentioned in the initial post, unfortunately, the Exporter does not work in Databricks due to a bug or library incompatibility. |
So I am going the way of sampling overrides and mostly it works great. Just wondering, are there other ways to match the overrides besides attributes? It would be great to have more fields to analyze with strict and regex comparison, e.g. dependency's type, name, result code, request's name, URL, response code, trace's message, etc. |
The sampling override can be configured with a telemetry type (request, dependency, trace <=> log) and an attribute. Numerous attributes are available (see https://opentelemetry.io/docs/specs/semconv/http/http-spans/ for HTTP requests). The sampling override has some limitations: https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-sampling-overrides#span-attributes-available-for-sampling |
If something you need does not seem possible, tell us. |
Thank you for guidance @jeanbisutti. I thought only custom attributes set by user are available, but now I can see that it's much more flexible. I think it is enough to cover my use case. Now regarding this bug report, originally I opened it due to not obeying OpenTelemetry way of controlling instrumentation of libraries, but now I see that this is not a bug since there was no intention to implement this logic. Still, do you see it as a functional gap? Maybe you have it on your roadmap? I was thinking about converting this into a feature request. |
@greatvovan Yes, please convert this into a feature request. It may confuse other users. |
Closing this as not a bug as per comments 1, 2. Transitioned into a feature request. |
Expected behavior
The official documentation describes a number of parameters to suppress automatic instrumentation in entirety or for specific libraries. It is fair to expect that instrumenting with Microsoft's agent will follow the same logic and obey the same configuration parameters.
Actual behavior
All suppression properties are ignored except
otel.javaagent.enabled
.To Reproduce
Originally faced this problem in a Databricks cluster, where alternative instrumentation approaches don't work either. I assumed that it might be an incompatibility with Spark runtime or Databricks environment, so I decided to test it on a smaller program, but it confirmed my fears.
The code: microsoft/ApplicationInsights-Java-Repros#13
Check your Application Insights instance to ensure that the logs are coming, contrary to the suppression parameter.
EXPECTED: Only the trace is coming as it was sent through OpenTelemetry API.
Let's compare this behavior with the vanilla agent from OpenTelemetry.
Note the log records printed by the Console Exporter.
Now let's disable the default instrumentation:
Console Exporter does not print any more.
Targeted suppression, like
otel.instrumentation.log4j-appender.enabled=false
works in the same way, disabling instrumentation in the vanilla agent, but having no effect with Microsoft's agent.The same applies to all other kinds of telemetry and other libraries.
Now in Databricks clusters I am blocked with telemetry on all fronts. The default autoinstrumentation generates insane amounts of telemetry from all imaginable Spark internals and makes instrumentation irrational due to ingestion costs. With Azure Exporter for Java just nothing works.
System information
Please provide the following information:
Logs
Maintainers, please note that the link provided by the template (Turn on SDK logs – https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-troubleshoot#debug-data-from-the-sdk) is no longer valid. The alternative document I found says that the logging is enabled by default into the text file, which I am attaching below. If more logging is required, please provide guidance.
The text was updated successfully, but these errors were encountered: