Skip to content
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

Question - metrics sampling #1902

Closed
NguyHa03 opened this issue Oct 6, 2021 · 8 comments · Fixed by #1942
Closed

Question - metrics sampling #1902

NguyHa03 opened this issue Oct 6, 2021 · 8 comments · Fixed by #1942

Comments

@NguyHa03
Copy link

NguyHa03 commented Oct 6, 2021

I see that we could override sampling for request (docs), do we have something like that for custom metrics ?
I want to keep all metrics at 100% and other telematry at sampling (like 10%)

I found that Standard Metric would be suitable for my scenario (docs), but java codeless is currently not support. Could we have any other solution ?

@ghost ghost added the Needs: Triage 🔍 label Oct 6, 2021
@heyams
Copy link
Contributor

heyams commented Oct 8, 2021

@NguyHa03 can you try metrics filtering. It was introduced in telemetry processor since 3.1.1.

@NguyHa03
Copy link
Author

NguyHa03 commented Oct 8, 2021

@heyams Thanks for reply
metrics filtering means that I have to set sampling rate of application insight to 100% and filter out metrics that I don't want. It's not suitable for my case.
I need to keep sampling for all telematry like (traces, perfomances..) at 10% to reduce cost and keep all metrics at 100% for business accuracy.

@heyams
Copy link
Contributor

heyams commented Oct 8, 2021

@NguyHa03 can you try increasing the interval metirc-interval. by default, perf counters and custom metrics are captured every 60 seconds.. when you use a longer interval, it will generate less telemetries. this doesn't cover traces though.

alternatively, please also try sampling. It applies to all telemetries except metrics. I think this might work. please let me know how it goes. thanks.

@NguyHa03
Copy link
Author

NguyHa03 commented Oct 11, 2021

@heyams I tried sampling and set enviroment variable like that APPLICATIONINSIGHTS_SAMPLING_PERCENTAGE=0, but I see that my metricss are not sent to insight metric, when I set APPLICATIONINSIGHTS_SAMPLING_PERCENTAGE=100, the metrics are sent normally.

I think metric is still impact by sampling.

@heyams
Copy link
Contributor

heyams commented Oct 11, 2021

are you using 2.x sdk to send custom metrics? sampling percentage affects metrics coming from 2.x SDK currently.

@heyams
Copy link
Contributor

heyams commented Oct 11, 2021

if you're using "trackMetrics" from the 2.x SDK, please use metric-interval for now. it doesn't affects calls to "trackMetrics", i.e. custom metrics, but will impact metrics that are auto-collected.

@NguyHa03
Copy link
Author

I used 3.x agent along with micrometer-core 1.7.3 to send metric like this
static final Counter counter = Metrics.counter("test_counter"); counter.increment();

@trask
Copy link
Member

trask commented Oct 31, 2021

thanks for the explanations @NguyHa03! agree that it is unexpected for sampling percentage to apply to metrics, will fix in #1942

@ghost ghost added the Status: Fixed label Nov 1, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Dec 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants