Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EXPORTER] OTLP/GRPC Exporter options for metrics/logs do not honor _METRICS_/_LOGS_ environment variables. #1845

Closed
marcalff opened this issue Dec 6, 2022 · 3 comments · Fixed by #2388
Assignees
Labels
area:exporter:otlp OpenTelemetry Protocol (OTLP) Exporter bug Something isn't working do-not-stale spec-compliance Not compliant to OpenTelemetry specs

Comments

@marcalff
Copy link
Member

marcalff commented Dec 6, 2022

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.

@marcalff marcalff added the bug Something isn't working label Dec 6, 2022
@marcalff marcalff self-assigned this Dec 6, 2022
@marcalff marcalff added the area:exporter:otlp OpenTelemetry Protocol (OTLP) Exporter label Dec 6, 2022
@marcalff marcalff added the spec-compliance Not compliant to OpenTelemetry specs label Dec 13, 2022
@marcalff marcalff changed the title [OTLP EXPORTER] Exporter options for metrics/logs to not honor _METRICS_/_LOGS_ environment variables. [OTLP EXPORTER] Exporter options for metrics/logs do not honor _METRICS_/_LOGS_ environment variables. Jan 19, 2023
@github-actions
Copy link

This issue was marked as stale due to lack of activity.

@lalitb
Copy link
Member

lalitb commented Mar 21, 2023

@marcalff - Is this closed with #1982

@marcalff
Copy link
Member Author

@lalitb - No, this issue is still opened.

marcalff added a commit to marcalff/opentelemetry-cpp that referenced this issue Oct 28, 2023
@marcalff marcalff changed the title [OTLP EXPORTER] Exporter options for metrics/logs do not honor _METRICS_/_LOGS_ environment variables. [OTLP EXPORTER] GRPC Exporter options for metrics/logs do not honor _METRICS_/_LOGS_ environment variables. Oct 29, 2023
@marcalff marcalff changed the title [OTLP EXPORTER] GRPC Exporter options for metrics/logs do not honor _METRICS_/_LOGS_ environment variables. [EXPORTER] OTLP/GRPC Exporter options for metrics/logs do not honor _METRICS_/_LOGS_ environment variables. Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:exporter:otlp OpenTelemetry Protocol (OTLP) Exporter bug Something isn't working do-not-stale spec-compliance Not compliant to OpenTelemetry specs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants