You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Warning for Endpoint Mismatch in OTLP GRPC Exporter #3619
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:
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:
ifparsed_url.netloc:
self._endpoint=parsed_url.netlocifparsed_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.")
Reproduces on main (5aa2f8f). exporter.py:299-300 keeps parsed_url.netloc, so the path is
dropped with no warning. The port survives, because it is part of netloc.
endpoint given
self._endpoint
parsed_url.path
https://otlp.example.com/v1/traces
otlp.example.com
/v1/traces
https://otlp.example.com:4317/v1/traces
otlp.example.com:4317
/v1/traces
https://otlp.example.com/
otlp.example.com
/
otlp.example.com:4317
otlp.example.com:4317
4317
Identical on the OTEL_EXPORTER_OTLP_ENDPOINT route, since both converge at :288. A gRPC target has
no path component, so a warning is the only available fix.
Row 4 breaks the guard #3620 proposed. A scheme-less host:port parses as scheme='otlp.example.com', path='4317', so if parsed_url.path and parsed_url.path.strip("/")
both warn on an endpoint that works. The warning has to sit inside if parsed_url.netloc. G004 now
also forbids the f-string #3620 used.
One more thing that costs a reviewer time: logger carries DuplicateFilter, which drops a repeat of
the same format string within a 20 second bucket, so an assertLogs test passes against a mutated
guard. Patching logger.warning catches it.
6 production lines and 2 tests. 69 passed in exporter/opentelemetry-exporter-otlp-proto-grpc/tests/,
and each test fails against a reverted fix. Open a PR?
Activity
chrikrah commentedon Sep 10, 2026
Reproduces on
main(5aa2f8f).exporter.py:299-300keepsparsed_url.netloc, so the path isdropped with no warning. The port survives, because it is part of
netloc.self._endpointparsed_url.pathhttps://otlp.example.com/v1/tracesotlp.example.com/v1/traceshttps://otlp.example.com:4317/v1/tracesotlp.example.com:4317/v1/traceshttps://otlp.example.com/otlp.example.com/otlp.example.com:4317otlp.example.com:43174317Identical on the
OTEL_EXPORTER_OTLP_ENDPOINTroute, since both converge at:288. A gRPC target hasno path component, so a warning is the only available fix.
Row 4 breaks the guard #3620 proposed. A scheme-less
host:portparses asscheme='otlp.example.com',path='4317', soif parsed_url.pathandparsed_url.path.strip("/")both warn on an endpoint that works. The warning has to sit inside
if parsed_url.netloc.G004nowalso forbids the f-string #3620 used.
One more thing that costs a reviewer time:
loggercarriesDuplicateFilter, which drops a repeat ofthe same format string within a 20 second bucket, so an
assertLogstest passes against a mutatedguard. Patching
logger.warningcatches it.6 production lines and 2 tests.
69 passedinexporter/opentelemetry-exporter-otlp-proto-grpc/tests/,and each test fails against a reverted fix. Open a PR?
Add changelog entry for open-telemetry#3619
Add warning for endpoint path mismatch in OTLP gRPC exporter
Add changelog entry for open-telemetry#3619