|
34 | 34 | from google.adk.tools.base_tool import BaseTool |
35 | 35 | from google.genai import types |
36 | 36 | from opentelemetry._logs import LogRecord |
| 37 | +from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import GEN_AI_AGENT_NAME |
37 | 38 | from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import GEN_AI_CONVERSATION_ID |
38 | 39 | from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import GEN_AI_OPERATION_NAME |
39 | 40 | from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import GEN_AI_REQUEST_MODEL |
40 | 41 | from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import GEN_AI_RESPONSE_FINISH_REASONS |
41 | 42 | from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import GEN_AI_SYSTEM |
42 | 43 | from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import GEN_AI_USAGE_INPUT_TOKENS |
43 | 44 | from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import GEN_AI_USAGE_OUTPUT_TOKENS |
| 45 | +from opentelemetry.semconv._incubating.attributes.user_attributes import USER_ID |
44 | 46 | import pytest |
45 | 47 |
|
46 | 48 |
|
@@ -709,8 +711,11 @@ async def test_generate_content_span( |
709 | 711 | mock_span.set_attribute.assert_any_call(GEN_AI_USAGE_OUTPUT_TOKENS, 20) |
710 | 712 |
|
711 | 713 | mock_span.set_attributes.assert_called_once_with({ |
| 714 | + GEN_AI_AGENT_NAME: invocation_context.agent.name, |
712 | 715 | GEN_AI_CONVERSATION_ID: invocation_context.session.id, |
| 716 | + USER_ID: invocation_context.session.user_id, |
713 | 717 | 'gcp.vertex.agent.event_id': 'event-123', |
| 718 | + 'gcp.vertex.agent.invocation_id': invocation_context.invocation_id, |
714 | 719 | }) |
715 | 720 |
|
716 | 721 | # Assert Logs |
|
0 commit comments