Skip to content

Commit ecbee2d

Browse files
authored
Enhance documentation and functionality for trace management (#1012)
* Enhance documentation and functionality for trace management - Updated `mint.json` to include new usage paths for trace decorators and manual trace control. - Revised `introduction.mdx` to reflect changes in session tracking terminology, replacing "sessions" with "traces" for clarity. - Expanded `quickstart.mdx` to introduce the `@trace` decorator and manual trace management examples. - Added new documentation files for `manual-trace-control.mdx` and `trace-decorator.mdx`, detailing advanced trace management techniques and usage patterns. - Updated `sdk-reference.mdx` to include new parameters for trace management and improved examples for initializing the AgentOps SDK. - Enhanced `tracking-agents.mdx` to demonstrate multi-agent workflows and coordination using the `@trace` decorator. These changes improve the clarity and usability of the AgentOps SDK, particularly around trace management and agent tracking. * Enhance documentation for trace management and agent tracking - Updated `introduction.mdx` to clarify the use of the `@trace` decorator for custom trace creation. - Revised `quickstart.mdx` to include examples of initializing AgentOps with manual trace control. - Improved `examples.mdx` by updating image links to use raw GitHub URLs for better accessibility. - Enhanced `manual-trace-control.mdx` to provide detailed examples of managing traces manually. - Updated `recording-operations.mdx` to emphasize the use of the `@trace` decorator for grouping operations. - Refined `sdk-reference.mdx` to clarify parameters for ending traces and the use of decorators. - Improved `tracking-agents.mdx` to demonstrate structured tracking with the `@agent` decorator in multi-agent systems. These changes improve the clarity and usability of the AgentOps SDK, particularly around trace management and agent tracking. * Add Google Generative AI instrumentation module - Introduced a new module for Google Generative AI (Gemini) API instrumentation, including `GoogleGenAIInstrumentor` for capturing telemetry data. - Added attribute extraction functions for model and chat interactions, enhancing observability of API calls. - Implemented wrappers for synchronous and asynchronous streaming methods to track performance metrics. - Updated documentation to include usage examples and details on supported features for the new instrumentation. - Refactored existing code to accommodate the new module structure and improve clarity. These changes enhance the AgentOps SDK by providing comprehensive support for monitoring Google Generative AI interactions. * Update mint.json to reorder integration paths, moving 'anthropic' to the correct position in the integrations list. This change improves the organization and accessibility of integration documentation.
1 parent e586cee commit ecbee2d

23 files changed

+1960
-312
lines changed

agentops/instrumentation/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ class InstrumentorConfig(TypedDict):
183183
"min_version": "0.1.0",
184184
},
185185
"google.genai": {
186-
"module_name": "agentops.instrumentation.google_generativeai",
187-
"class_name": "GoogleGenerativeAIInstrumentor",
186+
"module_name": "agentops.instrumentation.google_genai",
187+
"class_name": "GoogleGenAIInstrumentor",
188188
"min_version": "0.1.0",
189189
"package_name": "google-genai", # Actual pip package name
190190
},
File renamed without changes.

agentops/instrumentation/google_generativeai/__init__.py renamed to agentops/instrumentation/google_genai/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def get_version() -> str:
3131
logger = logging.getLogger(__name__)
3232

3333
# Import after defining constants to avoid circular imports
34-
from agentops.instrumentation.google_generativeai.instrumentor import GoogleGenerativeAIInstrumentor # noqa: E402
34+
from agentops.instrumentation.google_genai.instrumentor import GoogleGenAIInstrumentor # noqa: E402
3535

3636
__all__ = [
3737
"LIBRARY_NAME",
3838
"LIBRARY_VERSION",
39-
"GoogleGenerativeAIInstrumentor",
39+
"GoogleGenAIInstrumentor",
4040
]

agentops/instrumentation/google_generativeai/attributes/__init__.py renamed to agentops/instrumentation/google_genai/attributes/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
"""Attribute extractors for Google Generative AI instrumentation."""
22

