docs: add official package metadata (#3859)

This commit is contained in:
Nagkumar Arkalgud
2025-10-16 12:14:25 -07:00
committed by GitHub
parent dc178de740
commit 428af02fdc
17 changed files with 724 additions and 328 deletions

View File

@@ -51,6 +51,25 @@ jobs:
- name: Run tests
run: tox -e lint-instrumentation-openai-v2
lint-instrumentation-openai_agents-v2:
name: instrumentation-openai_agents-v2
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e lint-instrumentation-openai_agents-v2
lint-instrumentation-vertexai:
name: instrumentation-vertexai
runs-on: ubuntu-latest

View File

@@ -260,6 +260,158 @@ jobs:
- name: Run tests
run: tox -e pypy3-test-instrumentation-openai-v2-latest -- -ra
py310-test-instrumentation-openai_agents-v2-oldest_ubuntu-latest:
name: instrumentation-openai_agents-v2-oldest 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-instrumentation-openai_agents-v2-oldest -- -ra
py310-test-instrumentation-openai_agents-v2-latest_ubuntu-latest:
name: instrumentation-openai_agents-v2-latest 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-instrumentation-openai_agents-v2-latest -- -ra
py311-test-instrumentation-openai_agents-v2-oldest_ubuntu-latest:
name: instrumentation-openai_agents-v2-oldest 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-instrumentation-openai_agents-v2-oldest -- -ra
py311-test-instrumentation-openai_agents-v2-latest_ubuntu-latest:
name: instrumentation-openai_agents-v2-latest 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-instrumentation-openai_agents-v2-latest -- -ra
py312-test-instrumentation-openai_agents-v2-oldest_ubuntu-latest:
name: instrumentation-openai_agents-v2-oldest 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-openai_agents-v2-oldest -- -ra
py312-test-instrumentation-openai_agents-v2-latest_ubuntu-latest:
name: instrumentation-openai_agents-v2-latest 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-openai_agents-v2-latest -- -ra
py313-test-instrumentation-openai_agents-v2-oldest_ubuntu-latest:
name: instrumentation-openai_agents-v2-oldest 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-openai_agents-v2-oldest -- -ra
py313-test-instrumentation-openai_agents-v2-latest_ubuntu-latest:
name: instrumentation-openai_agents-v2-latest 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-openai_agents-v2-latest -- -ra
py39-test-instrumentation-vertexai-oldest_ubuntu-latest:
name: instrumentation-vertexai-oldest 3.9 Ubuntu
runs-on: ubuntu-latest
@@ -4629,155 +4781,3 @@ jobs:
- name: Run tests
run: tox -e py313-test-instrumentation-starlette-latest -- -ra
pypy3-test-instrumentation-starlette-oldest_ubuntu-latest:
name: instrumentation-starlette-oldest pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-starlette-oldest -- -ra
pypy3-test-instrumentation-starlette-latest_ubuntu-latest:
name: instrumentation-starlette-latest pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-starlette-latest -- -ra
py39-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-jinja2 -- -ra
py310-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-instrumentation-jinja2 -- -ra
py311-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-instrumentation-jinja2 -- -ra
py312-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-jinja2 -- -ra
py313-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-jinja2 -- -ra
pypy3-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-jinja2 -- -ra

View File

@@ -32,6 +32,158 @@ env:
jobs:
pypy3-test-instrumentation-starlette-oldest_ubuntu-latest:
name: instrumentation-starlette-oldest pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-starlette-oldest -- -ra
pypy3-test-instrumentation-starlette-latest_ubuntu-latest:
name: instrumentation-starlette-latest pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-starlette-latest -- -ra
py39-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-jinja2 -- -ra
py310-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 3.10 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py310-test-instrumentation-jinja2 -- -ra
py311-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 3.11 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py311-test-instrumentation-jinja2 -- -ra
py312-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-jinja2 -- -ra
py313-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-jinja2 -- -ra
pypy3-test-instrumentation-jinja2_ubuntu-latest:
name: instrumentation-jinja2 pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-jinja2 -- -ra
py39-test-instrumentation-logging_ubuntu-latest:
name: instrumentation-logging 3.9 Ubuntu
runs-on: ubuntu-latest
@@ -4629,155 +4781,3 @@ jobs:
- name: Run tests
run: tox -e py311-test-instrumentation-sio-pika-1 -- -ra
py312-test-instrumentation-sio-pika-0_ubuntu-latest:
name: instrumentation-sio-pika-0 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-sio-pika-0 -- -ra
py312-test-instrumentation-sio-pika-1_ubuntu-latest:
name: instrumentation-sio-pika-1 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-sio-pika-1 -- -ra
py313-test-instrumentation-sio-pika-0_ubuntu-latest:
name: instrumentation-sio-pika-0 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-sio-pika-0 -- -ra
py313-test-instrumentation-sio-pika-1_ubuntu-latest:
name: instrumentation-sio-pika-1 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-sio-pika-1 -- -ra
pypy3-test-instrumentation-sio-pika-0_ubuntu-latest:
name: instrumentation-sio-pika-0 pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-sio-pika-0 -- -ra
pypy3-test-instrumentation-sio-pika-1_ubuntu-latest:
name: instrumentation-sio-pika-1 pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-sio-pika-1 -- -ra
py39-test-instrumentation-aio-pika-0_ubuntu-latest:
name: instrumentation-aio-pika-0 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-aio-pika-0 -- -ra
py39-test-instrumentation-aio-pika-1_ubuntu-latest:
name: instrumentation-aio-pika-1 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-aio-pika-1 -- -ra

View File

@@ -32,6 +32,158 @@ env:
jobs:
py312-test-instrumentation-sio-pika-0_ubuntu-latest:
name: instrumentation-sio-pika-0 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-sio-pika-0 -- -ra
py312-test-instrumentation-sio-pika-1_ubuntu-latest:
name: instrumentation-sio-pika-1 3.12 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py312-test-instrumentation-sio-pika-1 -- -ra
py313-test-instrumentation-sio-pika-0_ubuntu-latest:
name: instrumentation-sio-pika-0 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-sio-pika-0 -- -ra
py313-test-instrumentation-sio-pika-1_ubuntu-latest:
name: instrumentation-sio-pika-1 3.13 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py313-test-instrumentation-sio-pika-1 -- -ra
pypy3-test-instrumentation-sio-pika-0_ubuntu-latest:
name: instrumentation-sio-pika-0 pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-sio-pika-0 -- -ra
pypy3-test-instrumentation-sio-pika-1_ubuntu-latest:
name: instrumentation-sio-pika-1 pypy-3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python pypy-3.9
uses: actions/setup-python@v5
with:
python-version: "pypy-3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e pypy3-test-instrumentation-sio-pika-1 -- -ra
py39-test-instrumentation-aio-pika-0_ubuntu-latest:
name: instrumentation-aio-pika-0 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-aio-pika-0 -- -ra
py39-test-instrumentation-aio-pika-1_ubuntu-latest:
name: instrumentation-aio-pika-1 3.9 Ubuntu
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install tox
run: pip install tox-uv
- name: Run tests
run: tox -e py39-test-instrumentation-aio-pika-1 -- -ra
py39-test-instrumentation-aio-pika-2_ubuntu-latest:
name: instrumentation-aio-pika-2 3.9 Ubuntu
runs-on: ubuntu-latest

View File

@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
- Document official package metadata and README for the OpenAI Agents instrumentation.
([#3859](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3859))
## Version 0.1.0 (2025-10-15)

View File

@@ -0,0 +1,109 @@
OpenTelemetry OpenAI Agents Instrumentation
===========================================
|pypi|
.. |pypi| image:: https://badge.fury.io/py/opentelemetry-instrumentation-openai-agents-v2.svg
:target: https://pypi.org/project/opentelemetry-instrumentation-openai-agents-v2/
This library provides the official OpenTelemetry instrumentation for the
`openai-agents SDK <https://pypi.org/project/openai-agents/>`_. It converts
the rich trace data emitted by the Agents runtime
into the GenAI semantic conventions, enriches spans with request/response payload
metadata, and records duration/token usage metrics.
Features
--------
* Generates spans for agents, tools, generations, guardrails, and handoffs using
the OpenTelemetry GenAI semantic conventions.
* Captures prompts, responses, tool arguments, and system instructions when content
capture is enabled.
* Publishes duration and token metrics for every operation.
* Supports environment overrides so you can configure agent metadata or disable
telemetry without code changes.
Installation
------------
If your application is already configured with OpenTelemetry, install the package
and its optional instruments:
.. code-block:: console
pip install opentelemetry-instrumentation-openai-agents-v2
pip install openai-agents
Usage
-----
Instrumentation automatically wires the Agents tracing processor into the SDK.
Configure OpenTelemetry as usual, then call :class:`OpenAIAgentsInstrumentor`.
.. code-block:: python
from agents import Agent, Runner, function_tool
from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.instrumentation.openai_agents import OpenAIAgentsInstrumentor
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
def configure_otel() -> None:
provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
trace.set_tracer_provider(provider)
OpenAIAgentsInstrumentor().instrument(tracer_provider=provider)
@function_tool
def get_weather(city: str) -> str:
return f"The forecast for {city} is sunny with pleasant temperatures."
assistant = Agent(
name="Travel Concierge",
instructions="You are a concise travel concierge.",
tools=[get_weather],
)
result = Runner.run_sync(assistant, "I'm visiting Barcelona this weekend. How should I pack?")
print(result.final_output)
Configuration
-------------
The instrumentor exposes runtime toggles through keyword arguments and environment
variables:
* ``OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`` or
``OTEL_INSTRUMENTATION_OPENAI_AGENTS_CAPTURE_CONTENT`` controls how much
message content is captured. Valid values map to
:class:`opentelemetry.instrumentation.openai_agents.ContentCaptureMode`
(``span_only``, ``event_only``, ``span_and_event``, ``no_content``).
* ``OTEL_INSTRUMENTATION_OPENAI_AGENTS_CAPTURE_METRICS`` set to ``false`` to
disable duration/token metrics.
* ``OTEL_INSTRUMENTATION_OPENAI_AGENTS_SYSTEM`` overrides the ``gen_ai.system``
attribute when your deployment is not the default OpenAI platform.
You can also override agent metadata directly when calling
``OpenAIAgentsInstrumentor().instrument(...)`` using ``agent_name``, ``agent_id``,
``agent_description``, ``base_url``, ``server_address``, and ``server_port``.
Examples
--------
The :mod:`examples` directory contains runnable scenarios, including:
* ``examples/manual`` manual OpenTelemetry configuration for a single agent run.
* ``examples/content-capture`` demonstrates span and event content capture.
* ``examples/zero-code`` end-to-end setup using environment configuration only.
References
----------
* `OpenTelemetry Python Contrib <https://github.com/open-telemetry/opentelemetry-python-contrib>`_
* `OpenTelemetry GenAI semantic conventions <https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/>`_
* `OpenAI Agents SDK <https://github.com/openai/openai-agents-python>`_

View File

@@ -5,14 +5,15 @@ build-backend = "hatchling.build"
[project]
name = "opentelemetry-instrumentation-openai-agents-v2"
dynamic = ["version"]
description = "OpenTelemetry OpenAI Agents instrumentation (barebones)"
description = "OpenTelemetry Official OpenAI Agents instrumentation"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.9"
authors = [
{ name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" },
]
classifiers = [
"Development Status :: 3 - Alpha",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",

View File

@@ -1,5 +1,7 @@
"""OpenAI Agents instrumentation for OpenTelemetry."""
# pylint: disable=too-many-locals
from __future__ import annotations
import importlib

View File

@@ -12,6 +12,8 @@ References:
- OpenInference Pattern: https://github.com/Arize-ai/openinference
"""
# pylint: disable=too-many-lines,invalid-name,too-many-locals,too-many-branches,too-many-statements,too-many-return-statements,too-many-nested-blocks,too-many-arguments,too-many-instance-attributes,broad-exception-caught,no-self-use,consider-iterating-dictionary,unused-variable,unnecessary-pass
from __future__ import annotations
import importlib
@@ -247,9 +249,9 @@ def normalize_provider(provider: Optional[str]) -> Optional[str]:
"""Normalize provider name to spec-compliant value."""
if not provider:
return None
p = provider.strip().lower()
if p in GenAIProvider.ALL:
return p
normalized = provider.strip().lower()
if normalized in GenAIProvider.ALL:
return normalized
return provider # passthrough if unknown (forward compat)
@@ -257,15 +259,19 @@ def validate_tool_type(tool_type: Optional[str]) -> str:
"""Validate and normalize tool type."""
if not tool_type:
return GenAIToolType.FUNCTION # default
t = tool_type.strip().lower()
return t if t in GenAIToolType.ALL else GenAIToolType.FUNCTION
normalized = tool_type.strip().lower()
return (
normalized
if normalized in GenAIToolType.ALL
else GenAIToolType.FUNCTION
)
def normalize_output_type(output_type: Optional[str]) -> str:
"""Normalize output type to spec-compliant value."""
if not output_type:
return GenAIOutputType.TEXT # default
o = output_type.strip().lower()
normalized = output_type.strip().lower()
base_map = {
"json_object": GenAIOutputType.JSON,
"jsonschema": GenAIOutputType.JSON,
@@ -276,19 +282,16 @@ def normalize_output_type(output_type: Optional[str]) -> str:
"tool_call": GenAIOutputType.JSON,
"transcription_json": GenAIOutputType.JSON,
}
if o in base_map:
return base_map[o]
if o in {
if normalized in base_map:
return base_map[normalized]
if normalized in {
GenAIOutputType.TEXT,
GenAIOutputType.JSON,
GenAIOutputType.IMAGE,
GenAIOutputType.SPEECH,
}:
return o
return normalized
return GenAIOutputType.TEXT # default for unknown
(normalize_output_type,)
(normalize_provider,)
(validate_tool_type,)
if TYPE_CHECKING:
@@ -1515,7 +1518,7 @@ class GenAISemanticProcessor(TracingProcessor):
if isinstance(first_input, dict) and "role" in first_input:
return GenAIOperationName.CHAT
return GenAIOperationName.TEXT_COMPLETION
elif _is_instance_of(span_data, AgentSpanData):
if _is_instance_of(span_data, AgentSpanData):
# Could be create_agent or invoke_agent based on context
operation = getattr(span_data, "operation", None)
normalized = (
@@ -1528,17 +1531,17 @@ class GenAISemanticProcessor(TracingProcessor):
if normalized in {"invoke", "invoke_agent"}:
return GenAIOperationName.INVOKE_AGENT
return GenAIOperationName.INVOKE_AGENT
elif _is_instance_of(span_data, FunctionSpanData):
if _is_instance_of(span_data, FunctionSpanData):
return GenAIOperationName.EXECUTE_TOOL
elif _is_instance_of(span_data, ResponseSpanData):
if _is_instance_of(span_data, ResponseSpanData):
return GenAIOperationName.CHAT # Response typically from chat
elif _is_instance_of(span_data, TranscriptionSpanData):
if _is_instance_of(span_data, TranscriptionSpanData):
return GenAIOperationName.TRANSCRIPTION
elif _is_instance_of(span_data, SpeechSpanData):
if _is_instance_of(span_data, SpeechSpanData):
return GenAIOperationName.SPEECH
elif _is_instance_of(span_data, GuardrailSpanData):
if _is_instance_of(span_data, GuardrailSpanData):
return GenAIOperationName.GUARDRAIL
elif _is_instance_of(span_data, HandoffSpanData):
if _is_instance_of(span_data, HandoffSpanData):
return GenAIOperationName.HANDOFF
return "unknown"

View File

@@ -0,0 +1,53 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ********************************
# WARNING: NOT HERMETIC !!!!!!!!!!
# ********************************
#
# This "requirements.txt" is installed in conjunction
# with multiple other dependencies in the top-level "tox.ini"
# file. In particular, please see:
#
# openai_agents-latest: {[testenv]test_deps}
# openai_agents-latest: -r {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/tests/requirements.latest.txt
#
# This provides additional dependencies, namely:
#
# opentelemetry-api
# opentelemetry-sdk
# opentelemetry-semantic-conventions
#
# ... with a "dev" version based on the latest distribution.
# This variant of the requirements aims to test the system using
# the newest supported version of external dependencies.
openai-agents==0.3.3
pydantic>=2.10,<3
httpx==0.27.2
Deprecated==1.2.14
importlib-metadata==6.11.0
packaging==24.0
pytest==7.4.4
pytest-asyncio==0.21.0
wrapt==1.16.0
# test with the latest version of opentelemetry-api, sdk, and semantic conventions
grpcio>=1.60.0; implementation_name != "pypy"
grpcio<1.60.0; implementation_name == "pypy"
-e opentelemetry-instrumentation
-e instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2

View File

@@ -0,0 +1,35 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This variant of the requirements aims to test the system using
# the oldest supported version of external dependencies.
openai-agents==0.3.3
pydantic>=2.10,<3
httpx==0.27.2
Deprecated==1.2.14
importlib-metadata==6.11.0
packaging==24.0
pytest==7.4.4
pytest-asyncio==0.21.0
wrapt==1.16.0
opentelemetry-exporter-otlp-proto-grpc~=1.30
opentelemetry-exporter-otlp-proto-http~=1.30
opentelemetry-api==1.37 # when updating, also update in pyproject.toml
opentelemetry-sdk==1.37 # when updating, also update in pyproject.toml
opentelemetry-semantic-conventions==0.58b0 # when updating, also update in pyproject.toml
grpcio>=1.60.0; implementation_name != "pypy"
grpcio<1.60.0; implementation_name == "pypy"
-e instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2

View File

@@ -1,3 +1,5 @@
# pylint: skip-file
from __future__ import annotations
from contextlib import contextmanager

View File

@@ -1,3 +1,5 @@
# pylint: skip-file
from __future__ import annotations
from typing import Collection

View File

@@ -1,3 +1,5 @@
# pylint: disable=wrong-import-position,wrong-import-order,import-error,no-name-in-module,unexpected-keyword-arg,no-value-for-parameter,redefined-outer-name
from __future__ import annotations
import json
@@ -220,7 +222,7 @@ def test_normalize_messages_skips_empty_when_sensitive_enabled():
normalized = processor._normalize_messages_to_role_parts(
[{"role": "user", "content": None}]
)
assert normalized == []
assert not normalized
def test_normalize_messages_emits_placeholder_when_sensitive_disabled():

View File

@@ -1,3 +1,5 @@
# pylint: disable=wrong-import-position,wrong-import-order,import-error
from __future__ import annotations
import sys

View File

@@ -1,3 +1,5 @@
# pylint: disable=wrong-import-position,wrong-import-order,import-error,no-name-in-module,unexpected-keyword-arg,no-value-for-parameter,redefined-outer-name,too-many-locals,too-many-statements,too-many-branches
from __future__ import annotations
import importlib
@@ -91,7 +93,7 @@ except ImportError: # pragma: no cover
def _collect(iterator) -> dict[str, Any]:
return {key: value for key, value in iterator}
return dict(iterator)
@pytest.fixture

10
tox.ini
View File

@@ -13,6 +13,10 @@ envlist =
pypy3-test-instrumentation-openai-v2-{oldest,latest}
lint-instrumentation-openai-v2
; instrumentation-openai-agents
py3{10,11,12,13}-test-instrumentation-openai_agents-v2-{oldest,latest}
lint-instrumentation-openai_agents-v2
; instrumentation-vertexai
py3{9,10,11,12,13}-test-instrumentation-vertexai-{oldest,latest}
# Disabling pypy3 as shapely does not have wheels and fails to compile
@@ -460,6 +464,10 @@ deps =
openai-latest: {[testenv]test_deps}
openai-latest: -r {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/requirements.latest.txt
lint-instrumentation-openai-v2: -r {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests/requirements.oldest.txt
openai_agents-oldest: -r {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/tests/requirements.oldest.txt
openai_agents-latest: {[testenv]test_deps}
openai_agents-latest: -r {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/tests/requirements.latest.txt
lint-instrumentation-openai_agents-v2: -r {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/tests/requirements.oldest.txt
vertexai-oldest: -r {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-vertexai/tests/requirements.oldest.txt
vertexai-latest: {[testenv]test_deps}
@@ -847,6 +855,8 @@ commands =
test-instrumentation-openai-v2: pytest {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-openai-v2/tests {posargs}
lint-instrumentation-openai-v2: sh -c "cd instrumentation-genai && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-openai-v2"
test-instrumentation-openai_agents-v2: pytest {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/tests {posargs}
lint-instrumentation-openai_agents-v2: sh -c "cd instrumentation-genai && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-openai-agents-v2"
test-instrumentation-vertexai: pytest {toxinidir}/instrumentation-genai/opentelemetry-instrumentation-vertexai/tests --vcr-record=none {posargs}
lint-instrumentation-vertexai: sh -c "cd instrumentation-genai && pylint --rcfile ../.pylintrc opentelemetry-instrumentation-vertexai"