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

Trace SDK does not raise when Span attribute and link limits are exceeded #1856

Merged
merged 4 commits into from
May 24, 2021

Conversation

c-kruse
Copy link
Contributor

@c-kruse c-kruse commented May 17, 2021

Description

Relevant Spec here.

We should not be raising ValueError when starting a span if the number of links or attributes exceeds the configured maxima. Surplus attributes and links can be discarded instead.

  • opentelemetry.sdk.util.BoundedList.from_seq(...) behavior changes to not raise ValueError. Instead uses BoundedList.extend to fill the deque to capacity and preserve a dropped count for excess items.
  • opentelemetry.sdk.util.BoundedDict.from_map(...) behavior changes to not raise ValueError. Instead it iterates on the input mapping and inserts keys one by one relying on BoundedDict.__setitem__ to discard excess items.

Fixes #1844

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Just the tox test suite

Does This PR Require a Contrib Repo Change?

Answer the following question based on these examples of changes that would require a Contrib Repo Change:

  • The OTel specification has changed which prompted this PR to update the method interfaces of opentelemetry-api/ or opentelemetry-sdk/

  • The method interfaces of test/util have changed

  • Scripts in scripts/ that were copied over to the Contrib repo have changed

  • Configuration files that were copied over to the Contrib repo have changed (when consistency between repositories is applicable) such as in

    • pyproject.toml
    • isort.cfg
    • .flake8
  • When a new .github/CODEOWNER is added

  • Major changes to project information, such as in:

    • README.md
    • CONTRIBUTING.md
  • Yes. - Link to PR:

  • No.

I'm not positive - could use some help on this front

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

use deque extend for boundlist initialization

better variable names

cleaner tests

more focused tests
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 17, 2021

CLA Signed

The committers are authorized under a signed CLA.

@c-kruse c-kruse marked this pull request as ready for review May 17, 2021 16:24
@c-kruse c-kruse requested review from a team, owais and srikanthccv and removed request for a team May 17, 2021 16:24
@lzchen
Copy link
Contributor

lzchen commented May 17, 2021

If we are choosing to drop the extra attributes, we must implement the following line as well:

If the SDK implements the limits above it MUST provide a way to change these limits, via a configuration to the TracerProvider,

Might need to be coordinated with this pr.

@c-kruse
Copy link
Contributor Author

c-kruse commented May 17, 2021

Might need to be coordinated with this pr.

Agreed! Looks to me like this change set would be cleanest done as a followup to 1839. I might just sit on this until the changes to span limits are merged, then rebase and redo these changes with adjustments. That sound reasonable to you?

@c-kruse
Copy link
Contributor Author

c-kruse commented May 19, 2021

@lzchen looks like the scope of #1839 has changed and does not appear to satisfy the intent of the spec you mentioned.

Thoughts on whether or not we should park this issue until we can provide a reasonable way to configure span limits on a TraceProvider? As I understand it, we're already in an awkward place with compliance to this given this test is passing test_span_environment_limits.

@owais
Copy link
Contributor

owais commented May 19, 2021

@c-kruse I removed that functionality in order to speed up the PR review process. I intent to start separate discussion tomorrow around what the TracerProvider API should look like and submit a new PR after that.

@owais
Copy link
Contributor

owais commented May 19, 2021

@c-kruse FYI #1859

@lzchen lzchen merged commit ef7a415 into open-telemetry:main May 24, 2021
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.

Exceeding max number of attributes/links on span start raises exception
4 participants