Skip to content

Commit 8e738c6

Browse files
authored
Merge pull request #114250 from cijothomas/cithomas/fixmetric1
Minor fixes to GetMetric doc and fix TOC typos
2 parents 3d4bcc5 + 4a9afe0 commit 8e738c6

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

articles/azure-monitor/app/get-metric.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The Azure Monitor Application Insights .NET and .NET Core SDKs have two differen
1515

1616
## TrackMetric versus GetMetric
1717

18-
`TrackMetric()` sends raw telemetry denoting a metric. It is inefficient to send a single telemetry item for each value. `TrackMetric()` sends raw telemetry denoting a metric. It is inefficient to send a single telemetry item for each value. `TrackMetric()` is also inefficient in terms of performance since every `TrackMetric(item)` goes through the full SDK pipeline of telemetry initializers and processors. Unlike `TrackMetric()`, `GetMetric()` handles local pre-aggregation for you and then only submits an aggregated summary metric at a fixed interval of one minute. So if you need to closely monitor some custom metric at the second or even millisecond level you can do so while only incurring the storage and network traffic cost of only monitoring every minute. This also greatly reduces the risk of throttling occurring since the total number of telemetry items that need to be sent for an aggregated metric are greatly reduced.
18+
`TrackMetric()` sends raw telemetry denoting a metric. It is inefficient to send a single telemetry item for each value. `TrackMetric()` is also inefficient in terms of performance since every `TrackMetric(item)` goes through the full SDK pipeline of telemetry initializers and processors. Unlike `TrackMetric()`, `GetMetric()` handles local pre-aggregation for you and then only submits an aggregated summary metric at a fixed interval of one minute. So if you need to closely monitor some custom metric at the second or even millisecond level you can do so while only incurring the storage and network traffic cost of only monitoring every minute. This also greatly reduces the risk of throttling occurring since the total number of telemetry items that need to be sent for an aggregated metric are greatly reduced.
1919

2020
In Application Insights, custom metrics collected via `TrackMetric()` and `GetMetric()` are not subject to [sampling](https://docs.microsoft.com/azure/azure-monitor/app/sampling). Sampling important metrics can lead to scenarios where alerting you may have built around those metrics could become unreliable. By never sampling your custom metrics, you can generally be confident that when your alert thresholds are breached, an alert will fire. But since custom metrics aren't sampled, there are some potential concerns.
2121

@@ -182,23 +182,11 @@ However, you will notice that you aren't able to split the metric by your new cu
182182

183183
![Splitting support](./media/get-metric/splitting-support.png)
184184

185-
By default multi-dimensional metrics within the Metric explorer experience are not turned on in Application Insights resources. To turn on this behavior go to the usage and estimated cost tab by checking ["Enable alerting on custom metric dimensions"](pre-aggregated-metrics-log-metrics.md#custom-metrics-dimensions-and-pre-aggregation).
186-
187-
### How to use MetricIdentifier when there are more than three dimensions
188-
189-
Currently 10 dimensions are supported however, greater than three dimensions requires the use of `MetricIdentifier`:
190-
191-
```csharp
192-
// Add "using Microsoft.ApplicationInsights.Metrics;" to use MetricIdentifier
193-
// MetricIdentifier id = new MetricIdentifier("[metricNamespace]","[metricId],"[dim1]","[dim2]","[dim3]","[dim4]","[dim5]");
194-
MetricIdentifier id = new MetricIdentifier("CustomMetricNamespace","ComputerSold", "FormFactor", "GraphicsCard", "MemorySpeed", "BatteryCapacity", "StorageCapacity");
195-
Metric computersSold = _telemetryClient.GetMetric(id);
196-
computersSold.TrackValue(110,"Laptop", "Nvidia", "DDR4", "39Wh", "1TB");
197-
```
185+
By default multi-dimensional metrics within the Metric explorer experience are not turned on in Application Insights resources.
198186

199187
### Enable multi-dimensional metrics
200188

201-
To enable multi-dimensional metrics for an Application Insights resource, Select **Usage and estimated costs** > **Custom Metrics** > **Enable alerting on custom metric dimensions** > **OK**.
189+
To enable multi-dimensional metrics for an Application Insights resource, Select **Usage and estimated costs** > **Custom Metrics** > **Enable alerting on custom metric dimensions** > **OK**. More details about this can be found [here](pre-aggregated-metrics-log-metrics.md#custom-metrics-dimensions-and-pre-aggregation).
202190

203191
Once you have made that change and send new multi-dimensional telemetry, you will be able to **Apply splitting**.
204192

@@ -211,6 +199,18 @@ And view your metric aggregations for each _FormFactor_ dimension:
211199

212200
![Form factors](./media/get-metric/formfactor.png)
213201

202+
### How to use MetricIdentifier when there are more than three dimensions
203+
204+
Currently 10 dimensions are supported however, greater than three dimensions requires the use of `MetricIdentifier`:
205+
206+
```csharp
207+
// Add "using Microsoft.ApplicationInsights.Metrics;" to use MetricIdentifier
208+
// MetricIdentifier id = new MetricIdentifier("[metricNamespace]","[metricId],"[dim1]","[dim2]","[dim3]","[dim4]","[dim5]");
209+
MetricIdentifier id = new MetricIdentifier("CustomMetricNamespace","ComputerSold", "FormFactor", "GraphicsCard", "MemorySpeed", "BatteryCapacity", "StorageCapacity");
210+
Metric computersSold = _telemetryClient.GetMetric(id);
211+
computersSold.TrackValue(110,"Laptop", "Nvidia", "DDR4", "39Wh", "1TB");
212+
```
213+
214214
## Custom metric configuration
215215

216216
If you want to alter the metric configuration, you need to do this in the place where the metric is initialized.

articles/azure-monitor/toc.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,7 @@
441441
- name: Correlate custom data sources
442442
href: app/custom-data-correlation.md
443443
- name: Connection strings
444-
href: app/sdk-connection-string.md
445-
- name: Connection strings
446-
href: app/sdk-connection-string.md
444+
href: app/sdk-connection-string.md
447445
- name: GetMetric
448446
displayname: get metric, custom metrics, metrics, TrackMetric
449447
href: app/get-metric.md

0 commit comments

Comments
 (0)