Skip to content

Commit a3bfc26

Browse files
committed
fix: Fix spell mistake and uninstrumentation function bug.
1 parent 006dad0 commit a3bfc26

File tree

2 files changed

+18
-56
lines changed

2 files changed

+18
-56
lines changed

instrumentation-genai/opentelemetry-instrumentation-agno/pyproject.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,9 @@ instruments = [
3434
"agno",
3535
]
3636
test = [
37-
"langchain_core == 0.1.8",
38-
"langchain == 0.1.0",
39-
"langchain_openai == 0.0.2",
40-
"langchain-community == 0.0.10",
37+
"agno",
38+
"pytest",
4139
"opentelemetry-sdk",
42-
"respx",
4340
]
4441
type-check = []
4542

instrumentation-genai/opentelemetry-instrumentation-agno/src/opentelemetry/instrumentation/agno/__init__.py

Lines changed: 16 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
AgnoModelWrapper,
88
)
99
from opentelemetry import trace as trace_api
10+
from opentelemetry.instrumentation.utils import unwrap
1011
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
1112
from opentelemetry.instrumentation.version import (
1213
__version__,
1314
)
1415

15-
"""OpenTelemetry exporters for BlackSheep instrumentation"""
16+
"""OpenTelemetry exporters for Agno https://github.com/agno-agi/agno"""
17+
1618
_AGENT = "agno.agent"
1719
_MODULE = "agno.models.base"
1820
_TOOLKIT = "agno.tools.function"
@@ -93,57 +95,20 @@ def _instrument(self, **kwargs: Any) -> None:
9395
def _uninstrument(self, **kwargs: Any) -> None:
9496

9597
# Unwrap the agent call function
96-
wrap_function_wrapper(
97-
module=_AGENT,
98-
name="Agent._run",
99-
wrapper=None,
100-
)
101-
wrap_function_wrapper(
102-
module=_AGENT,
103-
name="Agent._arun",
104-
wrapper=None,
105-
)
106-
wrap_function_wrapper(
107-
module=_AGENT,
108-
name="Agent._run_stream",
109-
wrapper=None,
110-
)
111-
wrap_function_wrapper(
112-
module=_AGENT,
113-
name="Agent._arun_stream",
114-
wrapper=None,
115-
)
98+
import agno.agent
99+
unwrap(agno.agent.Agent, "_run")
100+
unwrap(agno.agent.Agent, "_arun")
101+
unwrap(agno.agent.Agent, "_run_stream")
102+
unwrap(agno.agent.Agent, "_arun_stream")
116103

117104
# Unwrap the function call
118-
wrap_function_wrapper(
119-
module=_TOOLKIT,
120-
name="FunctionCall.execute",
121-
wrapper=None,
122-
)
123-
wrap_function_wrapper(
124-
module=_TOOLKIT,
125-
name="FunctionCall.aexecute",
126-
wrapper=None,
127-
)
105+
import agno.tools.function
106+
unwrap(agno.tools.function.FunctionCall, "execute")
107+
unwrap(agno.tools.function.FunctionCall, "aexecute")
128108

129109
# Unwrap the model
130-
wrap_function_wrapper(
131-
module=_MODULE,
132-
name="Model.response",
133-
wrapper=None,
134-
)
135-
wrap_function_wrapper(
136-
module=_MODULE,
137-
name="Model.aresponse",
138-
wrapper=None,
139-
)
140-
wrap_function_wrapper(
141-
module=_MODULE,
142-
name="Model.response_stream",
143-
wrapper=None,
144-
)
145-
wrap_function_wrapper(
146-
module=_MODULE,
147-
name="Model.aresponse_stream",
148-
wrapper=None,
149-
)
110+
import agno.models.base
111+
unwrap(agno.models.base.Model, "response")
112+
unwrap(agno.models.base.Model, "aresponse")
113+
unwrap(agno.models.base.Model, "response_stream")
114+
unwrap(agno.models.base.Model, "aresponse_stream")

0 commit comments

Comments
 (0)