# WithOtlpExporter

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`ResourceWithEnvironment`](/reference/api/go/aspire.hosting/resourcewithenvironment.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Configures OTLP telemetry export

## Definition

```go
func (ResourceWithEnvironment) WithOtlpExporter(options ...*WithOtlpExporterOptions) ResourceWithEnvironment
```

## Parameters

- `options` (`...*WithOtlpExporterOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithOtlpExporterOptions` argument.

- `Protocol` ([`*OtlpProtocol`](/reference/api/go/aspire.hosting/otlpprotocol.md))

## Returns

[`ResourceWithEnvironment`](/reference/api/go/aspire.hosting/resourcewithenvironment.md)

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`CSharpAppResource`](/reference/api/go/aspire.hosting/csharpappresource.md)
- [`ContainerResource`](/reference/api/go/aspire.hosting/containerresource.md)
- [`DotnetToolResource`](/reference/api/go/aspire.hosting/dotnettoolresource.md)
- [`ExecutableResource`](/reference/api/go/aspire.hosting/executableresource.md)
- [`ProjectResource`](/reference/api/go/aspire.hosting/projectresource.md)
