OTLP Collector not collecting traces of .NET application

464 views Asked by At

I'm currently trying to setup an OTLP collector instance within Docker on my local machine to collect traces emitted by a project running on .NET6. The issue is, that while I can create traces (I can see them using the ConsoleExporter) and can get my collector running, I am unable to send any Traces to the collector from within my application. I can curl "http://localhost:4317" but when trying to send traces there is nothing to be seen in the collector.

When investigating with zpages I can also see, that no traces are being received by the collector. If I run the entire thing with the same configuration in a kubernetes cluster however, it works. Of course in that case the endpoint "localhost" is changed to the respective pod-name.

Aplication instrumentation

services.AddOpenTelemetryTracing(builder => 
{
builder.SetResourceBuilder(
    ResourceBuilder.CreateDefault()
    .AddService(serviceName: serviceName))
.AddAspNetCoreInstrumentation()
.AddOtlpExporter(config =>
{
    config.Endpoint = new Uri("http://localhost:4317");
});

Collector Configuration

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:

processors:
  batch:

exporters:
  logging:
    loglevel: debug

extensions:
  health_check:
  zpages:
    endpoint: 0.0.0.0:55679

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [otlp, logging]
  extensions: [health_check, zpages]

Container Configuration

otlp-collector:
  image: otel/opentelemetry-collector:0.55.0
  container_name: otlp-collector
  command: ["--config=/etc/otel-collector-config.yml"]
  volumes:
    - ./otel-collector-config.yml:/etc/otel-collector-config.yml
  ports:
    - "4317:4317"
    - "55679:55679"

Edit: The application is running on my machine, not inside the Docker.

0

There are 0 answers