Skip to content

Commit 661a5da

Browse files
committed
refactor: polish code with code review.
Change-Id: I228fc9153b9066f096ae2a75906ca57f7f05dd91 Co-developed-by: Cursor <[email protected]>
1 parent 7de9eff commit 661a5da

File tree

3 files changed

+3
-27
lines changed

3 files changed

+3
-27
lines changed

instrumentation-loongsuite/loongsuite-instrumentation-google-adk/pyproject.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dynamic = ["version"]
88
description = "OpenTelemetry instrumentation for Google Agent Development Kit (ADK)"
99
readme = "README.md"
1010
license = "Apache-2.0"
11-
requires-python = ">=3.8"
11+
requires-python = ">=3.9"
1212
authors = [
1313
{ name = "LoongSuite Python Agent Authors" },
1414
]
@@ -18,19 +18,17 @@ classifiers = [
1818
"License :: OSI Approved :: Apache Software License",
1919
"Programming Language :: Python",
2020
"Programming Language :: Python :: 3",
21-
"Programming Language :: Python :: 3.8",
2221
"Programming Language :: Python :: 3.9",
2322
"Programming Language :: Python :: 3.10",
2423
"Programming Language :: Python :: 3.11",
2524
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3.13",
2626
]
2727

2828
dependencies = [
2929
"opentelemetry-api ~= 1.27",
30-
"opentelemetry-sdk ~= 1.27",
30+
"opentelemetry-instrumentation ~= 0.48b0",
3131
"opentelemetry-semantic-conventions ~= 0.48b0",
32-
"wrapt >= 1.0.0, < 2.0.0",
33-
"google-adk >= 0.1.0",
3432
]
3533

3634
[project.optional-dependencies]

instrumentation-loongsuite/loongsuite-instrumentation-google-adk/src/opentelemetry/instrumentation/google_adk/internal/_extractors.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,6 @@ def extract_llm_request_attributes(
326326
except Exception as e:
327327
_logger.debug(f"Failed to extract input messages: {e}")
328328

329-
attrs["input.mime_type"] = "application/json"
330-
# ❌ 移除 gen_ai.request.is_stream (非标准属性)
331-
332329
return attrs
333330

334331
except Exception as e:

instrumentation-loongsuite/loongsuite-instrumentation-google-adk/tests/test_plugin_integration.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,6 @@ class OTelGenAISpanValidator:
7575
},
7676
}
7777

78-
# Non-standard attributes that should NOT be present
79-
NON_STANDARD_ATTRIBUTES = {
80-
"gen_ai.span.kind", # Use gen_ai.operation.name instead
81-
"gen_ai.system", # Use gen_ai.provider.name instead
82-
"gen_ai.session.id", # Use gen_ai.conversation.id instead
83-
"gen_ai.user.id", # Use enduser.id instead
84-
"gen_ai.framework", # Non-standard
85-
"gen_ai.model_name", # Redundant
86-
"gen_ai.request.is_stream", # Non-standard
87-
"gen_ai.usage.total_tokens", # Non-standard
88-
"gen_ai.input.message_count", # Non-standard
89-
"gen_ai.output.message_count", # Non-standard
90-
}
91-
9278
def validate_span(self, span, expected_operation: str) -> Dict[str, Any]:
9379
"""Validate a single span's attributes against OTel GenAI conventions."""
9480
validation_result = {
@@ -114,11 +100,6 @@ def validate_span(self, span, expected_operation: str) -> Dict[str, Any]:
114100
f"Expected operation '{expected_operation}', got '{actual_operation}'"
115101
)
116102

117-
# Check for non-standard attributes
118-
for attr_key in attributes.keys():
119-
if attr_key in self.NON_STANDARD_ATTRIBUTES:
120-
validation_result["non_standard_found"].append(attr_key)
121-
122103
# Validate required and recommended attributes
123104
if expected_operation in self.REQUIRED_ATTRIBUTES_BY_OPERATION:
124105
requirements = self.REQUIRED_ATTRIBUTES_BY_OPERATION[

0 commit comments

Comments
 (0)