Skip to content

Update BatchSpanProcessor to use new BatchProcessor class #4580

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

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

Conversation

DylanRussell
Copy link
Contributor

Description

Update BatchSpanProcessor to use new BatchProcessor class

Type of change

Please delete options that are not relevant.

  • [ x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Unit tests

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • [x ] No.

Checklist:

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

@DylanRussell DylanRussell requested a review from a team as a code owner May 12, 2025 19:56
@DylanRussell
Copy link
Contributor Author

This should be all set to be merged

@@ -238,149 +236,6 @@ def test_on_start_accepts_parent_context(self):
span, parent_context=context
)

def test_shutdown(self):
Copy link
Member

Choose a reason for hiding this comment

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

Would it hurt to leave these tests which only test the public API of BatchSpanProcessor? It seems valuable that they continue passing as the implementation changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think these are all duplicates of the tests in shared_internal/test_batch_processor.py - that test suite does take the BatchSpanProcessor as a parameter and uses it in it's tests

Copy link
Member

Choose a reason for hiding this comment

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

Ah got it thanks. Could you just add a comment mentioning that there are more tests there?

Copy link
Member

Choose a reason for hiding this comment

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

I think these are all duplicates of the tests in shared_internal/test_batch_processor.py - that test suite does take the BatchSpanProcessor as a parameter and uses it in it's tests

How hard would it be to create a base test class that can be included in each tests subdirectory to keep tests collocated with the implemenatations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I spent a couple hours trying to do this this morning and failed.

I tried switching the test class to sublass unittest.TestCase, and have the record_processor_class and telemetry as arguments to it's init.

But unittest's init is called on every test, it's not something I can call once to initialize/setup the test class.

With pytest I was using a decorator to inject those params, and it doesn't seem possible to decorate an imported test class.

If you have any ideas on how to implement let me know..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried doing it with sublcassing for a while and also couldn't get it to work :(

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.

5 participants