Skip to content

extract span preparation logic into helper function #3611

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 1 commit into
base: main
Choose a base branch
from

Conversation

blairhyy-amazon
Copy link

Description

Currently, the _patched_api_call method in BotocoreInstrumentor handles the entire span lifecycle (creation, attribute setting, and closure) in a single function. This monolithic approach makes it difficult to extend or customize the instrumentation, particularly when trying to add custom span attributes from the Boto client instance or call context.

This PR proposes to break down _patched_api_call into smaller, more focused helper functions, starting with extracting the span preparation logic. This refactoring will:

  1. Improve code maintainability
  2. Make it easier to extend the instrumentation through patching
  3. Reduce the need for code duplication when customizing span attributes
  4. Provide a cleaner interface for future contributors

Type of change

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

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

  • test_botocore_instrumentation.py

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project

Copy link

linux-foundation-easycla bot commented Jul 3, 2025

CLA Signed

  • ✅login: blairhyy-amazon / (e1fc2e1)

The committers listed above are authorized under a signed CLA.

@blairhyy-amazon blairhyy-amazon marked this pull request as ready for review July 3, 2025 17:00
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.

1 participant