@azure/mcp-linux-arm64 2.0.0-beta.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.txt +5683 -4849
- package/README.md +148 -27
- package/dist/Azure.Mcp.Tools.AzureMigrate.xml +1060 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/ActivityProcessors.md +119 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/AddApplicationInsightsTelemetry.md +129 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/AddApplicationInsightsTelemetryWorkerService.md +115 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/AddOpenTelemetry.md +153 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/ApplicationInsightsWeb.md +103 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/AzureMonitorExporter.md +137 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/ConfigureOpenTelemetryProvider.md +218 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/ConfigureResource.md +119 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/ConsoleExporter.md +47 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/EntityFrameworkInstrumentation.md +56 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/HttpInstrumentation.md +109 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/LogProcessors.md +101 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/OpenTelemetrySdkCreate.md +146 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/OtlpExporter.md +88 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/RedisInstrumentation.md +63 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/Sampling.md +86 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/SdkCreateTracerProviderBuilder.md +127 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/SqlClientInstrumentation.md +53 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/TelemetryClient.md +122 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/TelemetryConfigurationBuilder.md +173 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/UseAzureMonitor.md +96 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/UseAzureMonitorExporter.md +146 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/WithLogging.md +109 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/WithMetrics.md +105 -0
- package/dist/Instrumentation/Resources/api-reference/dotnet/WithTracing.md +91 -0
- package/dist/Instrumentation/Resources/concepts/dotnet/appinsights-aspnetcore.md +113 -0
- package/dist/Instrumentation/Resources/concepts/dotnet/aspnet-classic-appinsights.md +95 -0
- package/dist/Instrumentation/Resources/concepts/dotnet/azure-monitor-distro.md +102 -0
- package/dist/Instrumentation/Resources/concepts/dotnet/opentelemetry-pipeline.md +57 -0
- package/dist/Instrumentation/Resources/concepts/nodejs/azure-monitor-overview.md +106 -0
- package/dist/Instrumentation/Resources/concepts/nodejs/opentelemetry-pipeline.md +201 -0
- package/dist/Instrumentation/Resources/concepts/python/azure-monitor-overview.md +122 -0
- package/dist/Instrumentation/Resources/concepts/python/opentelemetry-pipeline.md +154 -0
- package/dist/Instrumentation/Resources/examples/dotnet/aspnet-classic-setup.md +80 -0
- package/dist/Instrumentation/Resources/examples/dotnet/aspnetcore-distro-setup.md +156 -0
- package/dist/Instrumentation/Resources/examples/dotnet/aspnetcore-setup.md +160 -0
- package/dist/Instrumentation/Resources/examples/dotnet/workerservice-setup.md +154 -0
- package/dist/Instrumentation/Resources/examples/nodejs/bunyan-setup.md +301 -0
- package/dist/Instrumentation/Resources/examples/nodejs/console-setup.md +284 -0
- package/dist/Instrumentation/Resources/examples/nodejs/express-setup.md +169 -0
- package/dist/Instrumentation/Resources/examples/nodejs/fastify-setup.md +237 -0
- package/dist/Instrumentation/Resources/examples/nodejs/langchain-js-setup.md +310 -0
- package/dist/Instrumentation/Resources/examples/nodejs/mongodb-setup.md +185 -0
- package/dist/Instrumentation/Resources/examples/nodejs/mysql-setup.md +231 -0
- package/dist/Instrumentation/Resources/examples/nodejs/nestjs-setup.md +184 -0
- package/dist/Instrumentation/Resources/examples/nodejs/nextjs-setup.md +320 -0
- package/dist/Instrumentation/Resources/examples/nodejs/postgres-setup.md +147 -0
- package/dist/Instrumentation/Resources/examples/nodejs/redis-setup.md +198 -0
- package/dist/Instrumentation/Resources/examples/nodejs/winston-setup.md +260 -0
- package/dist/Instrumentation/Resources/examples/python/console-setup.md +392 -0
- package/dist/Instrumentation/Resources/examples/python/django-setup.md +269 -0
- package/dist/Instrumentation/Resources/examples/python/fastapi-setup.md +256 -0
- package/dist/Instrumentation/Resources/examples/python/flask-setup.md +218 -0
- package/dist/Instrumentation/Resources/examples/python/genai-setup.md +214 -0
- package/dist/Instrumentation/Resources/examples/python/generic-setup.md +164 -0
- package/dist/Instrumentation/Resources/migration/dotnet/aad-authentication-migration.md +150 -0
- package/dist/Instrumentation/Resources/migration/dotnet/appinsights-2x-to-3x-code-migration.md +164 -0
- package/dist/Instrumentation/Resources/migration/dotnet/appinsights-2x-to-3x-no-code-change.md +92 -0
- package/dist/Instrumentation/Resources/migration/dotnet/aspnet-classic-2x-to-3x-code-migration.md +190 -0
- package/dist/Instrumentation/Resources/migration/dotnet/console-2x-to-3x-code-migration.md +106 -0
- package/dist/Instrumentation/Resources/migration/dotnet/ilogger-migration.md +54 -0
- package/dist/Instrumentation/Resources/migration/dotnet/workerservice-2x-to-3x-code-migration.md +126 -0
- package/dist/Instrumentation/Resources/migration/dotnet/workerservice-2x-to-3x-no-code-change.md +102 -0
- package/dist/azmcp +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AzureMonitorExporter
|
|
3
|
+
category: api-reference
|
|
4
|
+
applies-to: 3.x
|
|
5
|
+
source: src/AzureMonitorExporterExtensions.cs, src/AzureMonitorExporterOptions.cs
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AddAzureMonitor*Exporter
|
|
9
|
+
|
|
10
|
+
**Namespace:** `Azure.Monitor.OpenTelemetry.Exporter`
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
- You are building a **console app, CLI tool, or background job** without the .NET Generic Host.
|
|
15
|
+
- You need to export **only a subset** of signals (e.g., traces and metrics but not logs).
|
|
16
|
+
- You need **different options per signal** (e.g., different credentials or storage directories).
|
|
17
|
+
|
|
18
|
+
## Signatures
|
|
19
|
+
|
|
20
|
+
```csharp
|
|
21
|
+
public static TracerProviderBuilder AddAzureMonitorTraceExporter(
|
|
22
|
+
this TracerProviderBuilder builder,
|
|
23
|
+
Action<AzureMonitorExporterOptions>? configure = null,
|
|
24
|
+
TokenCredential? credential = null,
|
|
25
|
+
string? name = null);
|
|
26
|
+
|
|
27
|
+
public static MeterProviderBuilder AddAzureMonitorMetricExporter(
|
|
28
|
+
this MeterProviderBuilder builder,
|
|
29
|
+
Action<AzureMonitorExporterOptions>? configure = null,
|
|
30
|
+
TokenCredential? credential = null,
|
|
31
|
+
string? name = null);
|
|
32
|
+
|
|
33
|
+
public static LoggerProviderBuilder AddAzureMonitorLogExporter(
|
|
34
|
+
this LoggerProviderBuilder builder,
|
|
35
|
+
Action<AzureMonitorExporterOptions>? configure = null,
|
|
36
|
+
TokenCredential? credential = null,
|
|
37
|
+
string? name = null);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
A legacy overload extending `OpenTelemetryLoggerOptions` also exists but is superseded by the `LoggerProviderBuilder` version above.
|
|
41
|
+
|
|
42
|
+
## Behavior notes
|
|
43
|
+
|
|
44
|
+
- **Cannot** be combined with `UseAzureMonitorExporter` in the same app — a runtime exception is thrown.
|
|
45
|
+
- **Live Metrics** is not supported by per-signal methods. Setting `EnableLiveMetrics = true` has no effect — a warning is logged and the setting is ignored.
|
|
46
|
+
- For hosted apps (ASP.NET Core, Worker Services), prefer `UseAzureMonitorExporter()`(see in UseAzureMonitorExporter.md) — it registers all three signals in one call with Live Metrics support.
|
|
47
|
+
|
|
48
|
+
## AzureMonitorExporterOptions
|
|
49
|
+
|
|
50
|
+
Inherits `Azure.Core.ClientOptions`.
|
|
51
|
+
|
|
52
|
+
| Property | Type | Default | Description |
|
|
53
|
+
|---|---|---|---|
|
|
54
|
+
| `ConnectionString` | `string` | `null` | Application Insights connection string. Falls back to `APPLICATIONINSIGHTS_CONNECTION_STRING` env var. |
|
|
55
|
+
| `Credential` | `TokenCredential` | `null` | Azure AD token credential for Entra-based auth. |
|
|
56
|
+
| `SamplingRatio` | `float` | `1.0F` | Fixed-percentage sampling ratio (0.0–1.0). Only used when `TracesPerSecond` is `null`. |
|
|
57
|
+
| `TracesPerSecond` | `double?` | `5.0` | Rate-limited sampling target. Takes precedence over `SamplingRatio`. Set to `null` to use fixed-percentage sampling. |
|
|
58
|
+
| `StorageDirectory` | `string` | `null` | Custom directory for offline/retry storage. Uses OS temp by default. |
|
|
59
|
+
| `DisableOfflineStorage` | `bool` | `false` | Disables persistent storage for failed telemetry. |
|
|
60
|
+
| `EnableLiveMetrics` | `bool` | `true` | **Ignored** by per-signal methods. Only applies with `UseAzureMonitorExporter`. |
|
|
61
|
+
| `EnableTraceBasedLogsSampler` | `bool` | `true` | When `true`, only logs correlated to sampled traces are exported. Logs without trace context are always exported. |
|
|
62
|
+
|
|
63
|
+
## Sampling
|
|
64
|
+
|
|
65
|
+
`AddAzureMonitorTraceExporter` automatically configures a trace sampler — you do not need to set one yourself.
|
|
66
|
+
|
|
67
|
+
**Two modes**, controlled by `TracesPerSecond` and `SamplingRatio`:
|
|
68
|
+
|
|
69
|
+
| Mode | Activated when | Sampler | Example |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| Rate-limited (default) | `TracesPerSecond` is non-null | `RateLimitedSampler` — caps throughput to N traces/sec | `TracesPerSecond = 5.0` → ~5 traces/sec |
|
|
72
|
+
| Fixed-percentage | `TracesPerSecond` is `null` | `ApplicationInsightsSampler` — samples a fixed ratio | `SamplingRatio = 0.4F` → 40% of traces |
|
|
73
|
+
|
|
74
|
+
**Environment variable overrides** — `OTEL_TRACES_SAMPLER` / `OTEL_TRACES_SAMPLER_ARG`:
|
|
75
|
+
|
|
76
|
+
| `OTEL_TRACES_SAMPLER` | `OTEL_TRACES_SAMPLER_ARG` | Effect |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `microsoft.rate_limited` | `5` | `TracesPerSecond = 5.0` |
|
|
79
|
+
| `microsoft.fixed_percentage` | `0.4` | `SamplingRatio = 0.4F`, `TracesPerSecond = null` |
|
|
80
|
+
|
|
81
|
+
**Log sampling** — when `EnableTraceBasedLogsSampler` is `true` (default), logs correlated to a sampled-out trace are also dropped.
|
|
82
|
+
|
|
83
|
+
## Minimal example
|
|
84
|
+
|
|
85
|
+
```csharp
|
|
86
|
+
using Azure.Monitor.OpenTelemetry.Exporter;
|
|
87
|
+
using OpenTelemetry;
|
|
88
|
+
using OpenTelemetry.Trace;
|
|
89
|
+
|
|
90
|
+
// Connection string from APPLICATIONINSIGHTS_CONNECTION_STRING env var
|
|
91
|
+
using var sdk = OpenTelemetrySdk.Create(builder => builder
|
|
92
|
+
.WithTracing(tracing => tracing
|
|
93
|
+
.AddSource("MyApp")
|
|
94
|
+
.AddAzureMonitorTraceExporter()));
|
|
95
|
+
|
|
96
|
+
// sdk.Dispose() flushes and shuts down on exit.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Full example
|
|
100
|
+
|
|
101
|
+
```csharp
|
|
102
|
+
using Azure.Identity;
|
|
103
|
+
using Azure.Monitor.OpenTelemetry.Exporter;
|
|
104
|
+
using OpenTelemetry;
|
|
105
|
+
using OpenTelemetry.Trace;
|
|
106
|
+
using OpenTelemetry.Metrics;
|
|
107
|
+
|
|
108
|
+
var credential = new DefaultAzureCredential();
|
|
109
|
+
var connStr = Environment.GetEnvironmentVariable("APPLICATIONINSIGHTS_CONNECTION_STRING");
|
|
110
|
+
|
|
111
|
+
using var sdk = OpenTelemetrySdk.Create(builder => builder
|
|
112
|
+
.ConfigureResource(r => r.AddService("my-console-app"))
|
|
113
|
+
.WithTracing(tracing => tracing
|
|
114
|
+
.AddSource("MyApp")
|
|
115
|
+
.AddHttpClientInstrumentation()
|
|
116
|
+
.AddAzureMonitorTraceExporter(
|
|
117
|
+
configure: o =>
|
|
118
|
+
{
|
|
119
|
+
o.ConnectionString = connStr;
|
|
120
|
+
o.TracesPerSecond = null;
|
|
121
|
+
o.SamplingRatio = 0.5F;
|
|
122
|
+
},
|
|
123
|
+
credential: credential))
|
|
124
|
+
.WithMetrics(metrics => metrics
|
|
125
|
+
.AddMeter("MyApp")
|
|
126
|
+
.AddAzureMonitorMetricExporter(
|
|
127
|
+
configure: o => o.ConnectionString = connStr,
|
|
128
|
+
credential: credential)));
|
|
129
|
+
// Logging intentionally omitted — only traces and metrics exported
|
|
130
|
+
|
|
131
|
+
// sdk.Dispose() flushes all signals on exit.
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## See also
|
|
135
|
+
|
|
136
|
+
- UseAzureMonitorExporter (all signals)(see in UseAzureMonitorExporter.md)
|
|
137
|
+
- WithTracing(see in WithTracing.md) · WithMetrics(see in WithMetrics.md) · WithLogging(see in WithLogging.md)
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ConfigureOpenTelemetryProvider
|
|
3
|
+
category: api-reference
|
|
4
|
+
applies-to: 3.x
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ConfigureOpenTelemetry*Provider Extensions
|
|
8
|
+
|
|
9
|
+
These `IServiceCollection` extension methods register actions used to
|
|
10
|
+
configure OpenTelemetry providers. They work anywhere you have access to an
|
|
11
|
+
`IServiceCollection` - in application startup, inside a builder's
|
|
12
|
+
`ConfigureServices` callback, or in a shared extension method.
|
|
13
|
+
|
|
14
|
+
## When to use
|
|
15
|
+
|
|
16
|
+
- You want to **register sources, meters, or logging configuration separately**
|
|
17
|
+
from where the provider is created (e.g., different files, methods, or
|
|
18
|
+
packages).
|
|
19
|
+
- You need to **add configuration from inside a `ConfigureServices` callback**
|
|
20
|
+
on a provider builder.
|
|
21
|
+
- Your app has **modular startup** where each feature area configures its own
|
|
22
|
+
instrumentation independently.
|
|
23
|
+
- You are a **library author** registering instrumentation without owning the
|
|
24
|
+
provider creation call.
|
|
25
|
+
- You need access to `IServiceProvider` at configuration time to resolve
|
|
26
|
+
services such as `IConfiguration`.
|
|
27
|
+
|
|
28
|
+
> [!IMPORTANT]
|
|
29
|
+
> These methods register configuration but **do not create a
|
|
30
|
+
> provider**. A provider must still be created via
|
|
31
|
+
> Host & DI-Integrated (`AddOpenTelemetry`)(see in AddOpenTelemetry.md),
|
|
32
|
+
> Unified Multi-Signal (`OpenTelemetrySdk.Create`)(see in OpenTelemetrySdkCreate.md), or
|
|
33
|
+
> Per-Signal / Legacy (`Sdk.CreateTracerProviderBuilder`)(see in SdkCreateTracerProviderBuilder.md)
|
|
34
|
+
> for the configuration to take effect.
|
|
35
|
+
|
|
36
|
+
## Namespaces
|
|
37
|
+
|
|
38
|
+
| Method | Namespace |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `ConfigureOpenTelemetryTracerProvider` | `OpenTelemetry.Trace` |
|
|
41
|
+
| `ConfigureOpenTelemetryMeterProvider` | `OpenTelemetry.Metrics` |
|
|
42
|
+
| `ConfigureOpenTelemetryLoggerProvider` | `OpenTelemetry.Logs` |
|
|
43
|
+
|
|
44
|
+
## Available methods
|
|
45
|
+
|
|
46
|
+
| Method | Signal |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `services.ConfigureOpenTelemetryTracerProvider(...)` | Tracing |
|
|
49
|
+
| `services.ConfigureOpenTelemetryMeterProvider(...)` | Metrics |
|
|
50
|
+
| `services.ConfigureOpenTelemetryLoggerProvider(...)` | Logging |
|
|
51
|
+
|
|
52
|
+
### Overload 1 - `Action<*ProviderBuilder>` (executed immediately)
|
|
53
|
+
|
|
54
|
+
```csharp
|
|
55
|
+
public static IServiceCollection ConfigureOpenTelemetryTracerProvider(
|
|
56
|
+
this IServiceCollection services,
|
|
57
|
+
Action<TracerProviderBuilder> configure);
|
|
58
|
+
|
|
59
|
+
public static IServiceCollection ConfigureOpenTelemetryMeterProvider(
|
|
60
|
+
this IServiceCollection services,
|
|
61
|
+
Action<MeterProviderBuilder> configure);
|
|
62
|
+
|
|
63
|
+
public static IServiceCollection ConfigureOpenTelemetryLoggerProvider(
|
|
64
|
+
this IServiceCollection services,
|
|
65
|
+
Action<LoggerProviderBuilder> configure);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The `configure` delegate is **invoked immediately** (not deferred). Internally
|
|
69
|
+
it creates a `*ProviderServiceCollectionBuilder` (e.g.,
|
|
70
|
+
`TracerProviderServiceCollectionBuilder`) wrapping the `IServiceCollection` and
|
|
71
|
+
passes it to the delegate. Because the delegate receives the builder before the
|
|
72
|
+
`IServiceProvider` exists, it is **safe to register services** (e.g., call
|
|
73
|
+
`AddSource`, `AddMeter`, `AddInstrumentation<T>`, etc.).
|
|
74
|
+
|
|
75
|
+
### Overload 2 - `Action<IServiceProvider, *ProviderBuilder>` (deferred)
|
|
76
|
+
|
|
77
|
+
```csharp
|
|
78
|
+
public static IServiceCollection ConfigureOpenTelemetryTracerProvider(
|
|
79
|
+
this IServiceCollection services,
|
|
80
|
+
Action<IServiceProvider, TracerProviderBuilder> configure);
|
|
81
|
+
|
|
82
|
+
public static IServiceCollection ConfigureOpenTelemetryMeterProvider(
|
|
83
|
+
this IServiceCollection services,
|
|
84
|
+
Action<IServiceProvider, MeterProviderBuilder> configure);
|
|
85
|
+
|
|
86
|
+
public static IServiceCollection ConfigureOpenTelemetryLoggerProvider(
|
|
87
|
+
this IServiceCollection services,
|
|
88
|
+
Action<IServiceProvider, LoggerProviderBuilder> configure);
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
This overload registers the delegate as an `IConfigureTracerProviderBuilder` /
|
|
92
|
+
`IConfigureMeterProviderBuilder` / `IConfigureLoggerProviderBuilder` singleton
|
|
93
|
+
in the `IServiceCollection`. The delegate is **not invoked until the provider
|
|
94
|
+
is being constructed** (when the `IServiceProvider` is available). Because the
|
|
95
|
+
service container is already built at that point, **you cannot register new
|
|
96
|
+
services** inside this callback - many builder helper extensions that register
|
|
97
|
+
services will throw `NotSupportedException`.
|
|
98
|
+
|
|
99
|
+
```csharp
|
|
100
|
+
services.ConfigureOpenTelemetryTracerProvider((sp, tracing) =>
|
|
101
|
+
{
|
|
102
|
+
var config = sp.GetRequiredService<IConfiguration>();
|
|
103
|
+
tracing.SetSampler(new TraceIdRatioBasedSampler(
|
|
104
|
+
config.GetValue<double>("Telemetry:SamplingRate")));
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Example - separating source registration from exporter setup
|
|
109
|
+
|
|
110
|
+
Register instrumentation sources early in startup, then configure exporters
|
|
111
|
+
separately:
|
|
112
|
+
|
|
113
|
+
```csharp
|
|
114
|
+
using OpenTelemetry;
|
|
115
|
+
using OpenTelemetry.Trace;
|
|
116
|
+
using OpenTelemetry.Metrics;
|
|
117
|
+
using OpenTelemetry.Resources;
|
|
118
|
+
|
|
119
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
120
|
+
|
|
121
|
+
// Register sources (could be in a different file or method)
|
|
122
|
+
builder.Services.ConfigureOpenTelemetryTracerProvider(tracing =>
|
|
123
|
+
tracing.AddSource("MyApp"));
|
|
124
|
+
|
|
125
|
+
builder.Services.ConfigureOpenTelemetryMeterProvider(metrics =>
|
|
126
|
+
metrics.AddMeter("MyApp"));
|
|
127
|
+
|
|
128
|
+
// Configure exporters and create the provider
|
|
129
|
+
builder.Services.AddOpenTelemetry()
|
|
130
|
+
.ConfigureResource(r => r.AddService("my-app"))
|
|
131
|
+
.WithTracing(tracing => tracing.AddOtlpExporter())
|
|
132
|
+
.WithMetrics(metrics => metrics.AddOtlpExporter());
|
|
133
|
+
|
|
134
|
+
var app = builder.Build();
|
|
135
|
+
app.Run();
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Example - setting cloud role name via ConfigureResource
|
|
139
|
+
|
|
140
|
+
A common migration pattern: replace a custom `ITelemetryInitializer` that sets
|
|
141
|
+
cloud role name with `ConfigureResource` + `AddService`:
|
|
142
|
+
|
|
143
|
+
```csharp
|
|
144
|
+
using OpenTelemetry.Resources; // Required for ResourceBuilder.AddService
|
|
145
|
+
|
|
146
|
+
// Set cloud role name (replaces ITelemetryInitializer that set Context.Cloud.RoleName)
|
|
147
|
+
builder.Services.ConfigureOpenTelemetryTracerProvider(tracing =>
|
|
148
|
+
tracing.ConfigureResource(r => r.AddService(
|
|
149
|
+
serviceName: "MyService",
|
|
150
|
+
serviceInstanceId: Environment.MachineName)));
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Example - library author registering sources
|
|
154
|
+
|
|
155
|
+
A library can register its instrumentation without depending on the app's
|
|
156
|
+
startup code:
|
|
157
|
+
|
|
158
|
+
```csharp
|
|
159
|
+
using OpenTelemetry.Trace;
|
|
160
|
+
using OpenTelemetry.Metrics;
|
|
161
|
+
|
|
162
|
+
public static class MyLibraryExtensions
|
|
163
|
+
{
|
|
164
|
+
public static IServiceCollection AddMyLibrary(this IServiceCollection services)
|
|
165
|
+
{
|
|
166
|
+
services.AddSingleton<MyService>();
|
|
167
|
+
|
|
168
|
+
services.ConfigureOpenTelemetryTracerProvider(tracing =>
|
|
169
|
+
tracing.AddSource("MyLibrary"));
|
|
170
|
+
services.ConfigureOpenTelemetryMeterProvider(metrics =>
|
|
171
|
+
metrics.AddMeter("MyLibrary"));
|
|
172
|
+
|
|
173
|
+
return services;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The host application composes everything:
|
|
179
|
+
|
|
180
|
+
```csharp
|
|
181
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
182
|
+
|
|
183
|
+
builder.Services.AddMyLibrary(); // library registers its sources
|
|
184
|
+
|
|
185
|
+
builder.Services.AddOpenTelemetry() // app owns the provider
|
|
186
|
+
.ConfigureResource(r => r.AddService("my-app"))
|
|
187
|
+
.WithTracing(tracing => tracing.AddOtlpExporter())
|
|
188
|
+
.WithMetrics(metrics => metrics.AddOtlpExporter());
|
|
189
|
+
|
|
190
|
+
var app = builder.Build();
|
|
191
|
+
app.Run();
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
## Relationship with `WithTracing` / `WithMetrics` / `WithLogging`
|
|
197
|
+
|
|
198
|
+
These methods are **complementary** with the `With*` methods, not
|
|
199
|
+
interchangeable. `WithTracing()` / `WithMetrics()` / `WithLogging()` **register
|
|
200
|
+
the provider**; `ConfigureOpenTelemetry*Provider` only **queues configuration
|
|
201
|
+
actions**. Without a `With*` call (or equivalent provider creation), queued
|
|
202
|
+
actions are never consumed.
|
|
203
|
+
|
|
204
|
+
## Hosting package not required
|
|
205
|
+
|
|
206
|
+
These methods are defined in `OpenTelemetry.Api.ProviderBuilderExtensions` and
|
|
207
|
+
work with **any `IServiceCollection`** — hosted or non-hosted. The only
|
|
208
|
+
requirement is that a provider is eventually resolved from the same
|
|
209
|
+
`IServiceCollection` for the queued actions to take effect.
|
|
210
|
+
|
|
211
|
+
## Related methods
|
|
212
|
+
|
|
213
|
+
| Method | Defined on | Purpose |
|
|
214
|
+
| --- | --- | --- |
|
|
215
|
+
| Host & DI-Integrated (`AddOpenTelemetry`)(see in AddOpenTelemetry.md) | `IServiceCollection` | Creates the provider and starts the hosted service |
|
|
216
|
+
| `.WithTracing()` / `.WithMetrics()` / `.WithLogging()` | `IOpenTelemetryBuilder` | Registers a provider for the signal and optionally configures it |
|
|
217
|
+
| `.ConfigureResource()` | `IOpenTelemetryBuilder` | Shared resource configuration (internally uses `ConfigureOpenTelemetry*Provider`) |
|
|
218
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ConfigureResource
|
|
3
|
+
category: api-reference
|
|
4
|
+
applies-to: 1.x
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# .ConfigureResource()
|
|
8
|
+
|
|
9
|
+
## API surface
|
|
10
|
+
|
|
11
|
+
### On `IOpenTelemetryBuilder` (shared across all signals)
|
|
12
|
+
|
|
13
|
+
| Method | Purpose |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| `.ConfigureResource(Action<ResourceBuilder>)` | Modify the resource for traces, metrics, **and** logs |
|
|
16
|
+
|
|
17
|
+
### On individual provider builders
|
|
18
|
+
|
|
19
|
+
| Method | Purpose |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `TracerProviderBuilder.ConfigureResource(Action<ResourceBuilder>)` | Modify resource for tracing only |
|
|
22
|
+
| `MeterProviderBuilder.ConfigureResource(Action<ResourceBuilder>)` | Modify resource for metrics only |
|
|
23
|
+
| `LoggerProviderBuilder.ConfigureResource(Action<ResourceBuilder>)` | Modify resource for logging only |
|
|
24
|
+
| `*.SetResourceBuilder(ResourceBuilder)` | Replace the resource builder entirely (all three builders) |
|
|
25
|
+
|
|
26
|
+
### `ResourceBuilder` static methods
|
|
27
|
+
|
|
28
|
+
| Method | Purpose |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| `ResourceBuilder.CreateDefault()` | Create builder with SDK defaults + env var detector |
|
|
31
|
+
| `ResourceBuilder.CreateEmpty()` | Create builder with no attributes |
|
|
32
|
+
|
|
33
|
+
### `ResourceBuilder` instance methods
|
|
34
|
+
|
|
35
|
+
| Method | Purpose |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `.AddService(string serviceName, ...)` | Add `service.name`, `service.namespace`, `service.version`, `service.instance.id` |
|
|
38
|
+
| `.AddAttributes(IEnumerable<KeyValuePair<string, object>>)` | Add arbitrary resource attributes |
|
|
39
|
+
| `.AddTelemetrySdk()` | Add `telemetry.sdk.*` attributes (included in `CreateDefault()`) |
|
|
40
|
+
| `.AddEnvironmentVariableDetector()` | Parse `OTEL_RESOURCE_ATTRIBUTES` and `OTEL_SERVICE_NAME` env vars |
|
|
41
|
+
| `.AddDetector(IResourceDetector)` | Add a custom resource detector |
|
|
42
|
+
| `.AddDetector(Func<IServiceProvider, IResourceDetector>)` | Add a custom detector resolved from DI |
|
|
43
|
+
| `.Clear()` | Remove all previously added detectors/resources |
|
|
44
|
+
|
|
45
|
+
## When to use
|
|
46
|
+
|
|
47
|
+
- Set `service.name`, `service.version`, and other resource attributes that identify your application.
|
|
48
|
+
- Apply a shared resource across all three signals (traces, metrics, logs) via the top-level `IOpenTelemetryBuilder`.
|
|
49
|
+
- Override or extend the default resource for a single signal's provider builder.
|
|
50
|
+
- Add custom `IResourceDetector` implementations for cloud metadata or environment-specific attributes.
|
|
51
|
+
- Call multiple times safely — each configuration action is applied sequentially.
|
|
52
|
+
|
|
53
|
+
## Minimal example
|
|
54
|
+
|
|
55
|
+
```csharp
|
|
56
|
+
using OpenTelemetry;
|
|
57
|
+
using OpenTelemetry.Resources;
|
|
58
|
+
using OpenTelemetry.Trace;
|
|
59
|
+
|
|
60
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
61
|
+
|
|
62
|
+
builder.Services.AddOpenTelemetry()
|
|
63
|
+
.ConfigureResource(r => r.AddService("my-api"))
|
|
64
|
+
.WithTracing(t => t.AddOtlpExporter());
|
|
65
|
+
|
|
66
|
+
var app = builder.Build();
|
|
67
|
+
app.Run();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Full example
|
|
71
|
+
|
|
72
|
+
```csharp
|
|
73
|
+
using OpenTelemetry;
|
|
74
|
+
using OpenTelemetry.Resources;
|
|
75
|
+
using OpenTelemetry.Trace;
|
|
76
|
+
using OpenTelemetry.Metrics;
|
|
77
|
+
|
|
78
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
79
|
+
|
|
80
|
+
builder.Services.AddOpenTelemetry()
|
|
81
|
+
.ConfigureResource(resource => resource
|
|
82
|
+
.AddService(
|
|
83
|
+
serviceName: "order-api",
|
|
84
|
+
serviceNamespace: "ecommerce",
|
|
85
|
+
serviceVersion: "2.1.0",
|
|
86
|
+
autoGenerateServiceInstanceId: true)
|
|
87
|
+
.AddAttributes(new Dictionary<string, object>
|
|
88
|
+
{
|
|
89
|
+
["deployment.environment"] = "production",
|
|
90
|
+
["host.name"] = Environment.MachineName,
|
|
91
|
+
})
|
|
92
|
+
.AddEnvironmentVariableDetector())
|
|
93
|
+
.WithTracing(t => t.AddOtlpExporter())
|
|
94
|
+
.WithMetrics(m => m.AddOtlpExporter());
|
|
95
|
+
|
|
96
|
+
var app = builder.Build();
|
|
97
|
+
app.Run();
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Key parameters
|
|
101
|
+
|
|
102
|
+
`AddService()` parameters:
|
|
103
|
+
|
|
104
|
+
| Parameter | Type | Default | Description |
|
|
105
|
+
| --- | --- | --- | --- |
|
|
106
|
+
| `serviceName` | `string` | *(required)* | Value for `service.name` |
|
|
107
|
+
| `serviceNamespace` | `string?` | `null` | Value for `service.namespace` |
|
|
108
|
+
| `serviceVersion` | `string?` | `null` | Value for `service.version` |
|
|
109
|
+
| `autoGenerateServiceInstanceId` | `bool` | `true` | Auto-generate a GUID for `service.instance.id` |
|
|
110
|
+
| `serviceInstanceId` | `string?` | `null` | Explicit `service.instance.id` (overrides auto-generate) |
|
|
111
|
+
|
|
112
|
+
## Behavior notes
|
|
113
|
+
|
|
114
|
+
- `ConfigureResource()` on `IOpenTelemetryBuilder` delegates to `ConfigureResource()` on all three signal builders (tracer, meter, logger).
|
|
115
|
+
- `ConfigureResource()` is **additive** — each call appends to the existing resource.
|
|
116
|
+
- `SetResourceBuilder()` **replaces** the entire resource builder. Use `ConfigureResource()` unless you specifically need a full reset.
|
|
117
|
+
- `CreateDefault()` includes `telemetry.sdk.*` attributes, `OTEL_RESOURCE_ATTRIBUTES`, `OTEL_SERVICE_NAME`, and a fallback `service.name` of `unknown_service:<process_name>`.
|
|
118
|
+
- `AddDetector(Func<IServiceProvider, IResourceDetector>)` throws `NotSupportedException` if `ResourceBuilder.Build()` is called directly without an `IServiceProvider`.
|
|
119
|
+
- Resource attributes are merged in registration order. Later values for the same key overwrite earlier ones.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ConsoleExporter
|
|
3
|
+
category: api-reference
|
|
4
|
+
applies-to: 1.x
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Console Exporter
|
|
8
|
+
|
|
9
|
+
Writes traces, metrics, and logs to the console (stdout). Useful for **local development and debugging only** — not for production.
|
|
10
|
+
|
|
11
|
+
## Package
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
OpenTelemetry.Exporter.Console
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
```csharp
|
|
20
|
+
using OpenTelemetry.Trace;
|
|
21
|
+
using OpenTelemetry.Metrics;
|
|
22
|
+
using OpenTelemetry.Logs;
|
|
23
|
+
|
|
24
|
+
builder.Services.ConfigureOpenTelemetryTracerProvider(tracing =>
|
|
25
|
+
tracing.AddConsoleExporter());
|
|
26
|
+
|
|
27
|
+
builder.Services.ConfigureOpenTelemetryMeterProvider(metrics =>
|
|
28
|
+
metrics.AddConsoleExporter());
|
|
29
|
+
|
|
30
|
+
builder.Services.ConfigureOpenTelemetryLoggerProvider(logging =>
|
|
31
|
+
logging.AddConsoleExporter());
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Options
|
|
35
|
+
|
|
36
|
+
| Option | Default | Description |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| `Targets` | `Console` | `ConsoleExporterOutputTargets.Console` or `Debug` (writes to `System.Diagnostics.Debug`). |
|
|
39
|
+
|
|
40
|
+
## Notes
|
|
41
|
+
|
|
42
|
+
- **Development only** — do not use in production. Adds significant overhead.
|
|
43
|
+
- Useful for verifying that spans, metrics, and log records are being generated correctly.
|
|
44
|
+
- Console exporter works alongside Azure Monitor — both receive the same telemetry.
|
|
45
|
+
- Each signal needs its own `AddConsoleExporter()` call.
|
|
46
|
+
- For production multi-destination export, use OTLP exporter instead.
|
|
47
|
+
- **Non-DI usage:** Use `config.ConfigureOpenTelemetryBuilder(otel => otel.WithTracing(t => t.AddConsoleExporter()))` on `TelemetryConfiguration`. See TelemetryClient.md.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: EntityFrameworkInstrumentation
|
|
3
|
+
category: api-reference
|
|
4
|
+
applies-to: 1.x
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Entity Framework Core Instrumentation
|
|
8
|
+
|
|
9
|
+
## Package
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
OpenTelemetry.Instrumentation.EntityFrameworkCore
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
```csharp
|
|
18
|
+
using OpenTelemetry.Trace;
|
|
19
|
+
|
|
20
|
+
// EF Core is auto-instrumented via DiagnosticSource — no additional setup needed.
|
|
21
|
+
// To customize, use ConfigureOpenTelemetryTracerProvider:
|
|
22
|
+
builder.Services.ConfigureOpenTelemetryTracerProvider(tracing =>
|
|
23
|
+
tracing.AddEntityFrameworkCoreInstrumentation(options =>
|
|
24
|
+
{
|
|
25
|
+
options.SetDbStatementForText = true; // Include SQL text (be careful with PII)
|
|
26
|
+
options.SetDbStatementForStoredProcedure = true;
|
|
27
|
+
}));
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Options
|
|
31
|
+
|
|
32
|
+
| Option | Default | Description |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `SetDbStatementForText` | `false` | Include raw SQL text in `db.statement` attribute. May contain PII. |
|
|
35
|
+
| `SetDbStatementForStoredProcedure` | `true` | Include stored procedure names in `db.statement`. |
|
|
36
|
+
| `EnrichWithIDbCommand` | `null` | `Action<Activity, IDbCommand>` callback to enrich spans with custom tags from the command. |
|
|
37
|
+
| `Filter` | `null` | `Func<string, string, bool>` — filter by provider name and command text. Return `false` to suppress. |
|
|
38
|
+
|
|
39
|
+
## Semantic conventions
|
|
40
|
+
|
|
41
|
+
EF Core spans use the [OpenTelemetry Database semantic conventions](https://opentelemetry.io/docs/specs/semconv/database/):
|
|
42
|
+
|
|
43
|
+
| Attribute | Example |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `db.system` | `microsoft.sql_server`, `postgresql`, `sqlite` |
|
|
46
|
+
| `db.name` | `MyDatabase` |
|
|
47
|
+
| `db.statement` | `SELECT * FROM Orders WHERE Id = @p0` (if `SetDbStatementForText = true`) |
|
|
48
|
+
| `server.address` | `localhost` |
|
|
49
|
+
| `server.port` | `5432` |
|
|
50
|
+
|
|
51
|
+
## Notes
|
|
52
|
+
|
|
53
|
+
- EF Core instrumentation relies on `DiagnosticSource` events emitted by EF Core itself — no additional packages needed for basic span collection.
|
|
54
|
+
- The `OpenTelemetry.Instrumentation.EntityFrameworkCore` package is only needed to customize options (SQL text capture, enrichment, filtering).
|
|
55
|
+
- Works with all EF Core providers (SQL Server, PostgreSQL, SQLite, MySQL, etc.).
|
|
56
|
+
- **Non-DI usage:** If not using ASP.NET Core DI, use `config.ConfigureOpenTelemetryBuilder(otel => otel.WithTracing(t => t.AddEntityFrameworkCoreInstrumentation()))` on `TelemetryConfiguration`. See TelemetryClient.md.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: HttpInstrumentation
|
|
3
|
+
category: api-reference
|
|
4
|
+
applies-to: 1.x
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# HTTP Instrumentation — Client & Server Enrichment
|
|
8
|
+
|
|
9
|
+
HTTP client and server instrumentation is auto-configured by both Azure Monitor Distro and Application Insights 3.x. This doc covers **customization**: enrichment, filtering, and advanced options.
|
|
10
|
+
|
|
11
|
+
## Packages
|
|
12
|
+
|
|
13
|
+
| Scope | Package | Auto-included? |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| HTTP Client (`HttpClient`) | `OpenTelemetry.Instrumentation.Http` | Yes (by Distro & AI 3.x) |
|
|
16
|
+
| HTTP Server (ASP.NET Core) | `OpenTelemetry.Instrumentation.AspNetCore` | Yes (by Distro & AI 3.x) |
|
|
17
|
+
|
|
18
|
+
You only need to install these packages explicitly if you want to **customize** the instrumentation options.
|
|
19
|
+
|
|
20
|
+
## HTTP Client enrichment
|
|
21
|
+
|
|
22
|
+
```csharp
|
|
23
|
+
using OpenTelemetry.Trace;
|
|
24
|
+
|
|
25
|
+
builder.Services.ConfigureOpenTelemetryTracerProvider(tracing =>
|
|
26
|
+
tracing.AddHttpClientInstrumentation(options =>
|
|
27
|
+
{
|
|
28
|
+
options.EnrichWithHttpRequestMessage = (activity, request) =>
|
|
29
|
+
{
|
|
30
|
+
activity.SetTag("http.request.header.x-correlation-id",
|
|
31
|
+
request.Headers.TryGetValues("X-Correlation-Id", out var vals) ? vals.First() : null);
|
|
32
|
+
};
|
|
33
|
+
options.EnrichWithHttpResponseMessage = (activity, response) =>
|
|
34
|
+
{
|
|
35
|
+
activity.SetTag("http.response.content_length", response.Content.Headers.ContentLength);
|
|
36
|
+
};
|
|
37
|
+
options.FilterHttpRequestMessage = (request) =>
|
|
38
|
+
{
|
|
39
|
+
// Suppress health check calls
|
|
40
|
+
return request.RequestUri?.AbsolutePath != "/health";
|
|
41
|
+
};
|
|
42
|
+
options.RecordException = true;
|
|
43
|
+
}));
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## HTTP Client options
|
|
47
|
+
|
|
48
|
+
| Option | Default | Description |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `EnrichWithHttpRequestMessage` | `null` | `Action<Activity, HttpRequestMessage>` to add tags from the request. |
|
|
51
|
+
| `EnrichWithHttpResponseMessage` | `null` | `Action<Activity, HttpResponseMessage>` to add tags from the response. |
|
|
52
|
+
| `EnrichWithException` | `null` | `Action<Activity, Exception>` to enrich on failure. |
|
|
53
|
+
| `FilterHttpRequestMessage` | `null` | `Func<HttpRequestMessage, bool>` — return `false` to suppress span. |
|
|
54
|
+
| `RecordException` | `false` | Record exception events on the span. |
|
|
55
|
+
|
|
56
|
+
## HTTP Server (ASP.NET Core) enrichment
|
|
57
|
+
|
|
58
|
+
```csharp
|
|
59
|
+
using OpenTelemetry.Trace;
|
|
60
|
+
|
|
61
|
+
builder.Services.ConfigureOpenTelemetryTracerProvider(tracing =>
|
|
62
|
+
tracing.AddAspNetCoreInstrumentation(options =>
|
|
63
|
+
{
|
|
64
|
+
options.EnrichWithHttpRequest = (activity, request) =>
|
|
65
|
+
{
|
|
66
|
+
activity.SetTag("http.request.header.user-agent", request.Headers["User-Agent"].ToString());
|
|
67
|
+
};
|
|
68
|
+
options.EnrichWithHttpResponse = (activity, response) =>
|
|
69
|
+
{
|
|
70
|
+
activity.SetTag("http.response.custom_header", response.Headers["X-Custom"].ToString());
|
|
71
|
+
};
|
|
72
|
+
options.Filter = (httpContext) =>
|
|
73
|
+
{
|
|
74
|
+
// Suppress /health and /metrics endpoints
|
|
75
|
+
return httpContext.Request.Path != "/health"
|
|
76
|
+
&& httpContext.Request.Path != "/metrics";
|
|
77
|
+
};
|
|
78
|
+
options.RecordException = true;
|
|
79
|
+
}));
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## HTTP Server options
|
|
83
|
+
|
|
84
|
+
| Option | Default | Description |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| `EnrichWithHttpRequest` | `null` | `Action<Activity, HttpRequest>` to add tags from the request. |
|
|
87
|
+
| `EnrichWithHttpResponse` | `null` | `Action<Activity, HttpResponse>` to add tags from the response. |
|
|
88
|
+
| `EnrichWithException` | `null` | `Action<Activity, Exception>` to enrich on failure. |
|
|
89
|
+
| `Filter` | `null` | `Func<HttpContext, bool>` — return `false` to suppress span. |
|
|
90
|
+
| `RecordException` | `false` | Record exception events on the span. |
|
|
91
|
+
|
|
92
|
+
## Semantic conventions (auto-populated)
|
|
93
|
+
|
|
94
|
+
| Attribute | Source |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `http.request.method` | `GET`, `POST`, etc. |
|
|
97
|
+
| `url.full` | Full URL (client) |
|
|
98
|
+
| `url.path` | Path (server) |
|
|
99
|
+
| `http.response.status_code` | `200`, `404`, etc. |
|
|
100
|
+
| `server.address` | Target host (client) |
|
|
101
|
+
| `network.protocol.version` | `1.1`, `2` |
|
|
102
|
+
| `http.route` | Route template (server) |
|
|
103
|
+
|
|
104
|
+
## Notes
|
|
105
|
+
|
|
106
|
+
- Both client and server instrumentation are **already active** in AI 3.x setups. Adding the packages explicitly is only needed to access the `options` overload for enrichment/filtering.
|
|
107
|
+
- Enrichment callbacks run synchronously on the hot path — keep them lightweight.
|
|
108
|
+
- `Filter` on the server side is the recommended way to suppress health check / readiness probe spans (instead of a custom processor).
|
|
109
|
+
- **Non-DI usage:** Use `config.ConfigureOpenTelemetryBuilder(otel => otel.WithTracing(t => t.AddHttpClientInstrumentation(...)))` on `TelemetryConfiguration`. See TelemetryClient.md.
|