TelemetryClient.GetMetric Method

Definition

Overloads

GetMetric(String, String, String, String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(MetricIdentifier, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(MetricIdentifier, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(MetricIdentifier)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, string dimension2Name, string dimension3Name, string dimension4Name, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration);
member this.GetMetric : string * string * string * string * string * Microsoft.ApplicationInsights.Metrics.MetricConfiguration -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, dimension2Name As String, dimension3Name As String, dimension4Name As String, metricConfiguration As MetricConfiguration) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

dimension2Name
String

The name of the second dimension.

dimension3Name
String

The name of the third dimension.

dimension4Name
String

The name of the fourth dimension.

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(String, String, String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, string dimension2Name, string dimension3Name, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration, Microsoft.ApplicationInsights.MetricAggregationScope aggregationScope);
member this.GetMetric : string * string * string * string * Microsoft.ApplicationInsights.Metrics.MetricConfiguration * Microsoft.ApplicationInsights.MetricAggregationScope -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, dimension2Name As String, dimension3Name As String, metricConfiguration As MetricConfiguration, aggregationScope As MetricAggregationScope) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

dimension2Name
String

The name of the second dimension.

dimension3Name
String

The name of the third dimension.

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

aggregationScope
MetricAggregationScope

The scope across which the values for the metric are to be aggregated in memory. See MetricAggregationScope for more info.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Applies to

GetMetric(String, String, String, String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, string dimension2Name, string dimension3Name, string dimension4Name);
member this.GetMetric : string * string * string * string * string -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, dimension2Name As String, dimension3Name As String, dimension4Name As String) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

dimension2Name
String

The name of the second dimension.

dimension3Name
String

The name of the third dimension.

dimension4Name
String

The name of the fourth dimension.

Returns

A Metric instance that you can use to automatically aggregate and then sent metric data value.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(String, String, String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, string dimension2Name, string dimension3Name, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration);
member this.GetMetric : string * string * string * string * Microsoft.ApplicationInsights.Metrics.MetricConfiguration -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, dimension2Name As String, dimension3Name As String, metricConfiguration As MetricConfiguration) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

dimension2Name
String

The name of the second dimension.

dimension3Name
String

The name of the third dimension.

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(String, String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, string dimension2Name, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration, Microsoft.ApplicationInsights.MetricAggregationScope aggregationScope);
member this.GetMetric : string * string * string * Microsoft.ApplicationInsights.Metrics.MetricConfiguration * Microsoft.ApplicationInsights.MetricAggregationScope -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, dimension2Name As String, metricConfiguration As MetricConfiguration, aggregationScope As MetricAggregationScope) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

dimension2Name
String

The name of the second dimension.

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

aggregationScope
MetricAggregationScope

The scope across which the values for the metric are to be aggregated in memory. See MetricAggregationScope for more info.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Applies to

GetMetric(String, String, String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, string dimension2Name, string dimension3Name);
member this.GetMetric : string * string * string * string -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, dimension2Name As String, dimension3Name As String) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

dimension2Name
String

The name of the second dimension.

dimension3Name
String

The name of the third dimension.

Returns

A Metric instance that you can use to automatically aggregate and then sent metric data value.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(String, String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, string dimension2Name, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration);
member this.GetMetric : string * string * string * Microsoft.ApplicationInsights.Metrics.MetricConfiguration -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, dimension2Name As String, metricConfiguration As MetricConfiguration) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

dimension2Name
String

The name of the second dimension.

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration, Microsoft.ApplicationInsights.MetricAggregationScope aggregationScope);
member this.GetMetric : string * string * Microsoft.ApplicationInsights.Metrics.MetricConfiguration * Microsoft.ApplicationInsights.MetricAggregationScope -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, metricConfiguration As MetricConfiguration, aggregationScope As MetricAggregationScope) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

aggregationScope
MetricAggregationScope

The scope across which the values for the metric are to be aggregated in memory. See MetricAggregationScope for more info.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Applies to

GetMetric(String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration, Microsoft.ApplicationInsights.MetricAggregationScope aggregationScope);
member this.GetMetric : string * Microsoft.ApplicationInsights.Metrics.MetricConfiguration * Microsoft.ApplicationInsights.MetricAggregationScope -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, metricConfiguration As MetricConfiguration, aggregationScope As MetricAggregationScope) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

aggregationScope
MetricAggregationScope

The scope across which the values for the metric are to be aggregated in memory. See MetricAggregationScope for more info.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Applies to

