# OpenTelemetryCollectorResource

- Module: [CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector](/reference/api/typescript/communitytoolkit.aspire.hosting.opentelemetrycollector.md)
- Version: `13.4.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire)

Represents an OpenTelemetry Collector container resource.

## Definition

```typescript
interface OpenTelemetryCollectorResource
  extends IComputeResource,
    IResource,
    IResourceWithArgs,
    IResourceWithEndpoints,
    IResourceWithEnvironment,
    IResourceWithProbes,
    IResourceWithWaitSupport {
  readonly grpcEndpoint: EndpointReference;
  readonly httpEndpoint: EndpointReference;
  withAppForwarding(): OpenTelemetryCollectorResource;
  withConfig(configPath: string): OpenTelemetryCollectorResource;
}
```

## Properties

- `grpcEndpoint`: `EndpointReference` `get` -- Gets the gRPC endpoint for the collector.
- `httpEndpoint`: `EndpointReference` `get` -- Gets the HTTP endpoint for the collector.

## Methods

- [withAppForwarding](/reference/api/typescript/communitytoolkit.aspire.hosting.opentelemetrycollector/opentelemetrycollectorresource/withappforwarding.md) -- `method` -- Configures all compatible resources in the application to forward telemetry to this collector.
    ```typescript
  withAppForwarding(): OpenTelemetryCollectorResource
  ```
- [withConfig](/reference/api/typescript/communitytoolkit.aspire.hosting.opentelemetrycollector/opentelemetrycollectorresource/withconfig.md) -- `method` -- Adds a configuration file to the collector resource.
    ```typescript
  withConfig(configPath: string): OpenTelemetryCollectorResource
  ```
