Skip to content

Commit 5308874

Browse files
Merge pull request #265716 from cijothomas/cijothomas/otel-distro-fixes1
Minor fixes to OTel distro docs
2 parents 4ea7c78 + c9d7d4f commit 5308874

File tree

4 files changed

+49
-29
lines changed

4 files changed

+49
-29
lines changed

articles/azure-monitor/app/opentelemetry-add-modify.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ The distros automatically collect data by bundling OpenTelemetry instrumentation
2727

2828
Requests
2929
- [ASP.NET
30-
Core](https://github.com/open-telemetry/opentelemetry-dotnet/blob/1.0.0-rc9.14/src/OpenTelemetry.Instrumentation.AspNetCore/README.md) ¹
30+
Core](https://github.com/open-telemetry/opentelemetry-dotnet/blob/1.0.0-rc9.14/src/OpenTelemetry.Instrumentation.AspNetCore/README.md) ¹²
3131

3232
Dependencies
33-
- [HttpClient](https://github.com/open-telemetry/opentelemetry-dotnet/blob/1.0.0-rc9.14/src/OpenTelemetry.Instrumentation.Http/README.md) ¹
33+
- [HttpClient](https://github.com/open-telemetry/opentelemetry-dotnet/blob/1.0.0-rc9.14/src/OpenTelemetry.Instrumentation.Http/README.md) ¹²
3434
- [SqlClient](https://github.com/open-telemetry/opentelemetry-dotnet/blob/1.0.0-rc9.14/src/OpenTelemetry.Instrumentation.SqlClient/README.md) ¹
3535

3636
Logging
3737
- `ILogger`
38-
38+
3939
For more information about `ILogger`, see [Logging in C# and .NET](/dotnet/core/extensions/logging) and [code examples](https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/logs).
4040

4141
#### [.NET](#tab/net)
@@ -188,7 +188,6 @@ Instrumentations can be configured using AzureMonitorOpenTelemetryOptions
188188

189189
```
190190

191-
192191
#### [Python](#tab/python)
193192

194193
Requests

articles/azure-monitor/app/opentelemetry-configuration.md

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ms.reviewer: mmcc
1313

1414
This article covers configuration settings for the Azure Monitor OpenTelemetry distro.
1515

16-
1716
## Connection string
1817

1918
A connection string in Application Insights defines the target location for sending telemetry data, ensuring it reaches the appropriate resource for monitoring and analysis.
@@ -22,7 +21,8 @@ A connection string in Application Insights defines the target location for send
2221

2322
Use one of the following three ways to configure the connection string:
2423

25-
- Add `UseAzureMonitor()` to your application startup. Depending on your version of .NET, it is in either your `startup.cs` or `program.cs` class.
24+
- Add `UseAzureMonitor()` to your application startup. This is in your `program.cs` class.
25+
2626
```csharp
2727
// Create a new ASP.NET Core web application builder.
2828
var builder = WebApplication.CreateBuilder(args);
@@ -39,11 +39,15 @@ Use one of the following three ways to configure the connection string:
3939
// Start the ASP.NET Core web application.
4040
app.Run();
4141
```
42+
4243
- Set an environment variable:
44+
4345
```console
4446
APPLICATIONINSIGHTS_CONNECTION_STRING=<Your Connection String>
4547
```
48+
4649
- Add the following section to your `appsettings.json` config file:
50+
4751
```json
4852
{
4953
"AzureMonitor": {
@@ -63,6 +67,7 @@ Use one of the following three ways to configure the connection string:
6367
Use one of the following two ways to configure the connection string:
6468

6569
- Add the Azure Monitor Exporter to each OpenTelemetry signal in application startup.
70+
6671
```csharp
6772
// Create a new OpenTelemetry tracer provider.
6873
// It is important to keep the TracerProvider instance active throughout the process lifetime.
@@ -93,6 +98,7 @@ Use one of the following two ways to configure the connection string:
9398
});
9499
});
95100
```
101+
96102
- Set an environment variable:
97103
```console
98104
APPLICATIONINSIGHTS_CONNECTION_STRING=<Your Connection String>
@@ -112,7 +118,7 @@ To set the connection string, see [Connection string](java-standalone-config.md#
112118
Use one of the following two ways to configure the connection string:
113119

114120
- Set an environment variable:
115-
121+
116122
```console
117123
APPLICATIONINSIGHTS_CONNECTION_STRING=<Your Connection String>
118124
```
@@ -139,7 +145,7 @@ Use one of the following two ways to configure the connection string:
139145
Use one of the following two ways to configure the connection string:
140146

141147
- Set an environment variable:
142-
148+
143149
```console
144150
APPLICATIONINSIGHTS_CONNECTION_STRING=<Your Connection String>
145151
```
@@ -279,12 +285,14 @@ useAzureMonitor(options);
279285
Set the Cloud Role Name and the Cloud Role Instance via [Resource](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#resource-sdk) attributes. Cloud Role Name uses `service.namespace` and `service.name` attributes, although it falls back to `service.name` if `service.namespace` isn't set. Cloud Role Instance uses the `service.instance.id` attribute value. For information on standard attributes for resources, see [OpenTelemetry Semantic Conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/README.md).
280286
281287
Set Resource attributes using the `OTEL_RESOURCE_ATTRIBUTES` and/or `OTEL_SERVICE_NAME` environment variables. `OTEL_RESOURCE_ATTRIBUTES` takes series of comma-separated key-value pairs. For example, to set the Cloud Role Name to `my-namespace.my-helloworld-service` and set Cloud Role Instance to `my-instance`, you can set `OTEL_RESOURCE_ATTRIBUTES` and `OTEL_SERVICE_NAME` as such:
288+
282289
```
283290
export OTEL_RESOURCE_ATTRIBUTES="service.namespace=my-namespace,service.instance.id=my-instance"
284291
export OTEL_SERVICE_NAME="my-helloworld-service"
285292
```
286293

287294
If you don't set the `service.namespace` Resource attribute, you can alternatively set the Cloud Role Name with only the OTEL_SERVICE_NAME environment variable or the `service.name` Resource attribute. For example, to set the Cloud Role Name to `my-helloworld-service` and set Cloud Role Instance to `my-instance`, you can set `OTEL_RESOURCE_ATTRIBUTES` and `OTEL_SERVICE_NAME` as such:
295+
288296
```
289297
export OTEL_RESOURCE_ATTRIBUTES="service.instance.id=my-instance"
290298
export OTEL_SERVICE_NAME="my-helloworld-service"
@@ -296,7 +304,7 @@ export OTEL_SERVICE_NAME="my-helloworld-service"
296304

297305
You might want to enable sampling to reduce your data ingestion volume, which reduces your cost. Azure Monitor provides a custom *fixed-rate* sampler that populates events with a sampling ratio, which Application Insights converts to `ItemCount`. The *fixed-rate* sampler ensures accurate experiences and event counts. The sampler is designed to preserve your traces across services, and it's interoperable with older Application Insights SDKs. For more information, see [Learn More about sampling](sampling.md#brief-summary).
298306

299-
> [!NOTE]
307+
> [!NOTE]
300308
> Metrics and Logs are unaffected by sampling.
301309

302310
#### [ASP.NET Core](#tab/aspnetcore)
@@ -393,11 +401,13 @@ We support the credential classes provided by [Azure Identity](https://github.co
393401
- Provide the tenant ID, client ID, and client secret to the constructor.
394402

395403
1. Install the latest [Azure.Identity](https://www.nuget.org/packages/Azure.Identity) package:
404+
396405
```dotnetcli
397406
dotnet add package Azure.Identity
398407
```
399-
408+
400409
1. Provide the desired credential class:
410+
401411
```csharp
402412
// Create a new ASP.NET Core web application builder.
403413
var builder = WebApplication.CreateBuilder(args);
@@ -431,11 +441,13 @@ We support the credential classes provided by [Azure Identity](https://github.co
431441
- Provide the tenant ID, client ID, and client secret to the constructor.
432442

433443
1. Install the latest [Azure.Identity](https://www.nuget.org/packages/Azure.Identity) package:
444+
434445
```dotnetcli
435446
dotnet add package Azure.Identity
436447
```
437448

438-
1. Provide the desired credential class:
449+
1. Provide the desired credential class:
450+
439451
```csharp
440452
// Create a DefaultAzureCredential.
441453
var credential = new DefaultAzureCredential();
@@ -469,7 +481,7 @@ We support the credential classes provided by [Azure Identity](https://github.co
469481
});
470482
});
471483
```
472-
484+
473485
#### [Java](#tab/java)
474486

475487
For more information about Java, see the [Java supplemental documentation](java-standalone-config.md).
@@ -498,7 +510,7 @@ useAzureMonitor(options);
498510
```
499511

500512
#### [Python](#tab/python)
501-
513+
502514
```python
503515
# Import the `ManagedIdentityCredential` class from the `azure.identity` package.
504516
from azure.identity import ManagedIdentityCredential
@@ -514,7 +526,6 @@ configure_azure_monitor(
514526

515527
---
516528

517-
518529
## Offline Storage and Automatic Retries
519530

520531
To improve reliability and resiliency, Azure Monitor OpenTelemetry-based offerings write to offline/local storage by default when an application loses its connection with Application Insights. It saves the application telemetry to disk and periodically tries to send it again for up to 48 hours. In high-load applications, telemetry is occasionally dropped for two reasons. First, when the allowable time is exceeded, and second, when the maximum file size is exceeded or the SDK doesn't have an opportunity to clear out the file. If we need to choose, the product saves more recent events over old ones. [Learn More](/previous-versions/azure/azure-monitor/app/data-retention-privacy#does-the-sdk-create-temporary-local-storage)
@@ -737,7 +748,7 @@ You might want to enable the OpenTelemetry Protocol (OTLP) Exporter alongside th
737748
```
738749

739750
1. Add the following code snippet. This example assumes you have an OpenTelemetry Collector with an OTLP receiver running. For details, see the [example on GitHub](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/examples/Console/TestOtlpExporter.cs).
740-
751+
741752
```csharp
742753
// Create a new OpenTelemetry tracer provider and add the Azure Monitor trace exporter and the OTLP trace exporter.
743754
// It is important to keep the TracerProvider instance active throughout the process lifetime.
@@ -795,7 +806,7 @@ For more information about Java, see the [Java supplemental documentation](java-
795806
1. Install the [opentelemetry-exporter-otlp](https://pypi.org/project/opentelemetry-exporter-otlp/) package.
796807
797808
1. Add the following code snippet. This example assumes you have an OpenTelemetry Collector with an OTLP receiver running. For details, see this [README](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/monitor/azure-monitor-opentelemetry-exporter/samples/traces#collector).
798-
809+
799810
```python
800811
# Import the `configure_azure_monitor()`, `trace`, `OTLPSpanExporter`, and `BatchSpanProcessor` classes from the appropriate packages.
801812
from azure.monitor.opentelemetry import configure_azure_monitor
@@ -832,6 +843,7 @@ For more information about Java, see the [Java supplemental documentation](java-
832843
## OpenTelemetry configurations
833844

834845
The following OpenTelemetry configurations can be accessed through environment variables while using the Azure Monitor OpenTelemetry Distros.
846+
835847
### [ASP.NET Core](#tab/aspnetcore)
836848

837849
| Environment variable | Description |
@@ -841,7 +853,6 @@ The following OpenTelemetry configurations can be accessed through environment v
841853
| `OTEL_RESOURCE_ATTRIBUTES` | Key-value pairs to be used as resource attributes. For more information about resource attributes, see the [Resource SDK specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.5.0/specification/resource/sdk.md#specifying-resource-information-via-an-environment-variable). |
842854
| `OTEL_SERVICE_NAME` | Sets the value of the `service.name` resource attribute. If `service.name` is also provided in `OTEL_RESOURCE_ATTRIBUTES`, then `OTEL_SERVICE_NAME` takes precedence. |
843855

844-
845856
### [.NET](#tab/net)
846857

847858
| Environment variable | Description |

articles/azure-monitor/app/opentelemetry-enable.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Follow the steps in this section to instrument your application with OpenTelemet
3333

3434
### [ASP.NET Core](#tab/aspnetcore)
3535

36-
- [ASP.NET Core Application](/aspnet/core/introduction-to-aspnet-core) using an officially supported version of [.NET Core](https://dotnet.microsoft.com/download/dotnet)
36+
- [ASP.NET Core Application](/aspnet/core/introduction-to-aspnet-core) using an officially supported version of [.NET](https://dotnet.microsoft.com/download/dotnet)
3737

3838
### [.NET](#tab/net)
3939

@@ -128,13 +128,14 @@ pip install azure-monitor-opentelemetry
128128
---
129129

130130
### Enable Azure Monitor Application Insights
131+
131132
To enable Azure Monitor Application Insights, you make a minor modification to your application and set your "Connection String." The Connection String tells your application where to send the telemetry the Distro collects, and it's unique to you.
132133

133134
#### Modify your Application
134135

135136
##### [ASP.NET Core](#tab/aspnetcore)
136137

137-
Add `UseAzureMonitor()` to your application startup. Depending on your version of .NET, it is in either your `startup.cs` or `program.cs` class.
138+
Add `UseAzureMonitor()` to your application startup. This is in your `program.cs` class.
138139

139140
```csharp
140141
// Import the Azure.Monitor.OpenTelemetry.AspNetCore namespace.
@@ -143,7 +144,7 @@ using Azure.Monitor.OpenTelemetry.AspNetCore;
143144
// Create a new WebApplicationBuilder instance.
144145
var builder = WebApplication.CreateBuilder(args);
145146

146-
// Add the OpenTelemetry NuGet package to the application's services and configure OpenTelemetry to use Azure Monitor.
147+
// Add OpenTelemetry and configure it to use Azure Monitor.
147148
builder.Services.AddOpenTelemetry().UseAzureMonitor();
148149

149150
// Build the application.
@@ -156,19 +157,23 @@ app.Run();
156157
##### [.NET](#tab/net)
157158

158159
Add the Azure Monitor Exporter to each OpenTelemetry signal in application startup. Depending on your version of .NET, it is in either your `startup.cs` or `program.cs` class.
160+
159161
```csharp
160162
// Create a new tracer provider builder and add an Azure Monitor trace exporter to the tracer provider builder.
161163
// It is important to keep the TracerProvider instance active throughout the process lifetime.
164+
// See https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/trace#tracerprovider-management
162165
var tracerProvider = Sdk.CreateTracerProviderBuilder()
163166
.AddAzureMonitorTraceExporter();
164167

165168
// Add an Azure Monitor metric exporter to the metrics provider builder.
166169
// It is important to keep the MetricsProvider instance active throughout the process lifetime.
170+
// See https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/metrics#meterprovider-management
167171
var metricsProvider = Sdk.CreateMeterProviderBuilder()
168172
.AddAzureMonitorMetricExporter();
169173

170174
// Create a new logger factory.
171175
// It is important to keep the LoggerFactory instance active throughout the process lifetime.
176+
// See https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/logs#logger-management
172177
var loggerFactory = LoggerFactory.Create(builder =>
173178
{
174179
builder.AddOpenTelemetry(options =>
@@ -237,6 +242,7 @@ input()
237242
---
238243

239244
#### Copy the Connection String from your Application Insights Resource
245+
240246
> [!TIP]
241247
> If you don't already have one, now is a great time to [Create an Application Insights Resource](create-workspace-resource.md#create-a-workspace-based-resource). Here's when we recommend you [create a new Application Insights Resource versus use an existing one](create-workspace-resource.md#when-to-use-a-single-application-insights-resource).
242248
@@ -263,20 +269,22 @@ To paste your Connection String, select from the following options:
263269
B. Set via Configuration File - Java Only (Recommended)
264270

265271
Create a configuration file named `applicationinsights.json`, and place it in the same directory as `applicationinsights-agent-3.4.19.jar` with the following content:
266-
272+
267273
```json
268274
{
269275
"connectionString": "<Your Connection String>"
270276
}
271277
```
278+
272279
Replace `<Your Connection String>` in the preceding JSON with *your* unique connection string.
273280

274281
C. Set via Code - ASP.NET Core, Node.js, and Python Only (Not recommended)
275282

276283
See [Connection String Configuration](opentelemetry-configuration.md#connection-string) for an example of setting Connection String via code.
277284

278285
> [!NOTE]
279-
> If you set the connection string in more than one place, we adhere to the following precendence:
286+
> If you set the connection string in more than one place, we adhere to the following precedence:
287+
>
280288
> 1. Code
281289
> 2. Environment Variable
282290
> 3. Configuration File

articles/azure-monitor/includes/azure-monitor-app-insights-opentelemetry-faqs.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,25 @@ It's a new open-source standard for observability. Learn more at [OpenTelemetry]
1717
### Why is Microsoft Azure Monitor investing in OpenTelemetry?
1818

1919
Microsoft is among the largest contributors to OpenTelemetry.
20-
20+
2121
The key value propositions of OpenTelemetry are that it's vendor-neutral and provides consistent APIs/SDKs across languages.
22-
22+
2323
Over time, we believe OpenTelemetry will enable Azure Monitor customers to observe applications written in languages beyond our [supported languages](../app/app-insights-overview.md#supported-languages). It also expands the types of data you can collect through a rich set of [instrumentation libraries](https://opentelemetry.io/docs/concepts/components/#instrumentation-libraries). Furthermore, OpenTelemetry SDKs tend to be more performant at scale than their predecessors, the Application Insights SDKs.
2424

2525
Finally, OpenTelemetry aligns with Microsoft's strategy to [embrace open source](https://opensource.microsoft.com/).
2626

2727
### What's the status of OpenTelemetry?
2828

29-
See the [OpenTelemetry Spec Compliance Matrix](https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix.md).
29+
See [OpenTelemetry Status](https://opentelemetry.io/status/).
3030

3131
### What is the "Azure Monitor OpenTelemetry Distro"?
3232

33-
You can think of it as a thin wrapper that bundles together all the OpenTelemetry components for a first class experience on Azure.
33+
You can think of it as a thin wrapper that bundles together all the OpenTelemetry components for a first class experience on Azure. This is also called [Distribution](https://opentelemetry.io/docs/concepts/distributions/) in OpenTelemetry.
3434

3535
### Why should I use the "Azure Monitor OpenTelemetry Distro"?
3636

3737
There are several advantages to using the Azure Monitor OpenTelemetry Distro over native OpenTelemetry from the community:
38+
3839
- Reduces enablement effort
3940
- Supported by Microsoft
4041
- Brings in Azure Specific features such as:
@@ -45,8 +46,9 @@ There are several advantages to using the Azure Monitor OpenTelemetry Distro ove
4546
- [Application Insights Standard Metrics](../app/standard-metrics.md)
4647
- Detect resource metadata to autopopulate [Cloud Role Name](../app/app-map.md#understand-the-cloud-role-name-within-the-context-of-an-application-map) on Azure
4748
- [Live Metrics](../app/live-stream.md) (future)
48-
49+
4950
In the spirit of OpenTelemetry, we designed the distro to be open and extensible. For example, you can add:
51+
5052
- An OTLP exporter and send to a second destination simultaneously
5153
- Other instrumentation libraries not included in the distro
5254

@@ -62,9 +64,9 @@ Adopting OpenTelemetry now prevents having to migrate at a later date.
6264

6365
### When should I use the Azure Monitor OpenTelemetry exporter?
6466

65-
For ASP..NET Core, Java, Node.js, and Python, we recommend using the OpenTelemetry distro. It's one line of code to get started.
67+
For ASP.NET Core, Java, Node.js, and Python, we recommend using the OpenTelemetry distro. It's one line of code to get started.
6668

67-
For all other .NET scenarios, we recommend using our exporter: `Azure.Monitor.OpenTelemetry.Exporter`.
69+
For all other .NET scenarios (like classic ASP.NET, Console apps etc.), we recommend using our exporter: `Azure.Monitor.OpenTelemetry.Exporter`.
6870

6971
### What's the current release state of features within the Azure Monitor OpenTelemetry Distro?
7072

0 commit comments

Comments
 (0)