Skip to content

Commit 8132579

Browse files
committed
restore section
1 parent 804500e commit 8132579

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

docs/configuration.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,37 @@ populated with a comma-separated list of
175175
export GRAFANA_DOTNET_DISABLE_INSTRUMENTATIONS="Process,NetRuntime"
176176
```
177177

178+
### Adding instrumentations not supported by the distribution
179+
180+
Instrumentations not included in the distribution can easily be added by
181+
extension methods on the tracer and meter provider.
182+
183+
For example, if it is desired to use the `EventCounters` instrumentation, which is
184+
not included in the [full package](./installation.md#install-the-full-package-with-all-available-instrumentations),
185+
one install the `EventCounters` instrumentation library along with the base
186+
package.
187+
188+
```sh
189+
dotnet add package --prerelease Grafana.OpenTelemetry.Base
190+
dotnet add package OpenTelemetry.Instrumentation.EventCounters --prerelease
191+
```
192+
193+
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)
194+
extension method, alongside the `UseGrafana` method.
195+
196+
```csharp
197+
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
198+
.UseGrafana()
199+
.AddEventCountersInstrumentation(options => {
200+
options.RefreshIntervalSecs = 1;
201+
options.AddEventSources("MyEventSource");
202+
})
203+
.Build();
204+
```
205+
206+
This way, any other instrumentation library [not supported by the distribution](./supported-instrumentations.md)
207+
can be added according to the documentation provided with it.
208+
178209
## Resource detector configuration
179210

180211
### Specifying resource detectors

0 commit comments

Comments
 (0)