-
Notifications
You must be signed in to change notification settings - Fork 494
Closed
Labels
area:exporter:otlpOpenTelemetry Protocol (OTLP) ExporterOpenTelemetry Protocol (OTLP) ExporterbugSomething isn't workingSomething isn't workingdo-not-stalespec-complianceNot compliant to OpenTelemetry specsNot compliant to OpenTelemetry specs
Description
malff@localhost.localdomain:otlp> pwd
/home/malff/CODE/MARC_GITHUB/build-otelcpp-2/examples/otlp
malff@localhost.localdomain:otlp> env | grep OTLP
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=POISON
malff@localhost.localdomain:otlp> ./example_otlp_metric_grpc
[Error] File: /home/malff/CODE/MARC_GITHUB/opentelemetry-cpp/exporters/otlp/src/otlp_grpc_metric_exporter.cc:75[OTLP METRIC GRPC Exporter] Export() failed: DNS resolution failed for POISON:80: C-ares status is not ARES_SUCCESS qtype=AAAA name=POISON is_balancer=0: Domain name not found
Here, example_otlp_metric_grpc
is expected to use environment variable OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
.
Instead, it uses environment variable OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
, as proven with the poisoned value set.
The root cause is:
struct OtlpGrpcMetricExporterOptions : public OtlpGrpcExporterOptions
While this sounds like code reuse at first read, this inheritance is flawed:
- OtlpGrpcExporterOptions is poorly named, it is dedicated to the trace signal
- the constructor for OtlpGrpcMetricExporterOptions will lookup
_TRACES_
environment variables, instead of_METRICS_
Logs are also affected:
OtlpGrpcLogRecordExporterFactory::Create(
const OtlpGrpcExporterOptions &options)
The options passed should be specific to the log signal, here the trace options are used instead.
OtlpGrpcExporterOptions
should really be renamed to avoid causing confusion here.
lalitb
Metadata
Metadata
Assignees
Labels
area:exporter:otlpOpenTelemetry Protocol (OTLP) ExporterOpenTelemetry Protocol (OTLP) ExporterbugSomething isn't workingSomething isn't workingdo-not-stalespec-complianceNot compliant to OpenTelemetry specsNot compliant to OpenTelemetry specs