Skip to content

Commit 05bc72c

Browse files
authored
Add documentation for additional steps for activating ASP.NET and Owin instrumentation (#28)
* Add instrumentation specific steps * Add TOC for configuration * Markdown lint
1 parent 8da0f8e commit 05bc72c

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,20 @@ specifies what instrumentations are included in the base package.
8888

8989
## Configuration
9090

91+
* [Configuring metrics](#configuring-metrics)
92+
* [Configuring logs](#configuring-logs)
93+
* [Configuring traces](#configuring-traces)
94+
* [Exporter configuration](#exporter-configuration)
95+
* [Sending to an agent or collector via OTLP](#sending-to-an-agent-or-collector-via-otlp)
96+
* [Sending data directly to Grafana Cloud via OTLP](#sending-data-directly-to-grafana-cloud-via-otlp)
97+
* [Instrumentation configuration](#instrumentation-configuration)
98+
* [Disabling instrumentations](#disabling-instrumentations)
99+
* [Adding instrumentations](#adding-instrumentations)
100+
* [Extra steps to activate specific instrumentations](#extra-steps-to-activate-specific-instrumentations)
101+
* [ASP.NET (`AspNet`)](#aspnet-aspnet)
102+
* [OWIN (`Owin`)](#owin-owin)
103+
* [Supported environment variables](#supported-environment-variables)
104+
91105
### Configuring metrics
92106

93107
The distribution can be initialized for metrics by calling the `UseGrafana`
@@ -257,6 +271,50 @@ using var tracerProvider = Sdk.CreateTracerProviderBuilder()
257271
This way, any other instrumentation library can be added according the
258272
documentation provided with it.
259273

274+
#### Extra steps to activate specific instrumentations
275+
276+
##### ASP.NET (`AspNet`)
277+
278+
To active ASP.NET instrumentation, it is necessary to add an additional HTTP
279+
module `OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule` to the web
280+
server. This module is shipped as dependency of the
281+
`OpenTelemetry.Instrumentation.AspNet` package. When using the IIS web server,
282+
the following changes to `Web.config` are required.
283+
284+
```xml
285+
<system.webServer>
286+
<modules>
287+
<add name="TelemetryHttpModule"
288+
type="OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule,
289+
OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule"
290+
preCondition="integratedMode,managedHandler" />
291+
</modules>
292+
</system.webServer>
293+
```
294+
295+
Refer to the [upstream
296+
documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.AspNet#step-2-modify-webconfig)
297+
for further details.
298+
299+
##### OWIN (`Owin`)
300+
301+
To activate OWIN instrumentation, it is necessary to register the OpenTelemetry
302+
middleware by calling `UseOpenTelemetry` on the `IAppBuilder`. This should be
303+
done before registering any other middleware.
304+
305+
```csharp
306+
using var host = WebApp.Start(
307+
"http://localhost:9000",
308+
appBuilder =>
309+
{
310+
appBuilder.UseOpenTelemetry();
311+
});
312+
```
313+
314+
Refer to the [upstream
315+
documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.Owin#step-2-configure-owin-middleware)
316+
for further details.
317+
260318
### Supported environment variables
261319

262320
| Variable | Example value | Description |

0 commit comments

Comments
 (0)