Udostępnij za pośrednictwem


MetricAggregationScope Enum

Definition

Used when getting or creating a Metric to optionally specify the scope across which the values for the metric are to be aggregated in memory.
Intended for advanced scenarios. The default "TelemetryConfiguration" is used whenever MetricAggregationScope is not specified explicitly.

public enum MetricAggregationScope
type MetricAggregationScope = 
Public Enum MetricAggregationScope
Inheritance
MetricAggregationScope

Fields

Name Value Description
TelemetryConfiguration 0

Metric values will be aggregated ACROSS all telemetry clients that belong to the same TelemetryConfiguration.
This is the default. It fits most use cases and is more conservative towards resources.

Background-Info: When you use this option with the .GetMetric(..) extension method of a TelemetryClient, the MetricManager instance that owns the retrieved Metric will be attached to a TelemetryConfiguration instance associated with that TelemetryClient. Thus, the MetricManager will be shared across all clients of this telemetry config. As a result, the Context, the InstrumentationKey and other properties of the respective TelemetryClient will be ignored in favor of the TelemetryConfiguration-wide settings.

TelemetryClient 1

Metric values will be aggregated only across a specific TelemetryClient instance and then sent using that particular instance.
Such aggregation across many smaller scopes can be resource intensive. This option is only recommended when a particular instance of TelementryClient needs to be used for sending telemetry. Typically, MetricAggregationScope.TelemetryConfiguration is the preferred option.

Background-Info: This option causes the MetricManager instance that owns the retrieved Metric to be attached to a specified TelemetryClient instance. As a result, the Context and the InstrumentationKey of the specified TelemetryClient will be respected. However, each MetricManager instance encapsulates a managed thread and each aggregator uses additional memory.

Applies to

See also