Otel and dotnet not work #3367
Answered
by
bogdandrutu
andreatosato
asked this question in
Q&A
-
How to configure OTEL collector and agent?I'm study otel and opentelemetry-dotnet. 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? |
Beta Was this translation helpful? Give feedback.
Answered by
bogdandrutu
Jun 30, 2021
Replies: 1 comment 2 replies
-
@open-telemetry/dotnet-approvers do you have any idea about this? |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
bogdandrutu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@open-telemetry/dotnet-approvers do you have any idea about this?