3-
from agentops.instrumentation.google_generativeai.attributes.common import (
3+
from agentops.instrumentation.google_genai.attributes.common import (
44
get_common_instrumentation_attributes,
55
extract_request_attributes,
66
)
7-
from agentops.instrumentation.google_generativeai.attributes.model import (
7+
from agentops.instrumentation.google_genai.attributes.model import (
88
get_model_attributes,
99
get_generate_content_attributes,
1010
get_stream_attributes,
1111
get_token_counting_attributes,
1212
)
13-
from agentops.instrumentation.google_generativeai.attributes.chat import (
13+
from agentops.instrumentation.google_genai.attributes.chat import (
1414
get_chat_attributes,
1515
)
1616

agentops/instrumentation/google_generativeai/attributes/chat.py renamed to agentops/instrumentation/google_genai/attributes/chat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
from agentops.logging import logger
66
from agentops.semconv import SpanAttributes, LLMRequestTypeValues, MessageAttributes
77
from agentops.instrumentation.common.attributes import AttributeMap
8-
from agentops.instrumentation.google_generativeai.attributes.common import (
8+
from agentops.instrumentation.google_genai.attributes.common import (
99
extract_request_attributes,
1010
get_common_instrumentation_attributes,
1111
)
12-
from agentops.instrumentation.google_generativeai.attributes.model import (
12+
from agentops.instrumentation.google_genai.attributes.model import (
1313
_extract_content_from_prompt,
1414
_set_response_attributes,
1515
)

agentops/instrumentation/google_generativeai/attributes/common.py renamed to agentops/instrumentation/google_genai/attributes/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
get_common_attributes,
1010
_extract_attributes_from_mapping,
1111
)
12-
from agentops.instrumentation.google_generativeai import LIBRARY_NAME, LIBRARY_VERSION
12+
from agentops.instrumentation.google_genai import LIBRARY_NAME, LIBRARY_VERSION
1313

1414
# Common mapping for config parameters
1515
REQUEST_CONFIG_ATTRIBUTES: AttributeMap = {

agentops/instrumentation/google_generativeai/attributes/model.py renamed to agentops/instrumentation/google_genai/attributes/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from agentops.logging import logger
66
from agentops.semconv import SpanAttributes, LLMRequestTypeValues, MessageAttributes
77
from agentops.instrumentation.common.attributes import AttributeMap
8-
from agentops.instrumentation.google_generativeai.attributes.common import (
8+
from agentops.instrumentation.google_genai.attributes.common import (
99
extract_request_attributes,
1010
get_common_instrumentation_attributes,
1111
)

agentops/instrumentation/google_generativeai/instrumentor.py renamed to agentops/instrumentation/google_genai/instrumentor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
from agentops.logging import logger
1818
from agentops.instrumentation.common.wrappers import WrapConfig, wrap, unwrap
19-
from agentops.instrumentation.google_generativeai import LIBRARY_NAME, LIBRARY_VERSION
20-
from agentops.instrumentation.google_generativeai.attributes.model import (
19+
from agentops.instrumentation.google_genai import LIBRARY_NAME, LIBRARY_VERSION
20+
from agentops.instrumentation.google_genai.attributes.model import (
2121
get_generate_content_attributes,
2222
get_token_counting_attributes,
2323
)
24-
from agentops.instrumentation.google_generativeai.stream_wrapper import (
24+
from agentops.instrumentation.google_genai.stream_wrapper import (
2525
generate_content_stream_wrapper,
2626
generate_content_stream_async_wrapper,
2727
)
@@ -96,7 +96,7 @@
9696
]
9797

9898

99-
class GoogleGenerativeAIInstrumentor(BaseInstrumentor):
99+
class GoogleGenAIInstrumentor(BaseInstrumentor):
100100
"""An instrumentor for Google Generative AI (Gemini) API.
101101
102102
This class provides instrumentation for Google's Generative AI API by wrapping key methods

agentops/instrumentation/google_generativeai/stream_wrapper.py renamed to agentops/instrumentation/google_genai/stream_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
from agentops.semconv import SpanAttributes, LLMRequestTypeValues, CoreAttributes, MessageAttributes
1616
from agentops.instrumentation.common.wrappers import _with_tracer_wrapper
17-
from agentops.instrumentation.google_generativeai.attributes.model import (
17+
from agentops.instrumentation.google_genai.attributes.model import (
1818
get_generate_content_attributes,
1919
get_stream_attributes,
2020
)
21-
from agentops.instrumentation.google_generativeai.attributes.common import (
21+
from agentops.instrumentation.google_genai.attributes.common import (
2222
extract_request_attributes,
2323
)
2424

docs/mint.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@
167167
{
168168
"group": "Integrations",
169169
"pages": [
170-
"v2/integrations/anthropic",
170+
"v2/integrations/ag2",
171171
"v2/integrations/autogen",
172+
"v2/integrations/anthropic",
172173
"v2/integrations/crewai",
173174
"v2/integrations/google_adk",
174175
"v2/integrations/gemini",
@@ -188,7 +189,9 @@
188189
"v2/usage/advanced-configuration",
189190
"v2/usage/tracking-llm-calls",
190191
"v2/usage/tracking-agents",
191-
"v2/usage/recording-operations"
192+
"v2/usage/recording-operations",
193+
"v2/usage/trace-decorator",
194+
"v2/usage/manual-trace-control"
192195
],
193196
"version": "v2"
194197
},

0 commit comments

Comments
 (0)