-
Notifications
You must be signed in to change notification settings - Fork 644
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
Zipkin exporter: Add timeout support and implement shutdown #1799
Conversation
@@ -83,6 +85,7 @@ | |||
from opentelemetry.exporter.zipkin.node_endpoint import IpInput, NodeEndpoint | |||
from opentelemetry.sdk.environment_variables import ( | |||
OTEL_EXPORTER_ZIPKIN_ENDPOINT, | |||
OTEL_EXPORTER_ZIPKIN_TIMEOUT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this env var be proposed to the specs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR in spec repo open-telemetry/opentelemetry-specification#1636. It has already two approvals and I don't see any objection coming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice looks like it merged!
if self.done: | ||
logger.warning("Exporter already shutdown, ignoring call") | ||
return | ||
self.session.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this do to in-flight requests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't affect the in-flight requests. Internally it uses this pool manager https://urllib3.readthedocs.io/en/1.24.3/reference/index.html#urllib3.poolmanager.PoolManager.clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it won't drop them but it won't wait for them to finish either? I think we should probably wait for them to finish if it can be done easily.
self.session.headers.update( | ||
{"Content-Type": self.encoder.content_type()} | ||
) | ||
self.done = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be rename to _closed
? done is a bit ambiguous. At first glance it is not clear whether this refers to a single batch or entire instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, will do.
local_node_port: Depending on context, this could be a listen port or the | ||
client-side of a socket. | ||
max_tag_value_length: Max length string attribute values can have. | ||
timeout: Maximum time the Zipkin exporter will wait for each batch export. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Worth calling out the 10s default?
local_node_port: Depending on context, this could be a listen port or the | ||
client-side of a socket. | ||
max_tag_value_length: Max length string attribute values can have. | ||
timeout: Maximum time the Zipkin exporter will wait for each batch export. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same note about mentioning the default timeout
Description
This adds timeout support for zipkin exporter via constructor param and env var
OTEL_EXPORTER_ZIPKIN_TIMEOUT
and implements shutdown. Additionally changed the exporter to use requests.Session to avoid making new connection to zipkin collector on each export call.Part of #346 and #1791