You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/app/separate-resources.md
+20-27Lines changed: 20 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Separating telemetry in Azure Application Insights
3
3
description: Direct telemetry to different resources for development, test, and production stamps.
4
4
ms.topic: conceptual
5
-
ms.date: 05/15/2017
5
+
ms.date: 04/29/2020
6
6
7
7
---
8
8
@@ -16,13 +16,24 @@ When you are developing the next version of a web application, you don't want to
16
16
17
17
When you set up Application Insights monitoring for your web app, you create an Application Insights *resource* in Microsoft Azure. You open this resource in the Azure portal in order to see and analyze the telemetry collected from your app. The resource is identified by an *instrumentation key* (ikey). When you install the Application Insights package to monitor your app, you configure it with the instrumentation key, so that it knows where to send the telemetry.
18
18
19
-
You typically choose to use separate resources or a single shared resource in different scenarios:
19
+
Each Application Insights resource comes with metrics that are available out-of-box. If completely separate components report to the same Application Insights resource, these metrics may not make sense to dashboard/alert on.
20
20
21
-
* Different, independent applications - Use a separate resource and ikey for each app.
22
-
* Multiple components or roles of one business application - Use a [single shared resource](../../azure-monitor/app/app-map.md) for all the component apps. Telemetry can be filtered or segmented by the cloud_RoleName property.
23
-
* Development, Test, and Release - Use a separate resource and ikey for versions of the system in 'stamp' or stage of production.
24
-
* A | B testing - Use a single resource. Create a TelemetryInitializer to add a property to the telemetry that identifies the variants.
21
+
### Use a single Application Insights resource
25
22
23
+
- For application components that are deployed together. Usually developed by a single team, managed by the same set of DevOps/ITOps users.
24
+
- If it makes sense to aggregate Key Performance Indicators (KPIs) such as response durations, failure rates in dashboard etc., across all of them by default (you can choose to segment by role name in the Metrics Explorer experience).
25
+
- If there is no need to manage Role-based Access Control (RBAC) differently between the application components.
26
+
- If you don’t need metrics alert criteria that are different between the components.
27
+
- If you do not need to manage continuous exports differently between the components.
28
+
- If you do not need to manage billing/quotas differently between the components.
29
+
- If it is okay to have an API key have the same access to data from all components. And 10 API keys are sufficient for the needs across all of them.
30
+
- If it is okay to have the same smart detection and work item integration settings across all roles.
31
+
32
+
### Other things to keep in mind
33
+
34
+
- You may need to add custom code to ensure that meaningful values are set into the [Cloud_RoleName](https://docs.microsoft.com/azure/azure-monitor/app/app-map?tabs=net#set-cloud-role-name) attribute. Without meaningful values set for this attribute, *NONE* of the portal experiences will work.
35
+
- For Service Fabric applications and classic cloud services, the SDK automatically reads from the Azure Role Environment and sets these. For all other types of apps, you will likely need to set this explicitly.
36
+
- Live Metrics experience does not support splitting by role name.
@@ -43,7 +54,7 @@ Set the key in an initialization method, such as global.aspx.cs in an ASP.NET se
43
54
In this example, the ikeys for the different resources are placed in different versions of the web configuration file. Swapping the web configuration file - which you can do as part of the release script - will swap the target resource.
44
55
45
56
### Web pages
46
-
The iKey is also used in your app's web pages, in the [script that you got from the quickstart blade](../../azure-monitor/app/javascript.md). Instead of coding it literally into the script, generate it from the server state. For example, in an ASP.NET app:
57
+
The iKey is also used in your app's web pages, in the [script that you got from the quickstart pane](../../azure-monitor/app/javascript.md). Instead of coding it literally into the script, generate it from the server state. For example, in an ASP.NET app:
47
58
48
59
*JavaScript in Razor*
49
60
@@ -59,26 +70,11 @@ The iKey is also used in your app's web pages, in the [script that you got from
To separate telemetry for different application components, or for different stamps (dev/test/production) of the same component, then you'll have to create a new Application Insights resource.
63
-
64
-
In the [portal.azure.com](https://portal.azure.com), add an Application Insights resource:
***Application type** affects what you see on the overview blade and the properties available in [metric explorer](../../azure-monitor/platform/metrics-charts.md). If you don't see your type of app, choose one of the web types for web pages.
69
-
***Resource group** is a convenience for managing properties like [access control](../../azure-monitor/app/resources-roles-access-control.md). You could use separate resource groups for development, test, and production.
70
-
***Subscription** is your payment account in Azure.
71
-
***Location** is where we keep your data. Currently it can't be changed.
72
-
***Add to dashboard** puts a quick-access tile for your resource on your Azure Home page.
73
-
74
-
Creating the resource takes a few seconds. You'll see an alert when it's done.
75
-
76
-
(You can write a [PowerShell script](https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource#creating-a-resource-automatically) to create a resource automatically.)
74
+
To create an Applications Insights resource follow the [resource creation guide](https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource).
77
75
78
76
### Getting the instrumentation key
79
-
The instrumentation key identifies the resource that you created.
80
-
81
-

77
+
The instrumentation key identifies the resource that you created.
82
78
83
79
You need the instrumentation keys of all the resources to which your app will send data.
84
80
@@ -87,8 +83,6 @@ When you publish a new version of your app, you'll want to be able to separate t
87
83
88
84
You can set the Application Version property so that you can filter [search](../../azure-monitor/app/diagnostic-search.md) and [metric explorer](../../azure-monitor/platform/metrics-charts.md) results.
89
85
90
-

91
-
92
86
There are several different methods of setting the Application Version property.
93
87
94
88
* Set directly:
@@ -142,7 +136,6 @@ However, notice that the build version number is generated only by the Microsoft
142
136
### Release annotations
143
137
If you use Azure DevOps, you can [get an annotation marker](../../azure-monitor/app/annotations.md) added to your charts whenever you release a new version. The following image shows how this marker appears.
144
138
145
-

146
139
## Next steps
147
140
148
141
*[Shared resources for multiple roles](../../azure-monitor/app/app-map.md)
0 commit comments