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

Configurable max export delay value for OTLPExporterMixin #3559

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

avpps
Copy link

@avpps avpps commented Nov 27, 2023

Description

Change related with #1842.

Default OTLPExporterMixin approach to retry exporting with hardcoded time range, causes issues when using it in short lasting processes and opentelemetry collector is not available.
Here is example where it "hangs" whole process execution: https://github.com/avpps/opentelemetry-python-examples/blob/master/examples/trace.py

I just moved hardcoded value to make it configurable. In my cases it make sense to not retry export at all.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

OTLPExporterMixin tests pass after change.

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project

@avpps avpps requested a review from a team November 27, 2023 16:34
Copy link

linux-foundation-easycla bot commented Nov 27, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@avpps avpps changed the title [WIP] Configurable max export delay value for OTLPExporterMixin Configurable max export delay value for OTLPExporterMixin Nov 27, 2023
avpps added a commit to avpps/opentelemetry-python-examples that referenced this pull request Nov 27, 2023
@@ -151,6 +151,7 @@ class OTLPExporterMixin(
timeout: Backend request timeout in seconds
compression: gRPC compression method to use
"""
_MAX_EXPORT_DELAY_VALUE = 64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if it makes sense for this to be a constructor argument with a default value, and for the name to reflect that it's a max backoff in seconds, so something like "max_backoff_seconds"?

Copy link
Author

@avpps avpps Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constructor argument will be convenient for local modifications, like (here with your proposed name):

provider = TracerProvider()

exporter = OTLPSpanExporter()
exporter.max_backoff_seconds = 5

processor = BatchSpanProcessor(exporter)
provider.add_span_processor(processor)
set_tracer_provider(provider)

tracer = get_tracer(__name__)

with tracer.start_as_current_span("test_span"):
    ...

@jakobdo
Copy link

jakobdo commented Nov 29, 2023

I could also use this feature, it would be nice in our setup.

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.

4 participants