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

Allow span limits to be set lazily and programatically #1838

Closed
owais opened this issue May 10, 2021 · 0 comments · Fixed by #1839
Closed

Allow span limits to be set lazily and programatically #1838

owais opened this issue May 10, 2021 · 0 comments · Fixed by #1839
Assignees

Comments

@owais
Copy link
Contributor

owais commented May 10, 2021

Today span limits are set automatically when importing the trace SDK module here

It's not possible to change these limits once set. As a result, the only way to set them today is through environment variables and the env vars must be set before the trace module is imported.

We should change it so that the trace SDK configures the limits lazily and allows users to pass in limits programmatically. Something like the following should work I think.

# new SpanLimits type in API
class SpanLimit:
    def __init__(self, events=None, links=None, attributes=None):
         self.events = _get_span_limits_from_env("events", default=events)
         self.links = _get_span_limits_from_env("links", default=links)
         self.attributes = _get_span_limits_from_env("attributes", default=attributes)

Tracer provider will accept an optional SpanLimits instance and pass it forward to spans via tracer. Each span can then initiate it's collection objects with the specified limits.

Usage would look like:

provider = TracerProvider(span_limits=SpanLimits(events=500, links=90)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant