-
Notifications
You must be signed in to change notification settings - Fork 201
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 equivalence with 3.x to drop dependency based on a criteria #3102
Comments
@mercer can you try sampling overrides? |
@heyams can you provide an example where SQL dependency get sampled if duration > 50 ms? So two parts for this problem
I'd appreciate an example here. (Already tried to get inspired from "make noisy dependency call example"). In the meanwhile will turn the self-diagnose to debug. However, I'd preffer not to reverse enginner this, and work from documentation, if possible. |
So, the equivalent in 2.x would be something like
wired with
|
A bit more context:
|
@mercer i can come up with an example, but it will be helpful if you can share a sample app so that i can create a fix based on your app? My sql example's attributes will be different from yours. Or even better, let's have a quick call and I can show you how to locate the attributes and then apply sampling override? please email me at [email protected] to further discuss. |
You can apply filter rule on dependencies. It's via Log Analytics and the equivalent table is AppDependencie
Currently, we do not any filtering mechanism for dependencies based on duration. |
@heyams thanks for your swift answer, I will try today your suggestion for data collection rules. I hope this solution solves the cost problem -- batches introduces anomalies in cost patterns with low value telemetry data, and this anomaly needs to be dealt with different sampling rules than "normal" traffic. In the meanwhile, I had a few other questions regarding potential options, all the questions are in the context of 3.x java client.
|
@heyams I did an evaluation for adding a rule, but I don't see how I can configure a rule to apply to data to be sent to an appinsights instance, as targeted by the connection string. I'm prompted to provide a datasource, and I can't match any option to my expectation, that is, to have the rule apply to the appinsights instance. For instance, I'd like to test the setup from a local instance of the app, connection to a custom appinsights instance, and see the rule in action. |
[heyams] you can try custom dimensions and then use sampling overrides to filter telemetry
[heyams] can you try something like this:
Span.current().setAttribute("mode", "mode1");
{
"inheritedAttributes": [
{
"key": "mode",
"type": "string"
}
]
} Then each mode of the app will get tagged with "mode=mode1". "mode1" is the value was set in step 1.
[heyams] please try out data collection rule, if that doesn't work, we can engage further discussion to find a solution that meet your needs. if you use a custom version of our agent, you will need to update it whenever we have a new release. |
@mercer regarding this question, I've suggested You can use custom dimensions {
"customDimensions": {
"mytag": "appMode",
"anothertag": "${ANOTHER_VALUE}"
}
} ANOTHER_VALUE is an env variable you set for your app. For each mode of your app, you can set to a different value. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment. |
@heyams sorry for not responding earlier. We felt like we can't make this work in a straight-forward way, and downgrading to 2.x wasn't the right call, as we already had some things setup in the 3.x fashion. The way to mitigate the cost was to do a simple SQL dependency sample of 50%
I think the 3.x rewrite is missing functionality, especially on custom processors. The sampling overrides is inferior to 2.x TelemetryProcessor, or to dotnet's ITelemetryProcessor. Before you could apply any logic to sampling (or anything else really), while now there are only a few predefined scenarios supported. I hope that this system will not be ported as is to dotnet. Also, I believe the documentation can be improved. For example what are the fields (attributes) that one can configure the sampling overrides over. In any case, thanks for all the time you put into answering my questions @heyams, I hope this ticket may help improve the 3.x appinsights client for java! |
@mercer does DCR work? |
@heyams we did not invest more time into making DCR work either, because it seems too heavy for us. We would need to provision these rules at subscription level, while this is just a service. So in order to have this in prod, we would need:
|
@mercer - Are you open to a 30-minute meeting to discuss why KQL Ingestion Tranforms is too heavyweight? We want to understand your scenario a bit better so we can improve. If so can you shoot me a quick email at [email protected]? I'll be back in the office 7/5, to respond and set up a call. |
The scenario is the same as the initial description.
Given that "drop sql dependency spans that are duration is under than a certain threshold" is already possible in the 2.x of java and in current dotnet appinisghts clients, then the need to add more infrastructure to solve a problem with 3.x is too heavyweight, even if it works. I should be able to decide which spans leave my process in code. I'm happy to discuss this requirement, but if the answer is add/configure infrastructure, the the process will remain heavyweight. Why shouldn't I be allowed to prevent 99% of telemetry traffic at source? I understand that there is an option to "fix" the problem further down the pipeline, in a generic way, for all data collected, and this may even be a way to prevent costs. However, this should be an option, not "the only way" to sample data. I should be able to sample data at source based on any criteria -- again, this already works in 2.x java client and dotnet client, the capability is removed in 3.x java client due to rewrite to follow OpenTelemetry. |
@mercer since 3.5 GA, we added support for the OpenTelemetry java extensions. Now, you can use the extension to have your own span exporter and filter data based on any criteria. Sorry for taking this long to unblock you. |
Had a look at https://github.com/Azure-Samples/ApplicationInsights-Java-Samples/tree/main/opentelemetry-api/java-agent/TelemetryFilteredBaseOnRequestDuration but I can't seem to find where I would configure that requests under 5s should not be ingested. |
Is there a way to configure this for dependencies as well? My initial issue was to sample database dependencies that are under a threshold, say 10ms. |
it's under extensions folder DurationSpanExporter please read the readme. -Dotel.javaagent.extensions=../extensions/FilterSpanBasedOnDuration/target/FilterSpanBasedOnDuration-1.0-SNAPSHOT.jar main logic is in the ../extensions/FilterSpanBasedOnDuration. |
yes, same idea. it's creating your own span exporter. you can filter any span based on any criteria. |
Ok, do you have an example how I would differentiate a dependency from a trace? In other words, using the example #3102 (comment), how would one port the code from 2.x to 3.x for this particular use case? |
As a side-note, I think you should poopularize how 3.x java agent works with blog posts, technical documentation and so on, for example I find no blog posts today for AutoConfigurationCustomizerProvider. From the outside, it gives me the impresion that no one uses java version 3.x. |
Is your feature request related to a problem? Please describe.
I'd like to drop sql dependency spans that are duration is under than a certain threshold. In 2.x and dotnet is easy to do using a TelemetryProcessor or ITelemetryProcessor.
I have digested https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-telemetry-processors and I don't see how this would work.
Describe the solution you would like
An example would be great. The documentation could also include more real-world examples.
Describe alternatives you have considered
I considered downgrading to 2.x, but we need 3.x. We only have this problem in the java stack, not in .net
Additional context
Nothing else I can think of.
The text was updated successfully, but these errors were encountered: