-
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
Sampling override with http.response.status_code doesn't work #3659
Comments
@zwilling79 you can use OpenTelemetry Extension to filter telemetry based on http.reponse.status_code. |
Hm, this may work. Nonetheless, I would prefer to have this part of the configuration file so that it can be easily adjusted, especially if it is specific to certain environments. For instance, today I just want to filter out the health checks and the prometheus endpoint requests which have a response code of 200. Tomorrow I want to filter out some additional business application endpoints that have a response code of 200. To compile/package/distribute the otel extension JAR for such changes looks a bit overkill. Furthermore, if you want to use different configurations for different environments, you have to maintain different otel extension JARs or add more complexity to read/evaluate further configuration files. I think, the problem in the code is that the values of the sampling override attributes are always treated as strings but the actual attribute is of type integer. So it is perhaps similar to #3378. |
Only attributes set at the start of the span are available for sampling, so attributes such as http.response.status_code or request duration won't work for sampling. Alternatively, you could try to use DCR. A tutorial: https://learn.microsoft.com/en-us/azure/azure-monitor/logs/tutorial-workspace-transformations-portal |
It is very confusing which attributes are available for sampling since 3.5.0. The docs point you to the "exporting span" line but that line is basically useless as it includes the http.status_code and is not printing for example url.full which i am able to use even though it is not included in the "exporting span" line. While the next line warns you that only attributes at the start of the span are available for sampling it would be great to know which attributes are available when i set my loglevel to debug. |
Have done exactly the same. Enabled the debug logging to see on which fields I can filter on. And because I saw |
we are thinking to add a warning during startup if there are sampling override attributes used which are known not to be available at span start such as |
Expected behavior
If you add a sampling override that filters out all requests with a specific HTTP response status, those requests shouldn't be shown in Application Insights.
Actual behavior
HTTP requests with the specified status code are shown in Application Insights.
To Reproduce
applicationinsights.json
that includes the below sampling setting:{ "status": "UP" }
System information
Please provide the following information:
Logs
The text was updated successfully, but these errors were encountered: