Introduction
In this final lesson, we will move beyond viewing telemetry only on a development machine and connect our application to a production-like observability flow. The application will send trace and metric data through OTLP to the OpenTelemetry Collector. The Collector will route each signal to an appropriate backend, Jaeger will provide distributed trace analysis, Grafana will provide metric dashboards and correlation views, and Seq will make structured logs searchable by TraceId or Correlation ID.
The goal is not to treat every tool as one combined product. A clearer architecture assigns a focused responsibility to each component:
- ASP.NET Core: produces telemetry.
- OTLP: transports telemetry using a standard protocol.
- OpenTelemetry Collector: receives, processes, enriches, and routes telemetry.
- Jaeger: visualizes traces and service-to-service calls.
- Grafana: provides metric dashboards, queries, and correlation links.
- Seq: makes structured logs and trace context searchable.
1. Building the target architecture
For this lesson, assume the application runs on the host machine or in a separate container. Services inside the Docker Compose network communicate by service name. The application will connect to the Collector at otel-collector:4317 using OTLP/gRPC. The Collector will send traces to Jaeger, metrics to Prometheus, and logs to Seq.
Jaeger v2 is based on the OpenTelemetry Collector architecture and provides a single container image. This makes it convenient for a local lab: we can run one Jaeger service instead of separate collector and query containers. Production deployments still require separate planning for persistent storage, authentication, TLS, retention, and high availability.
2. Docker Compose components
Create a docker-compose.yml file in the project root:
services:
otel-collector:
image: otel/opentelemetry-collector-contrib:latest
command: ["--config=/etc/otelcol-contrib/config.yaml"]
volumes:
- ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml:ro
ports:
- "4317:4317"
- "4318:4318"
- "8889:8889"
- "13133:13133"
depends_on:
- jaeger
- prometheus
- seq
jaeger:
image: cr.jaegertracing.io/jaegertracing/jaeger:2.22.0
ports:
- "16686:16686"
- "4317"
- "4318"
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
ports:
- "9090:9090"
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
depends_on:
- prometheus
- jaeger
seq:
image: datalust/seq:latest
environment:
ACCEPT_EULA: "Y"
ports:
- "5341:80"The latest tag is convenient for education and local experiments, but production deployments should use verified and pinned versions. Exposing every port on the host should also be limited to the required development or administration scenarios. In production, network access to the Collector, Jaeger, Prometheus, Grafana, and Seq should be controlled with TLS, reverse proxies, and access policies.
3. Configuring Collector pipelines
The Collector follows a receiver → processor → exporter model. A receiver accepts data, processors batch or enrich it, and exporters send it to a backend. Create otel-collector-config.yaml:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
processors:
memory_limiter:
check_interval: 1s
limit_mib: 400
batch:
send_batch_size: 512
timeout: 5s
exporters:
otlp/jaeger:
endpoint: jaeger:4317
tls:
insecure: true
prometheus:
endpoint: 0.0.0.0:8889
otlphttp/seq:
endpoint: http://seq/ingest/otlp
extensions:
health_check:
endpoint: 0.0.0.0:13133
service:
extensions: [health_check]
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlp/jaeger]
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [prometheus]
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
exporters: [otlphttp/seq]The exporter endpoint for Jaeger can vary with the Jaeger version and storage configuration. Always verify the current receiver settings and inspect Collector logs. For Seq, do not append /v1/logs to the endpoint; the Collector adds the required OTLP path automatically.
4. Connecting Prometheus and Grafana
The Prometheus exporter exposes metric data on port 8889 so that Prometheus can scrape it. Create prometheus.yml:
global:
scrape_interval: 15s
scrape_configs:
- job_name: "otel-collector"
static_configs:
- targets: ["otel-collector:8889"]Start the services:
docker compose up -d
docker compose ps
docker compose logs otel-collectorOpen Grafana at http://localhost:3000. Add a Prometheus data source with the URL http://prometheus:9090. The host machine's localhost is not the same location as localhost inside a container; Grafana must reach Prometheus through the Compose service name.
When adding the Jaeger data source, use http://jaeger:16686. In Grafana Explore, select Jaeger and inspect services, trace durations, and span trees. Grafana's Jaeger data source supports configuration for trace-to-logs and trace-to-metrics links. Seq is not used here as Grafana's primary trace or metric data source; it remains a dedicated structured-log search interface.
5. Connecting ASP.NET Core to the Collector
Keep the tracing and metrics registrations built in earlier lessons. Make sure the OTLP exporter package is installed:
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocolIn Program.cs, read the endpoint from configuration:
var builder = WebApplication.CreateBuilder(args);
var otlpEndpoint = builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]
?? "http://localhost:4317";
builder.Services.AddOpenTelemetry()
.ConfigureResource(resource => resource.AddService("orders-api"))
.WithTracing(tracing =>
{
tracing.AddAspNetCoreInstrumentation();
tracing.AddHttpClientInstrumentation();
tracing.AddSource("Orders.Api");
tracing.AddOtlpExporter(options =>
{
options.Endpoint = new Uri(otlpEndpoint);
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc;
});
})
.WithMetrics(metrics =>
{
metrics.AddAspNetCoreInstrumentation();
metrics.AddRuntimeInstrumentation();
metrics.AddMeter("Orders.Api");
metrics.AddOtlpExporter(options =>
{
options.Endpoint = new Uri(otlpEndpoint);
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc;
});
});If the application runs on the host, localhost:4317 may be correct. If the application also runs inside the Compose network, use http://otel-collector:4317. Confusing these two execution environments is one of the most common connection errors.
Ensure that the Serilog enrichment created in earlier lessons continues to add TraceId to log events. When an Activity is active during a request, TraceId and SpanId should become structured JSON properties. This makes Seq queries much easier and keeps log records connected to the current trace.
6. Correlating logs and traces in Seq
Create a deliberately visible log event in an endpoint:
using System.Diagnostics;
app.MapGet("/orders/{id:int}", async (int id, ILogger<Program> logger) =>
{
var traceId = Activity.Current?.TraceId.ToString();
logger.LogInformation("Order lookup started for {OrderId} with TraceId {TraceId}", id, traceId);
if (id == 42)
{
logger.LogWarning("Slow order path selected for {OrderId}", id);
await Task.Delay(1500);
}
return Results.Ok(new { id, traceId });
});Use the TraceId returned by the request to locate the trace in Jaeger. In Seq, search with @TraceId = 'trace-id-value', or use TraceId = 'trace-id-value' depending on the property structure generated by your logger. If OTLP logs are flowing into Seq, the event details include trace navigation for finding other events in the same trace or span.
Correlation ID can remain a separate business or request identifier. However, TraceId is the technical identifier naturally propagated through a distributed trace. Keeping both fields is useful when an external request or business operation must be followed even when no complete trace is available.
7. Investigating distributed traces in Jaeger
- Start the application and send several normal requests.
- Create an HttpClient call or service call so that a child span is produced.
- Open the Jaeger UI at
http://localhost:16686. - Select the
orders-apiservice. - Search recent traces and open the slowest one.
- Compare the root span, HTTP client span, and manual span durations.
The total duration of a trace does not always equal the duration of its longest child span. Waiting, serial operations, parallel tasks, and code executed outside a span can explain the difference. Also remember that an HTTP status code alone does not describe the whole failure. Evaluate exception events, span status, and log context together.
8. Creating Grafana metric panels
Create a dashboard in Grafana and select Prometheus as the data source. Build one panel for request rate, one for error rate, and one for latency distribution. Metric names can vary with the versions of .NET and OpenTelemetry packages, so first inspect the available names in Explore. For application-specific meters, use low-cardinality metrics such as orders_created_total or orders_request_duration_ms.
Do not use user IDs, tenant IDs, random TraceIds, or unbounded request values as metric labels. These values are useful in logs and traces, but using them as metric labels can create an uncontrolled number of time series. Metrics should show overall system behavior, Jaeger should explain the journey of a particular request, and Seq should provide detailed event context.
9. Diagnosing intentional failures and slow requests
Prepare two test scenarios. In the first, throw an exception when id == 500. In the second, add a 1500-millisecond delay when id == 42.
- Execute each request several times.
- Check the change in error and latency panels in Grafana.
- Open the slow trace in Jaeger and identify the span where the delay occurs.
- Search Seq for the same TraceId and inspect warning or error events.
- Compare the root span status, exception message, and Correlation ID.
This demonstrates the practical value of observability. A metric shows how widespread the problem is, a trace shows where the delay occurs, and a log explains the event's context and cause. In most real incidents, one signal alone is not sufficient.
10. Common mistakes
- Using the wrong hostname: inside containers, use the Compose service name instead of
localhost. - Mixing ports and protocols: use 4317 for gRPC and 4318 for HTTP, and match exporter and receiver protocols.
- Ignoring TLS: local insecure connections may require an insecure setting; production connections should use TLS.
- Forgetting the pipeline: defining a receiver or exporter is not enough; it must be referenced by the correct pipeline.
- Building dashboards before verifying data: check Collector logs, then the backend, and only then the Grafana query.
- Logging sensitive data: never log tokens, passwords, personal data, or complete payment information.
- Skipping sampling and retention planning: storing every trace forever can create cost and performance problems.
- Relying only on health checks: a running Collector does not prove that every exporter is successfully delivering data.
11. Short practice exercise
Start the Compose stack and complete the following tasks:
- Send traces and metrics from an ASP.NET Core endpoint through OTLP.
- Verify that the trace, metric, and log pipelines are active in the Collector.
- Display at least one root span and one child span in Jaeger.
- Create two Grafana panels for request count and error rate.
- Find at least two log events in Seq using the same TraceId.
- Run the slow-request scenario and explain which span contains the delay.
Conclusion
In this lesson, we connected the telemetry flow that starts in ASP.NET Core to Jaeger, Prometheus, Grafana, and Seq through OTLP and the OpenTelemetry Collector. The Collector separated application code from backend-specific details and allowed the same signal to be routed to different destinations. Jaeger showed the timeline of service calls, Grafana showed system behavior over time, and Seq provided detailed structured-log context.
Production observability succeeds not merely because tools are running, but because each signal is matched to the right question: How often and how widely is the problem occurring? Where is the trace becoming slow? What context and cause does the log event provide? When TraceId, SpanId, and Correlation ID are propagated consistently, these questions become parts of one practical diagnostic workflow.
Sources
- https://opentelemetry.io/docs/collector/architecture/
- https://opentelemetry.io/docs/collector/install/docker/
- https://www.jaegertracing.io/docs/
- https://www.jaegertracing.io/download/
- https://grafana.com/docs/grafana/latest/datasources/jaeger/configure/
- https://docs.datalust.co/docs/ingestion-with-opentelemetry
- https://learn.microsoft.com/en-us/dotnet/core/diagnostics/observability-with-otel