Opentelementry dotnet and OTEL not work properly
See original GitHub issueHow to configure OTEL collector and agent?
I’m study otel and opentelemetry-dotnet. I created my sample here but not work properly.
I have created .net registration like this:
services.AddOpenTelemetryTracing((builder) => builder
.AddSource("Sample")
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("SampleApi").AddTelemetrySdk())
.AddSqlClientInstrumentation(s =>
{
s.SetDbStatementForStoredProcedure = true;
s.SetDbStatementForText = true;
s.RecordException = true;
})
.AddAspNetCoreInstrumentation(options =>
{
options.Filter = (req) => !req.Request.Path.ToUriComponent().Contains("swagger", StringComparison.OrdinalIgnoreCase);
})
.AddHttpClientInstrumentation()
.AddConsoleExporter()
.AddAzureMonitorTraceExporter(o =>
{
o.ConnectionString = "InstrumentationKey=61ac831c-6667-401f-ba62-962b20f604a1;IngestionEndpoint=https://westeurope-2.in.applicationinsights.azure.com/";
})
.AddOtlpExporter(otlpOptions =>
{
otlpOptions.Endpoint = new Uri("http://otel-collector:4317");
})
);
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
I have set docker-compose like this:
otel-collector:
container_name: otel-collector
image: otel/opentelemetry-collector
volumes:
- ./../config/otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "1888:1888" # pprof extension
- "8888:8888" # Prometheus metrics exposed by the collector
- "8889:8889" # Prometheus exporter metrics
- "13133:13133" # health_check extension
- "4317" # OTLP gRPC receiver
- "55670:55679" # zpages extension
depends_on:
- zipkin
otel-agent:
container_name: otel-agent
image: otel/opentelemetry-collector
command: ["--config=/etc/otel-agent-config.yaml", "${OTELCOL_ARGS}"]
volumes:
- ./../config/otel-agent-config.yaml:/etc/otel-agent-config.yaml
ports:
- "8887:8888" # Prometheus metrics exposed by the agent
- "14250" # Jaeger grpc receiver
- "14268" # Jaeger http thrift receiver
- "55678" # OpenCensus receiver
- "4317" # OTLP gRPC receiver
- "9411" # Zipkin receiver
- "1777:1777" # pprof extension
- "55679:55679" # zpages extension
- "13133" # health_check
depends_on:
- otel-collector
Agent config:
receivers:
otlp:
protocols:
grpc:
http:
zipkin:
exporters:
otlp:
endpoint: otel-collector:4317
insecure: true
logging:
loglevel: debug
processors:
batch:
extensions:
health_check:
pprof:
endpoint: 0.0.0.0:1777
zpages:
endpoint: 0.0.0.0:55679
service:
extensions: [health_check, pprof, zpages]
pipelines:
traces:
receivers: [otlp, zipkin]
processors: [batch]
exporters: [otlp, logging]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlp, logging]
Collector config:
receivers:
otlp:
protocols:
grpc:
http:
exporters:
logging:
loglevel: debug
zipkin:
endpoint: "http://zipkin:9411/api/v2/spans"
format: proto
newrelic:
apikey: NRAK-LJ
timeout: 30s
traces:
host_override: trace-api.eu.newrelic.com
timeout: 20s
metrics:
host_override: metric-api.eu.newrelic.com
logs:
host_override: log-api.eu.newrelic.com
processors:
batch:
extensions:
health_check:
pprof:
endpoint: :1888
zpages:
endpoint: :55679
service:
extensions: [pprof, zpages, health_check]
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [logging, zipkin, newrelic]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [logging, zipkin, newrelic]
if I test my app with Azure Monitor, Jeager and Zipkin, they log correctly, but if I want to use collector and then attach it to exporter, no information appears.
Can anyone help me? Thanks a lot
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Metrics not sent from an ASP.NET application with RC9
There is a regression in the latest packages ("RC9"), the metrics are not sent anymore by an ASP.NET application using AddOpenTelemetryMetrics ...
Read more >OpenTelemetry dotnet otel configuration
I tried github sample but don't work properly. My docker-compose: otel-collector: container_name: otel-collector image: otel/opentelemetry- ...
Read more >net api tracing with opentelemetry
If the collector decides to not collect the parent trace, your own service's trace won't be collected either. Try adding another exporter, eg...
Read more >NET Observability with OpenTelemetry
When you run an application, you want to know how well the app is performing and to detect potential problems before they become...
Read more >Lack of content on .NET and OpenTelemetry : r/dotnet
NET with OTel" and I noticed a lack of content. There are some few podcasts and blog posts by well-known folks in the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Metrics not work with zipkin and Jeager. @alefcarlos
.NET otlp-exporter only supports grpc for now. So use this receiver-config in collector:
This opens up grpc-listener on port
4317
. So the service (using the endpointhttp://otel-collector:4317
) should now be able to connect to this.