microsoft / ApplicationInsights-dotnet

ApplicationInsights-dotnet
MIT License
566 stars 285 forks source link

Can we configure CollectionPeriod using ApplicationInsights.Config #1569

Closed ghost closed 2 years ago

ghost commented 7 years ago

Currently PerformanceCollectorModule collects metrics in a time interval of 60seconds but in my project we have a requirement to collect the data for every 10seconds , is there a way to change this Collectionperiod using configuration setting.

private readonly TimeSpan collectionPeriod = TimeSpan.FromSeconds(60);

SergeyKanzhelev commented 7 years ago

There is no such override. Our backend designed such a way that it expects counters to be send every 60 seconds for better aggregations.

SergeyKanzhelev commented 7 years ago

Why do you need counters to be sent more often?

ghost commented 7 years ago

Thanks for the information. My team is looking for capturing the performance metrics for every 20 seconds that is why i am checking is there any way to configure the CollectionPeriod.

Thanks, Anitha

On Thu, Sep 22, 2016 at 9:25 PM, Sergey Kanzhelev notifications@github.com wrote:

Why do you need counters to be sent more often?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Microsoft/ApplicationInsights-dotnet-server/issues/142#issuecomment-248945751, or mute the thread https://github.com/notifications/unsubscribe-auth/AUnOykP3nBagw2PjZHgs6hLOJgrWawe4ks5qsqTygaJpZM4KDuwf .

SergeyKanzhelev commented 7 years ago

We have two features - historical counters (every minute) and live metrics stream https://azure.microsoft.com/en-us/blog/live-metrics-stream/. Can you please elaborate on why you need counters every 20 seconds? Is it because of some detection time requirement? Any other reasons?

SergeyKanzhelev commented 7 years ago

Also please vote at user voice: https://feedback.azure.com/forums/357324-application-insights/suggestions/8891389-support-for-changing-custom-performance-counter-sa

Leonardo-Ferreira commented 7 years ago

@SergeyKanzhelev I need this refresh rate to be configurable because:

Leonardo-Ferreira commented 7 years ago

@SergeyKanzhelev is that enough to re-open this?

SergeyKanzhelev commented 7 years ago

@Leonardo-Ferreira scenarios make sense. Implementation wise will it be better to send correct min/max over 1 minute interval or you'd need to see an actual trend during this minute? Collecting performance counters more often has very specific cost impact and you can easily go out of quota. Adding proper min/max collected with higher frequency may address your needs with much smaller increase in monitoring cost.

Also it will not require adding an extra piece of information - collection period to every packet and synchronizing of this while doing aggregation across instances with different settings.

What do you think? Will min/max be acceptable or may be better solution?

Leonardo-Ferreira commented 7 years ago

@SergeyKanzhelev I, Leo, understand the impact of collecting such data, but if you are having troubles with live-performance-tuning, like me, not being able to get a good/frequent read of indicators such as cpu/memory/http-queue makes the job so much harder.

I don't think the max/min is enough. It's better than what we got now? yes. Do I believe that inspecting the trend will be much better? Hell yes.

I don't believe that we need to choose here. I believe that we can do both actually. Implement the configuration for collection interval and within that interval, do max/min. This way, collecting data with a more granular setting (once every 5 or 10 sec) and infer more info using the max-min...

but in my case, i do need the trend

I even tried to implement my own data capture here but i wasn't that successful with my web apps

SergeyKanzhelev commented 5 years ago

@vgorbenko, I was pinged on this again. Were there any changes in backend which will allow to send performance counters with the different interval?

EngSayed commented 4 years ago

I have a question regarding the collection period, I have setup a web application with Application Insights to collect performance counters. While there are activities on the web application (page requests, ...) I can see the performance counters. But if there are no activities then there are no performance counters and Live Metrics says that my application is offline. Is there a way to always collect performance counters regardless activities on the web application?

cijothomas commented 4 years ago

@EngSayed Performance counters should continue to flow (every 1 min) irrespective of application is receiving requests or not, as long as the process is alive. Can you share more details about your setup so we can figure out why you are seeing perf counters disappearing..

EngSayed commented 4 years ago

@cijothomas We have ASP.NET MVC application and we have ApplicationInsights.config file which has: <Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector"> </Add>

And as mentioned before if there are any web requests to the web application then there are per counters in Application Insights otherwise it disappears after few minutes.

cijothomas commented 4 years ago

@EngSayed I cannot tell why your counters are missing after some time without additional info. Did you verify that the process is still running? Can you verify if LiveMetrics shows that app is up and running?

EngSayed commented 4 years ago

@cijothomas What do you mean that the process is still running? As In LiveMetrics it does not show anything if there are no requests on the website

cijothomas commented 4 years ago

The process should not have died when there are no requests - Some systems shut down the process when there is no activity.

0x53A commented 4 years ago

I want to reduce the sampling frequency because the performance counters alone account for the majority of traffic:

image

cijothomas commented 4 years ago

I want to reduce the sampling frequency because the performance counters alone account for the majority of traffic:

image

The performancecounter collection period is 1 min and is not configurable. There are no changes planned to make this customizable. If too much volume is a concern, then your only option is to write telemetryprocessor to drop performancecounters based on some timing.

npehrsson commented 4 years ago

I would like this feature as well. We hare having a couple of thousands IoT devices that we would like to send these metrics. But we would like to do it every 10 minutes or up to every hour.

It doesn't need to be set in the XML, but somehow it would be good to be able to configure it.

cijothomas commented 4 years ago

I would like this feature as well. We hare having a couple of thousands IoT devices that we would like to send these metrics. But we would like to do it every 10 minutes or up to every hour.

It doesn't need to be set in the XML, but somehow it would be good to be able to configure it.

@npehrsson For your scenario, it'd be best to send the perf counters manually as custom metrics. Ability to configure the collection period is a change which is not planned for this year, and its unlikely next year as well. (perf counters are treated specially by backend and it expects 1 min aggregations).

npehrsson commented 4 years ago

I would like this feature as well. We hare having a couple of thousands IoT devices that we would like to send these metrics. But we would like to do it every 10 minutes or up to every hour. It doesn't need to be set in the XML, but somehow it would be good to be able to configure it.

@npehrsson For your scenario, it'd be best to send the perf counters manually as custom metrics. Ability to configure the collection period is a change which is not planned for this year, and its unlikely next year as well. (perf counters are treated specially by backend and it expects 1 min aggregations).

Thanks for the response.

Leonardo-Ferreira commented 4 years ago

So, after a couple of years im back at the same problem... @SergeyKanzhelev I see that now there's valueCount, valueSum, valueMin, valueMax and stdDeviation... but in my cases valueCount is always 1 and value=valueSum=valueMin=valueMax... Is there something to be done to change this?

cijothomas commented 4 years ago

@Leonardo-Ferreira Can you open a new issue describing the question/issue? To avoid confusion as this issue has a lot of topics being covered now!

This issue's title asks "Can I configure percounter collection interval" - the answer is no, and there are no plans to change it immediate future. Alternate option if to track metrics using custom metric api.

Also : Sergey is no longer working with Microsoft. We are happy to continue the conversation and offer help.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 7 days.