Leonardo
Leonardo

Reputation: 11401

Application Insights - Custom Performance Counter

I can instantiate a new performance counter object, but how can i "track" it? there's "TrackTrace", "TrackException", and etc, but theres no "TrackPerformanceCounter"... Any work around that?

Upvotes: 1

Views: 1966

Answers (2)

Leonardo
Leonardo

Reputation: 11401

There's no workaround... there are some open issues on the GITHUB project to increase/configure the recurrence of data capture but nothing concrete as of sep/2017

Upvotes: 0

John Gardner
John Gardner

Reputation: 25146

if you're using a real performance counter, then you'd configure your applicationinsights.config to collect that performance counter, and it just would happen normally. (https://learn.microsoft.com/en-us/azure/application-insights/app-insights-performance-counters)

<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.PerformanceCollectorModule, Microsoft.AI.PerfCounterCollector">
  <Counters>
    <Add PerformanceCounter="\Objects\Processes"/>
    <Add PerformanceCounter="\Sales(photo)\# Items Sold" ReportAs="Photo sales"/>
  </Counters>
</Add>

if you're not using real performance counters and simply want to track the value of a number, you'd use either TrackMetric(nameOfThing, valueOfThing) directly, or you can track the value of that metric at any time by passing it in the metrics param in any of the TrackEvent( nameOfEvent, properties, metrics) calls.

Upvotes: 1

Related Questions