Skip to content

Metric Class

Definition

A Metric which will aggregate values over a time interval

C#
public sealed class Metric : IDisposable

Inheritance object

Implements IDisposable

Constructors

Metric(string, TelemetryClient, TimeSpan)

Initializes a new instance of the Metric class.

C#
public Metric(string name, TelemetryClient telemetryClient, TimeSpan aggregationPeriod)

Parameters

name string
The name associated with the Metric.

telemetryClient TelemetryClient
Application Insights Telemetry Client used to send Metrics.

aggregationPeriod TimeSpan
TimeSpan over which metrics should be aggregated before sending to Application Insights.

Properties

Name

Gets the name associated with this Metric.

C#
public string Name { get; }

Methods

TrackValue(double)

Tracks a single value to be aggregated.

C#
public void TrackValue(double value)

Parameters

value double
The value to be tracked.