Skip to content

Commit cc294c7

Browse files
committed
fix code to use ISupportProperties to address GitHub Issue
1 parent e7fdcc5 commit cc294c7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

articles/azure-monitor/app/usage-overview.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Usage analysis with Azure Application Insights | Microsoft docs
33
description: Understand your users and what they do with your app.
44
ms.topic: conceptual
5-
ms.date: 09/19/2019
5+
ms.date: 03/25/2019
66

77
---
88

@@ -125,10 +125,14 @@ To do this, [set up a telemetry initializer](../../azure-monitor/app/api-filteri
125125
// Telemetry initializer class
126126
public class MyTelemetryInitializer : ITelemetryInitializer
127127
{
128-
public void Initialize (ITelemetry telemetry)
129-
{
130-
telemetry.Properties["AppVersion"] = "v2.1";
131-
}
128+
public void Initialize(ITelemetry item)
129+
{
130+
var itemProperties = item as ISupportProperties;
131+
if (itemProperties != null && !itemProperties.Properties.ContainsKey("AppVersion"))
132+
{
133+
itemProperties.Properties["AppVersion"] = "v2.1";
134+
}
135+
}
132136
}
133137
```
134138

0 commit comments

Comments
 (0)