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

Azcosmos no tracer to pager #23658

Merged
merged 3 commits into from
Oct 31, 2024
Merged

Conversation

kjg
Copy link
Contributor

@kjg kjg commented Oct 24, 2024

Originally the thought was that the azcore Pager should provide a way to better customize the spans it creates, and that the azcosmos Pager based spans could take advantage of that.

As I was digging it to try to make that work I did realize a few things.

  1. The spans being set within the azcosmos Fetcher functions are currently being surpressed due to the StartSpan code policy to not allow nested spans most of the time.
  2. Adding a way to customize the span creation in the azcore Pager would add complexity for what is currently just a simple wrapper around the Fetcher function
  3. If a Tracer is not set on the PagingHandler a null Tracer is used which results in StartSpan not adding an active span to the context.

Considering all the above. I think the simplest way to allow azcosmos to customize the tracer used for Pager spans is to not set a tracer in PagingHandler, and allow the custom one within the Fetcher function to take precedence.

For testing, I've pushed a commit with just the tests to show that before this change the tests fail to have the query_ spans. Then I've pushed the commit that removes setting the Tracer and you can see the tests all pass now.

Example of a failing test:
Messages: span query_items aContainer wasn't found

  • The purpose of this PR is explained in this or a referenced issue.
  • The PR does not update generated files.
  • Tests are included and/or updated for code changes.
  • Updates to module CHANGELOG.md are included.
  • MIT license headers are included in each file.

@github-actions github-actions bot added Community Contribution Community members are working on the issue Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Oct 24, 2024
Copy link

Thank you for your contribution @kjg! We will review the pull request and get back to you soon.

@kjg kjg marked this pull request as draft October 24, 2024 20:14
@kjg
Copy link
Contributor Author

kjg commented Oct 24, 2024

Adding tests now.

@kjg kjg force-pushed the azcosmos-no-tracer-to-pager branch from 699ff55 to 0b34e33 Compare October 24, 2024 20:47
@kjg kjg marked this pull request as ready for review October 24, 2024 20:47
Copy link
Member

@analogrelay analogrelay left a comment

Choose a reason for hiding this comment

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

LGTM

sdk/data/azcosmos/cosmos_client.go Show resolved Hide resolved
@kjg
Copy link
Contributor Author

kjg commented Oct 31, 2024

@analogrelay Is there anything else that needs to be done before this can be merged?

@analogrelay
Copy link
Member

Nope, this is good to go. Thanks for the ping!

@analogrelay analogrelay merged commit 12965bc into Azure:main Oct 31, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution Community members are working on the issue Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants