-
Notifications
You must be signed in to change notification settings - Fork 782
Telemetry for openai agents #3762
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
base: main
Are you sure you want to change the base?
Conversation
|
instrumentation-genai/opentelemetry-instrumentation-openai-agents/CHANGELOG.md
Outdated
Show resolved
Hide resolved
:target: https://pypi.org/project/opentelemetry-instrumentation-openai-agents/ | ||
|
||
This library allows tracing OpenAI Agents framework requests and logging of messages made by the | ||
`OpenAI Python API library <https://pypi.org/project/openai/>`_ when used with agent frameworks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely sure which library this instrumentor instruments. Is it openai or openai-agents?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a question to bring up to the SIG is if we would want this instrumentation to be standalone or included as part of openai instrumentation
instrumentation-genai/opentelemetry-instrumentation-openai-agents/README.rst
Outdated
Show resolved
Hide resolved
instrumentation-genai/opentelemetry-instrumentation-openai-agents/=
Outdated
Show resolved
Hide resolved
instrumentation-genai/opentelemetry-instrumentation-openai-agents/examples/basic_usage.py
Outdated
Show resolved
Hide resolved
instrumentation-genai/opentelemetry-instrumentation-openai-agents/examples/basic_usage.py
Show resolved
Hide resolved
|
||
OpenAIAgentsInstrumentor().instrument() | ||
|
||
custom_client = AsyncAzureOpenAI( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I would treat this as separate azureopenai example. We would also want a more generic example with just OpenAI
client.
...try-instrumentation-openai-agents/src/opentelemetry/instrumentation/openai_agents/package.py
Outdated
Show resolved
Hide resolved
instrumentation-genai/opentelemetry-instrumentation-openai-agents/events.yaml
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,59 @@ | |||
# OpenAI Agents Instrumentation Examples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently all other genai instrumentations have a manual
and zerocode
examples. Perhaps we can follow up with a separate pr for zerocode. https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-vertexai/examples
instrumentation-genai/opentelemetry-instrumentation-openai-agents/examples/README.md
Outdated
Show resolved
Hide resolved
...on-openai-agents/src/opentelemetry/instrumentation/openai_agents/genai_semantic_processor.py
Outdated
Show resolved
Hide resolved
...ry-instrumentation-openai-agents/src/opentelemetry/instrumentation/openai_agents/__init__.py
Outdated
Show resolved
Hide resolved
def _uninstrument(self, **kwargs): | ||
"""Uninstruments the OpenAI library for agent frameworks.""" | ||
# No-op: optional processor registry may not be present. | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can maintain the old list of processors and restore it upon _uninstrument
.
tracer_provider, | ||
schema_url=Schemas.V1_28_0.value, | ||
) | ||
event_logger_provider = kwargs.get("event_logger_provider") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is our stance on adding net new components that rely on the soon-to-be deprecated events api/sdk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya I believe it should just use logs directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we are deprecating it still. The current hangup is over what the exact signature(s) for logger.emit
should look like. open-telemetry/opentelemetry-python#4737 -- if one of y'all could chime in on that it would be helpful to move this along.. I provided my opinion already
…nts/= delete unnecessary file
…nts/events.yaml delete unnecessary file
…nts/metrics.yaml delete unnecessary file
…nts/registry.yaml delete unnecessary file
…nts/spans.yaml remove unncessary file
…m most; add enhanced_travel_planner and trace_collectors; update README
…mode returning [{"type":"text","content":"readacted"}] when sensitive capture disabled; add TODO to restore processors on uninstrument
…e in normalized output schema
@@ -0,0 +1,135 @@ | |||
"""Centralized semantic convention constants for GenAI instrumentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should being able to import these from semantic conventions package
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Test Summary
(capture content and metrics on/off).
Reproduction Steps
OTEL_INSTRUMENTATION_OPENAI_AGENTS_CAPTURE_CONTENT=true python -m unittest -v tests/test_openai_agents.py
OTEL_INSTRUMENTATION_OPENAI_AGENTS_CAPTURE_METRICS=false python -m unittest -v tests/test_openai_agents.py
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.