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

Zipkin exporter: Add timeout support and implement shutdown #1799

Merged
merged 13 commits into from
Apr 29, 2021

Conversation

srikanthccv
Copy link
Member

@srikanthccv srikanthccv commented Apr 25, 2021

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

@srikanthccv srikanthccv marked this pull request as ready for review April 25, 2021 21:06
@srikanthccv srikanthccv requested a review from a team as a code owner April 25, 2021 21:06
@srikanthccv srikanthccv requested review from codeboten and hectorhdzg and removed request for a team April 25, 2021 21:06
@@ -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,
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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()
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Member Author

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.
Copy link
Contributor

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.
Copy link
Contributor

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

@codeboten codeboten merged commit a4a5b0a into open-telemetry:main Apr 29, 2021
@srikanthccv srikanthccv deleted the zipkin-exporter branch September 24, 2021 08:40
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 this pull request may close these issues.

None yet

4 participants