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

Add Warning for Endpoint Mismatch in OTLP GRPC Exporter #3619

Open
gshiva opened this issue Jan 6, 2024 · 0 comments · May be fixed by #3620
Open

Add Warning for Endpoint Mismatch in OTLP GRPC Exporter #3619

gshiva opened this issue Jan 6, 2024 · 0 comments · May be fixed by #3620

Comments

@gshiva
Copy link
Contributor

gshiva commented Jan 6, 2024

While trying to initialize a HTTP exporter, I mistakenly passed a GRPC one which led to the silent truncation of the endpoint value. This caused confusion and resulted in hours of debugging. The source of the confusion was this import line:

Instead of

from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter

I copy pasted from the commonly available examples, which use:

from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter

This issue might be a common occurrence for newcomers, as almost all the examples use the GRPC exporter. To prevent this from happening in the future, I propose adding a warning message in the OTLP GRPC Exporter when there is a mismatch between the configured endpoint and the provided endpoint. This would provide clear, actionable feedback to the user and improve the overall user experience.

Here’s the proposed change:

if parsed_url.netloc:
    self._endpoint = parsed_url.netloc
    if parsed_url.path:
        logger.warning(f"Endpoint set to {self._endpoint}, which differs from the provided endpoint {endpoint}. If you're trying to configure a HTTP endpoint, please ensure you're using the correct exporter.")

This change replaces the existing code:

if parsed_url.netloc:
    self._endpoint = parsed_url.netloc
gshiva added a commit to gshiva/opentelemetry-python that referenced this issue Jan 6, 2024
This commit introduces a warning message in the OTLP GRPC Exporter when there is a mismatch between the configured endpoint and the provided endpoint. This change aims to prevent silent truncation of the endpoint value, which could lead to confusion and time-consuming debugging for users trying to configure a HTTP exporter but mistakenly passing a GRPC one. This issue might be a common occurrence for newcomers, as almost all the examples use the GRPC exporter. The warning message provides clear, actionable feedback to the user, improving the overall user experience.

Addresses open-telemetry#3619
gshiva added a commit to gshiva/opentelemetry-python that referenced this issue Jan 6, 2024
This commit introduces a warning message in the OTLP GRPC Exporter when there is a mismatch between the configured endpoint and the provided endpoint. This change aims to prevent silent truncation of the endpoint value, which could lead to confusion and time-consuming debugging for users trying to configure a HTTP exporter but mistakenly passing a GRPC one. This issue might be a common occurrence for newcomers, as almost all the examples use the GRPC exporter. The warning message provides clear, actionable feedback to the user, improving the overall user experience.

Addresses open-telemetry#3619
@gshiva gshiva linked a pull request Jan 6, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant