Skip to content

Commit

Permalink
Add documentation for additional steps for activating ASP.NET and Owi…
Browse files Browse the repository at this point in the history
…n instrumentation (#28)

* Add instrumentation specific steps

* Add TOC for configuration

* Markdown lint
  • Loading branch information
pyohannes committed Oct 27, 2023
1 parent 8da0f8e commit 05bc72c
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ specifies what instrumentations are included in the base package.

## Configuration

* [Configuring metrics](#configuring-metrics)
* [Configuring logs](#configuring-logs)
* [Configuring traces](#configuring-traces)
* [Exporter configuration](#exporter-configuration)
* [Sending to an agent or collector via OTLP](#sending-to-an-agent-or-collector-via-otlp)
* [Sending data directly to Grafana Cloud via OTLP](#sending-data-directly-to-grafana-cloud-via-otlp)
* [Instrumentation configuration](#instrumentation-configuration)
* [Disabling instrumentations](#disabling-instrumentations)
* [Adding instrumentations](#adding-instrumentations)
* [Extra steps to activate specific instrumentations](#extra-steps-to-activate-specific-instrumentations)
* [ASP.NET (`AspNet`)](#aspnet-aspnet)
* [OWIN (`Owin`)](#owin-owin)
* [Supported environment variables](#supported-environment-variables)

### Configuring metrics

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

#### Extra steps to activate specific instrumentations

##### ASP.NET (`AspNet`)

To active ASP.NET instrumentation, it is necessary to add an additional HTTP
module `OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule` to the web
server. This module is shipped as dependency of the
`OpenTelemetry.Instrumentation.AspNet` package. When using the IIS web server,
the following changes to `Web.config` are required.

```xml
<system.webServer>
<modules>
<add name="TelemetryHttpModule"
type="OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule,
OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule"
preCondition="integratedMode,managedHandler" />
</modules>
</system.webServer>
```

Refer to the [upstream
documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.AspNet#step-2-modify-webconfig)
for further details.

##### OWIN (`Owin`)

To activate OWIN instrumentation, it is necessary to register the OpenTelemetry
middleware by calling `UseOpenTelemetry` on the `IAppBuilder`. This should be
done before registering any other middleware.

```csharp
using var host = WebApp.Start(
"http://localhost:9000",
appBuilder =>
{
appBuilder.UseOpenTelemetry();
});
```

Refer to the [upstream
documentation](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.Owin#step-2-configure-owin-middleware)
for further details.

### Supported environment variables

| Variable | Example value | Description |
Expand Down

0 comments on commit 05bc72c

Please sign in to comment.