Skip to content

Commit 0135d99

Browse files
committed
merging distributed tracing and telemetry correlation
1 parent 2511f4b commit 0135d99

File tree

4 files changed

+72
-90
lines changed

4 files changed

+72
-90
lines changed

.openpublishing.redirection.azure-monitor.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@
4545
"redirect_url": "/azure/azure-monitor/app/app-insights-overview",
4646
"redirect_document_id": false
4747
},
48+
{
49+
"source_path_from_root": "/articles/azure-monitor/app/correlation.md",
50+
"redirect_url": "/previous-versions/azure/azure-monitor/app/distributed-tracing-telemetry-correlation",
51+
"redirect_document_id": false
52+
},
53+
{
54+
"source_path_from_root": "/articles/azure-monitor/app/distributed-tracing.md",
55+
"redirect_url": "/previous-versions/azure/azure-monitor/app/distributed-tracing-telemetry-correlation",
56+
"redirect_document_id": false
57+
},
4858
{
4959
"source_path_from_root": "/articles/azure-monitor/app/console.md",
5060
"redirect_url": "/previous-versions/azure/azure-monitor/app/console",

articles/azure-monitor/app/correlation.md renamed to articles/azure-monitor/app/distributed-tracing-telemetry-correlation.md

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,75 @@
11
---
2-
title: Azure Application Insights telemetry correlation | Microsoft Docs
3-
description: This article explains Application Insights telemetry correlation.
2+
title: Distributed tracing and telemetry correlation in Azure Application Insights
3+
description: This article provides information about distributed tracing and telemetry correlation
44
ms.topic: conceptual
5-
ms.date: 03/22/2023
5+
ms.custom: devx-track-dotnet
6+
ms.date: 03/30/2023
7+
ms.reviewer: rijolly
68
ms.devlang: csharp, java, javascript, python
79
ms.custom: "devx-track-python, devx-track-csharp"
8-
ms.reviewer: rijolly
910
---
1011

11-
# Telemetry correlation in Application Insights
12+
# What is distributed tracing and telemetry correlation?
13+
14+
Modern cloud and [microservices](https://azure.com/microservices) architectures have enabled simple, independently deployable services that reduce costs while increasing availability and throughput. However, it has made overall systems more difficult to reason about and debug. Distributed tracing solves this problem by providing a performance profiler that works like call stacks for cloud and microservices architectures.
15+
16+
Azure Monitor provides two experiences for consuming distributed trace data: the [transaction diagnostics](./transaction-diagnostics.md) view for a single transaction/request and the [application map](./app-map.md) view to show how systems interact.
17+
18+
[Application Insights](app-insights-overview.md#application-insights-overview) can monitor each component separately and detect which component is responsible for failures or performance degradation by using distributed telemetry correlation. This article explains the data model, context-propagation techniques, protocols, and implementation of correlation tactics on different languages and platforms used by Application Insights.
19+
20+
## Enable distributed tracing
21+
22+
To enable distributed tracing for an application, add the right agent, SDK, or library to each service based on its programming language.
23+
24+
### Enable via Application Insights through auto-instrumentation or SDKs
25+
26+
The Application Insights agents and SDKs for .NET, .NET Core, Java, Node.js, and JavaScript all support distributed tracing natively. Instructions for installing and configuring each Application Insights SDK are available for:
27+
28+
* [.NET](asp-net.md)
29+
* [.NET Core](asp-net-core.md)
30+
* [Java](./opentelemetry-enable.md?tabs=java)
31+
* [Node.js](../app/nodejs.md)
32+
* [JavaScript](./javascript.md#enable-distributed-tracing)
33+
* [Python](opencensus-python.md)
34+
35+
With the proper Application Insights SDK installed and configured, tracing information is automatically collected for popular frameworks, libraries, and technologies by SDK dependency auto-collectors. The full list of supported technologies is available in the [Dependency auto-collection documentation](asp-net-dependencies.md#dependency-auto-collection).
36+
37+
Any technology also can be tracked manually with a call to [TrackDependency](./api-custom-events-metrics.md) on the [TelemetryClient](./api-custom-events-metrics.md).
38+
39+
### Enable via OpenTelemetry
40+
41+
Application Insights now supports distributed tracing through [OpenTelemetry](https://opentelemetry.io/). OpenTelemetry provides a vendor-neutral instrumentation to send traces, metrics, and logs to Application Insights. Initially, the OpenTelemetry community took on distributed tracing. Metrics and logs are still in progress.
42+
43+
A complete observability story includes all three pillars, but currently our [Azure Monitor OpenTelemetry-based exporter preview offerings for .NET, Python, and JavaScript](opentelemetry-enable.md) only include distributed tracing. Our Java OpenTelemetry-based Azure Monitor offering is generally available and fully supported.
44+
45+
The following pages consist of language-by-language guidance to enable and configure Microsoft's OpenTelemetry-based offerings. Importantly, we share the available functionality and limitations of each offering so you can determine whether OpenTelemetry is right for your project.
46+
47+
* [.NET](opentelemetry-enable.md?tabs=net)
48+
* [Java](opentelemetry-enable.md?tabs=java)
49+
* [Node.js](opentelemetry-enable.md?tabs=nodejs)
50+
* [Python](opentelemetry-enable.md?tabs=python)
51+
52+
### Enable via OpenCensus
1253

13-
In the world of microservices, every logical operation requires work to be done in various components of the service. You can monitor each of these components separately by using [Application Insights](../../azure-monitor/app/app-insights-overview.md). Application Insights supports distributed telemetry correlation, which you use to detect which component is responsible for failures or performance degradation.
54+
In addition to the Application Insights SDKs, Application Insights also supports distributed tracing through [OpenCensus](https://opencensus.io/). OpenCensus is an open-source, vendor-agnostic, single distribution of libraries to provide metrics collection and distributed tracing for services. It also enables the open-source community to enable distributed tracing with popular technologies like Redis, Memcached, or MongoDB. [Microsoft collaborates on OpenCensus with several other monitoring and cloud partners](https://open.microsoft.com/2018/06/13/microsoft-joins-the-opencensus-project/).
1455

15-
This article explains the data model used by Application Insights to correlate telemetry sent by multiple components. It covers context-propagation techniques and protocols. It also covers the implementation of correlation tactics on different languages and platforms.
56+
For more information on OpenCensus for Python, see [Set up Azure Monitor for your Python application](opencensus-python.md).
1657

17-
[!INCLUDE [azure-monitor-log-analytics-rebrand](../../../includes/azure-monitor-instrumentation-key-deprecation.md)]
58+
The OpenCensus website maintains API reference documentation for [Python](https://opencensus.io/api/python/trace/usage.html), [Go](https://godoc.org/go.opencensus.io), and various guides for using OpenCensus.
1859

1960
## Data model for telemetry correlation
2061

21-
Application Insights defines a [data model](../../azure-monitor/app/data-model-complete.md) for distributed telemetry correlation. To associate telemetry with a logical operation, every telemetry item has a context field called `operation_Id`. This identifier is shared by every telemetry item in the distributed trace. So even if you lose telemetry from a single layer, you can still associate telemetry reported by other components.
62+
Application Insights defines a [data model](../../azure-monitor/app/data-model-complete.md) for distributed telemetry correlation. To associate telemetry with a logical operation, every telemetry item has a context field called `operation_Id`. Every telemetry item in the distributed trace shares this identifier. So even if you lose telemetry from a single layer, you can still associate telemetry reported by other components.
2263

23-
A distributed logical operation typically consists of a set of smaller operations that are requests processed by one of the components. These operations are defined by [request telemetry](../../azure-monitor/app/data-model-complete.md#request). Every request telemetry item has its own `id` that identifies it uniquely and globally. And all telemetry items (such as traces and exceptions) that are associated with the request should set the `operation_parentId` to the value of the request `id`.
64+
A distributed logical operation typically consists of a set of smaller operations that are requests processed by one of the components. [Request telemetry](../../azure-monitor/app/data-model-complete.md#request) defines these operations. Every request telemetry item has its own `id` that identifies it uniquely and globally. And all telemetry items (such as traces and exceptions) that are associated with the request should set the `operation_parentId` to the value of the request `id`.
2465

25-
Every outgoing operation, such as an HTTP call to another component, is represented by [dependency telemetry](../../azure-monitor/app/data-model-complete.md#dependency). Dependency telemetry also defines its own `id` that's globally unique. Request telemetry, initiated by this dependency call, uses this `id` as its `operation_parentId`.
66+
[Dependency telemetry](../../azure-monitor/app/data-model-complete.md#dependency) represents every outgoing operation, such as an HTTP call to another component. It also defines its own `id` that's globally unique. Request telemetry, initiated by this dependency call, uses this `id` as its `operation_parentId`.
2667

2768
You can build a view of the distributed logical operation by using `operation_Id`, `operation_parentId`, and `request.id` with `dependency.id`. These fields also define the causality order of telemetry calls.
2869

2970
In a microservices environment, traces from components can go to different storage items. Every component can have its own connection string in Application Insights. To get telemetry for the logical operation, Application Insights queries data from every storage item.
3071

31-
When the number of storage items is large, you'll need a hint about where to look next. The Application Insights data model defines two fields to solve this problem: `request.source` and `dependency.target`. The first field identifies the component that initiated the dependency request. The second field identifies which component returned the response of the dependency call.
72+
When the number of storage items is large, you need a hint about where to look next. The Application Insights data model defines two fields to solve this problem: `request.source` and `dependency.target`. The first field identifies the component that initiated the dependency request. The second field identifies which component returned the response of the dependency call.
3273

3374
For information on querying from multiple disparate instances by using the `app` query expression, see [app() expression in Azure Monitor query](../logs/app-expression.md#app-expression-in-azure-monitor-query).
3475

@@ -62,7 +103,7 @@ Application Insights is transitioning to [W3C Trace-Context](https://w3c.github.
62103
- `traceparent`: Carries the globally unique operation ID and unique identifier of the call.
63104
- `tracestate`: Carries system-specific tracing context.
64105

65-
The latest version of the Application Insights SDK supports the Trace-Context protocol, but you might need to opt in to it. (Backward compatibility with the previous correlation protocol supported by the Application Insights SDK will be maintained.)
106+
The latest version of the Application Insights SDK supports the Trace-Context protocol, but you might need to opt in to it. (Backward compatibility with the previous correlation protocol supported by the Application Insights SDK is maintained.)
66107

67108
The [correlation HTTP protocol, also called Request-Id](https://github.com/dotnet/runtime/blob/master/src/libraries/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md), is being deprecated. This protocol defines two headers:
68109

@@ -157,7 +198,7 @@ For a reference, you can find the OpenCensus data model on [this GitHub page](ht
157198
158199
### Incoming request correlation
159200
160-
OpenCensus Python correlates W3C Trace-Context headers from incoming requests to the spans that are generated from the requests themselves. OpenCensus will correlate automatically with integrations for these popular web application frameworks: Flask, Django, and Pyramid. You just need to populate the W3C Trace-Context headers with the [correct format](https://www.w3.org/TR/trace-context/#trace-context-http-headers-format) and send them with the request.
201+
OpenCensus Python correlates W3C Trace-Context headers from incoming requests to the spans that are generated from the requests themselves. OpenCensus correlates automatically with integrations for these popular web application frameworks: Flask, Django, and Pyramid. You just need to populate the W3C Trace-Context headers with the [correct format](https://www.w3.org/TR/trace-context/#trace-context-http-headers-format) and send them with the request.
161202
162203
Explore this sample Flask application. Install Flask, OpenCensus, and the extensions for Flask and Azure.
163204
@@ -167,7 +208,7 @@ pip install flask opencensus opencensus-ext-flask opencensus-ext-azure
167208
168209
```
169210
170-
You will need to add your Application Insights connection string to the environment variable.
211+
You need to add your Application Insights connection string to the environment variable.
171212
172213
```shell
173214
APPLICATIONINSIGHTS_CONNECTION_STRING=<appinsights-connection-string>
@@ -224,7 +265,7 @@ The `operation_ParentId` field is in the format `<trace-id>.<parent-id>`, where
224265
225266
### Log correlation
226267
227-
OpenCensus Python enables you to correlate logs by adding a trace ID, a span ID, and a sampling flag to log records. You add these attributes by installing OpenCensus [logging integration](https://pypi.org/project/opencensus-ext-logging/). The following attributes will be added to Python `LogRecord` objects: `traceId`, `spanId`, and `traceSampled` (applicable only for loggers that are created after the integration).
268+
OpenCensus Python enables you to correlate logs by adding a trace ID, a span ID, and a sampling flag to log records. You add these attributes by installing OpenCensus [logging integration](https://pypi.org/project/opencensus-ext-logging/). The following attributes are added to Python `LogRecord` objects: `traceId`, `spanId`, and `traceSampled` (applicable only for loggers that are created after the integration).
228269
229270
Install the OpenCensus logging integration:
230271
@@ -379,10 +420,11 @@ You can also set the cloud role name via environment variable or system property
379420
380421
## Next steps
381422
423+
- [Application map](./app-map.md)
382424
- Write [custom telemetry](../../azure-monitor/app/api-custom-events-metrics.md).
383425
- For advanced correlation scenarios in ASP.NET Core and ASP.NET, see [Track custom operations](custom-operations-tracking.md).
384426
- Learn more about [setting cloud_RoleName](./app-map.md#set-or-override-cloud-role-name) for other SDKs.
385427
- Onboard all components of your microservice on Application Insights. Check out the [supported platforms](./app-insights-overview.md#supported-languages).
386428
- See the [data model](./data-model-complete.md) for Application Insights types.
387429
- Learn how to [extend and filter telemetry](./api-filtering-sampling.md).
388-
- Review the [Application Insights config reference](configuration-with-applicationinsights-config.md).
430+
- Review the [Application Insights config reference](configuration-with-applicationinsights-config.md).

0 commit comments

Comments
 (0)