open-telemetry / open-telemetry/opentelemetry-python-contrib
Deprecate `bedrock` instrumentation package once new instrumentation in `opentelemetry-python-genai` is ready
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
We have started instrumenting bedrock in the new optentelemetry-python-genai repo.
Once that library reaches parity with the one in this repo, we can deprecate the one here.
Proposal for how to deprecate:
Add a deprecation warning:
class _BedrockExtension:
def __init__(self, ...):
warnings.warn(
"The Bedrock extension in 'opentelemetry-instrumentation-botocore' is deprecated "
"and will be removed in a future release. "
"Please use 'opentelemetry-instrumentation-genai-bedrock' instead.",
category=DeprecationWarning,
stacklevel=2,
)
Disable BedrockExtension if opentelemetry-instrumentation-genai-bedrock is installed and enabled:
def _is_genai_bedrock_active() -> bool:
if importlib.util.find_spec("opentelemetry.instrumentation.genai.bedrock") is None:
return False
try:
from opentelemetry.instrumentation.genai.bedrock import BedrockInstrumentor
return BedrockInstrumentor().is_instrumented_by_opentelemetry
except Exception:
return False
class _BedrockExtension:
def __init__(self, ...):
self._disabled = _is_genai_bedrock_active()
if self._disabled:
logger.debug(
"opentelemetry-instrumentation-genai-bedrock is active; "
"suppressing botocore BedrockExtension to avoid duplicate spans."
)
def extract_attributes(self, ...):
if self._disabled:
return # No-op: let the new instrumentor handle GenAI telemetry
...
Update the README that gets pushed to PyPi to point people to the new instrumentation..
I think at that point we can delete the code here entirely.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing opentelemetry-python-genai PR 359 and checking whether its Bedrock instrumentation has reached parity. Then locate the existing BedrockExtension and the README published to PyPI; done means the deprecation and duplicate-instrumentation behavior are addressed and the README points users to the new package, with deletion confirmed if appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100