Share via


TelemetryClient.TrackMetric Method

Definition

Overloads

TrackMetric(MetricTelemetry)

This method is not the preferred method for sending metrics. Metrics should always be pre-aggregated across a time period before being sent.
Use one of the GetMetric(..) overloads to get a metric object for accessing SDK pre-aggregation capabilities.
If you are implementing your own pre-aggregation logic, then you can use this method. If your application requires sending a separate telemetry item at every occasion without aggregation across time, you likely have a use case for event telemetry; see TrackEvent(EventTelemetry).

TrackMetric(String, Double, IDictionary<String,String>)

This method is not the preferred method for sending metrics. Metrics should always be pre-aggregated across a time period before being sent.
Use one of the GetMetric(..) overloads to get a metric object for accessing SDK pre-aggregation capabilities.
If you are implementing your own pre-aggregation logic, then you can use this method. If your application requires sending a separate telemetry item at every occasion without aggregation across time, you likely have a use case for event telemetry; see TrackEvent(EventTelemetry).

TrackMetric(MetricTelemetry)

This method is not the preferred method for sending metrics. Metrics should always be pre-aggregated across a time period before being sent.
Use one of the GetMetric(..) overloads to get a metric object for accessing SDK pre-aggregation capabilities.
If you are implementing your own pre-aggregation logic, then you can use this method. If your application requires sending a separate telemetry item at every occasion without aggregation across time, you likely have a use case for event telemetry; see TrackEvent(EventTelemetry).

public void TrackMetric (Microsoft.ApplicationInsights.DataContracts.MetricTelemetry telemetry);
member this.TrackMetric : Microsoft.ApplicationInsights.DataContracts.MetricTelemetry -> unit
Public Sub TrackMetric (telemetry As MetricTelemetry)

Parameters

telemetry
MetricTelemetry

The metric telemetry item.

Applies to

TrackMetric(String, Double, IDictionary<String,String>)

This method is not the preferred method for sending metrics. Metrics should always be pre-aggregated across a time period before being sent.
Use one of the GetMetric(..) overloads to get a metric object for accessing SDK pre-aggregation capabilities.
If you are implementing your own pre-aggregation logic, then you can use this method. If your application requires sending a separate telemetry item at every occasion without aggregation across time, you likely have a use case for event telemetry; see TrackEvent(EventTelemetry).

public void TrackMetric (string name, double value, System.Collections.Generic.IDictionary<string,string> properties = default);
member this.TrackMetric : string * double * System.Collections.Generic.IDictionary<string, string> -> unit
Public Sub TrackMetric (name As String, value As Double, Optional properties As IDictionary(Of String, String) = Nothing)

Parameters

name
String

Metric name.

value
Double

Metric value.

properties
IDictionary<String,String>

Named string values you can use to classify and filter metrics.

Applies to