GetMetric(String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration);
member this.GetMetric : string * string * Microsoft.ApplicationInsights.Metrics.MetricConfiguration -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, metricConfiguration As MetricConfiguration) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(String, String, String, String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, string dimension2Name, string dimension3Name, string dimension4Name, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration, Microsoft.ApplicationInsights.MetricAggregationScope aggregationScope);
member this.GetMetric : string * string * string * string * string * Microsoft.ApplicationInsights.Metrics.MetricConfiguration * Microsoft.ApplicationInsights.MetricAggregationScope -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, dimension2Name As String, dimension3Name As String, dimension4Name As String, metricConfiguration As MetricConfiguration, aggregationScope As MetricAggregationScope) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

dimension2Name
String

The name of the second dimension.

dimension3Name
String

The name of the third dimension.

dimension4Name
String

The name of the fourth dimension.

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

aggregationScope
MetricAggregationScope

The scope across which the values for the metric are to be aggregated in memory. See MetricAggregationScope for more info.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Applies to

GetMetric(MetricIdentifier, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (Microsoft.ApplicationInsights.Metrics.MetricIdentifier metricIdentifier, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration, Microsoft.ApplicationInsights.MetricAggregationScope aggregationScope);
member this.GetMetric : Microsoft.ApplicationInsights.Metrics.MetricIdentifier * Microsoft.ApplicationInsights.Metrics.MetricConfiguration * Microsoft.ApplicationInsights.MetricAggregationScope -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricIdentifier As MetricIdentifier, metricConfiguration As MetricConfiguration, aggregationScope As MetricAggregationScope) As Metric

Parameters

metricIdentifier
MetricIdentifier

A grouping containing the Namespace, the ID (name) and the dimension names of the metric.

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

aggregationScope
MetricAggregationScope

The scope across which the values for the metric are to be aggregated in memory. See MetricAggregationScope for more info.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Applies to

GetMetric(String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name);
member this.GetMetric : string * string -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

Returns

A Metric instance that you can use to automatically aggregate and then sent metric data value.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration);
member this.GetMetric : string * Microsoft.ApplicationInsights.Metrics.MetricConfiguration -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, metricConfiguration As MetricConfiguration) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(MetricIdentifier, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (Microsoft.ApplicationInsights.Metrics.MetricIdentifier metricIdentifier, Microsoft.ApplicationInsights.Metrics.MetricConfiguration metricConfiguration);
member this.GetMetric : Microsoft.ApplicationInsights.Metrics.MetricIdentifier * Microsoft.ApplicationInsights.Metrics.MetricConfiguration -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricIdentifier As MetricIdentifier, metricConfiguration As MetricConfiguration) As Metric

Parameters

metricIdentifier
MetricIdentifier

A grouping containing the Namespace, the ID (name) and the dimension names of the metric.

metricConfiguration
MetricConfiguration

Determines how tracked values will be aggregated.
Use presets in Common or specify your own settings.

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId);
member this.GetMetric : string -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

Returns

A Metric with the specified ID and dimensions. If you call this method several times with the same metric ID and dimensions for a given aggregation scope, you will receive the same instance of Metric.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(MetricIdentifier)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (Microsoft.ApplicationInsights.Metrics.MetricIdentifier metricIdentifier);
member this.GetMetric : Microsoft.ApplicationInsights.Metrics.MetricIdentifier -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricIdentifier As MetricIdentifier) As Metric

Parameters

metricIdentifier
MetricIdentifier

A grouping containing the Namespace, the ID (name) and the dimension names of the metric.

Returns

A Metric instance that you can use to automatically aggregate and then sent metric data value.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to

GetMetric(String, String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

public Microsoft.ApplicationInsights.Metric GetMetric (string metricId, string dimension1Name, string dimension2Name);
member this.GetMetric : string * string * string -> Microsoft.ApplicationInsights.Metric
Public Function GetMetric (metricId As String, dimension1Name As String, dimension2Name As String) As Metric

Parameters

metricId
String

The ID (name) of the metric. (The namespace specified in DefaultMetricNamespace will be used. To specify another namespace, use an overload that takes a MetricIdentifier parameter instead.)

dimension1Name
String

The name of the first dimension.

dimension2Name
String

The name of the second dimension.

Returns

A Metric instance that you can use to automatically aggregate and then sent metric data value.

Exceptions

If you previously created a metric with the same namespace, ID, dimensions and aggregation scope, but with a different configuration. When calling this method to get a previously created metric, you can simply avoid specifying any configuration (or specify null) to imply the configuration used earlier.

Remarks

The aggregated values will be sent to the TelemetryConfiguration associated with this client.
The aggregation scope of the fetchedMetric is TelemetryConfiguration; this means that all values tracked for a given metric ID and dimensions will be aggregated together across all clients that share the same TelemetryConfiguration.

Applies to