Skip to content

Commit

Permalink
restore section
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-hensley committed Sep 18, 2024
1 parent 804500e commit 8132579
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,37 @@ populated with a comma-separated list of
export GRAFANA_DOTNET_DISABLE_INSTRUMENTATIONS="Process,NetRuntime"
```

### Adding instrumentations not supported by the distribution

Instrumentations not included in the distribution can easily be added by
extension methods on the tracer and meter provider.

For example, if it is desired to use the `EventCounters` instrumentation, which is
not included in the [full package](./installation.md#install-the-full-package-with-all-available-instrumentations),
one install the `EventCounters` instrumentation library along with the base
package.

```sh
dotnet add package --prerelease Grafana.OpenTelemetry.Base
dotnet add package OpenTelemetry.Instrumentation.EventCounters --prerelease
```

Then, the `EventCounters` instrumentation can be enabled via the [`AddEventCountersInstrumentation`](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.EventCounters#step-2-enable-eventcounters-instrumentation)
extension method, alongside the `UseGrafana` method.

```csharp
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.UseGrafana()
.AddEventCountersInstrumentation(options => {
options.RefreshIntervalSecs = 1;
options.AddEventSources("MyEventSource");
})
.Build();
```

This way, any other instrumentation library [not supported by the distribution](./supported-instrumentations.md)
can be added according to the documentation provided with it.

## Resource detector configuration

### Specifying resource detectors
Expand Down

0 comments on commit 8132579

Please sign in to comment.