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
@@ -66,8 +72,8 @@ To use Application Insights, [create an instance of the Application Insights ser
66
72
1. Input **100** as **Sampling (%)** and select the **Always log errors** checkbox.
67
73
1. Leave the rest of the settings as is. For details about the settings, see [Diagnostic logs settings reference](diagnostic-logs-reference.md).
68
74
69
-
> [!WARNING]
70
-
> Overriding the default **Number of payload bytes to log** value **0** may significantly decrease the performance of your APIs.
75
+
> [!WARNING]
76
+
> Overriding the default **Number of payload bytes to log** value **0** may significantly decrease the performance of your APIs.
71
77
72
78
1. Select **Save**.
73
79
1. Behind the scenes, a [Diagnostic](/rest/api/apimanagement/current-ga/diagnostic/create-or-update) entity named `applicationinsights` is created at the API level.
@@ -83,7 +89,7 @@ You can specify loggers on different levels:
83
89
+ A logger for all APIs
84
90
85
91
Specifying *both*:
86
-
- By default, the single API logger (more granular level) will override the one for all APIs.
92
+
- By default, the single API logger (more granular level) overrides the one for all APIs.
87
93
- If the loggers configured at the two levels are different, and you need both loggers to receive telemetry (multiplexing), please contact Microsoft Support.
|*Exception*| For every failed request: <ul><li>Failed because of a closed client connection</li><li>Triggered an *on-error* section of the API policies</li><li>Has a response HTTP status code matching 4xx or 5xx</li></ul> |
98
104
|*Trace*| If you configure a [trace](trace-policy.md) policy. <br /> The `severity` setting in the `trace` policy must be equal to or greater than the `verbosity` setting in the Application Insights logging. |
99
105
100
-
### Emit custom metrics
101
-
You can emit custom metrics by configuring the [`emit-metric`](emit-metric-policy.md) policy.
106
+
> [!NOTE]
107
+
> See [Application Insights limits](../azure-monitor/service-limits.md#application-insights) for information about the maximum size and number of metrics and events per Application Insights instance.
102
108
103
-
To make Application Insights pre-aggregated metrics available in API Management, you'll need to manually enable custom metrics in the service.
104
-
1. Use the [`emit-metric`](emit-metric-policy.md) policy with the [Create or Update API](/rest/api/apimanagement/current-ga/api-diagnostic/create-or-update).
105
-
1. Add `"metrics":true` to the payload, along with any other properties.
109
+
## Emit custom metrics
110
+
You can emit [custom metrics](../azure-monitor/essentials/metrics-custom-overview.md) to Application Insights from your API Management instance. API Management emits custom metrics using the [emit-metric](emit-metric-policy.md) policy.
106
111
107
112
> [!NOTE]
108
-
> See [Application Insights limits](../azure-monitor/service-limits.md#application-insights) for information about the maximum size and number of metrics and events per Application Insights instance.
113
+
> Custom metrics are a preview feature of Azure Monitor and subject to limitations.
114
+
115
+
To emit custom metrics, perform the following configuration steps.
116
+
117
+
1. Enable **Custom metrics (Preview)** with custom dimensions in your Application Insights instance.
118
+
119
+
1. Navigate to your Application Insights instance in the portal.
120
+
1. In the left menu, select **Usage and estimated costs**.
1. Add the `"metrics": true` property to the `applicationInsights` diagnostic entity that's configured in API Management. Currently you must add this property using the API Management [Diagnostic - Create or Update](/rest/api/apimanagement/current-ga/diagnostic/create-or-update) REST API. For example:
125
+
126
+
```http
127
+
PUT https://management.azure.com/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ApiManagement/service/{APIManagementServiceName}/diagnostics/applicationinsights
1. Ensure that the Application Insights logger is configured at the scope you intend to emit custom metrics (either all APIs, or a single API). For more information, see [Enable Application Insights logging for your API](#enable-application-insights-logging-for-your-api), earlier in this article.
140
+
1. Configure the `emit-metric` policy at a scope where Application Insights logging is configured (either all APIs, or a single API) and is enabled for custom metrics. For policy details, see the [`emit-metric`](emit-metric-policy.md) policy reference.
0 commit comments