diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/telemetry/spans.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/telemetry/spans.py index 5222b407..192a8e16 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/telemetry/spans.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/telemetry/spans.py @@ -49,6 +49,8 @@ def _get_attributes(self) -> AttributeMap: attributes.ACTIVITY_TYPE: self._turn_context.activity.type, attributes.ACTIVITY_ID: self._turn_context.activity.id or attributes.UNKNOWN, + attributes.ACTIVITY_NAME: self._turn_context.activity.name + or attributes.UNKNOWN, } def share(self, route_authorized: bool, route_matched: bool) -> None: diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/telemetry/attributes.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/telemetry/attributes.py index 81b4e322..28b526d4 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/telemetry/attributes.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/telemetry/attributes.py @@ -5,6 +5,7 @@ ACTIVITY_CHANNEL_ID = "activity.channel_id" ACTIVITY_ID = "activity.id" ACTIVITY_COUNT = "activities.count" +ACTIVITY_NAME = "activity.name" ACTIVITY_TYPE = "activity.type" AGENTIC_USER_ID = "agentic.user_id" diff --git a/tests/hosting_core/telemetry/test_app_spans.py b/tests/hosting_core/telemetry/test_app_spans.py index 45ac5eb2..662518c5 100644 --- a/tests/hosting_core/telemetry/test_app_spans.py +++ b/tests/hosting_core/telemetry/test_app_spans.py @@ -48,7 +48,7 @@ def test_app_on_turn_creates_span(test_exporter): def test_app_on_turn_span_attributes(test_exporter): - ctx = _make_context(id="act-1") + ctx = _make_context(id="act-1", name="message-received") with AppOnTurn(ctx): pass @@ -56,6 +56,7 @@ def test_app_on_turn_span_attributes(test_exporter): span = test_exporter.get_finished_spans()[0] assert span.attributes[attributes.ACTIVITY_TYPE] == "message" assert span.attributes[attributes.ACTIVITY_ID] == "act-1" + assert span.attributes[attributes.ACTIVITY_NAME] == "message-received" def test_app_on_turn_span_attributes_missing_id(test_exporter): @@ -67,6 +68,7 @@ def test_app_on_turn_span_attributes_missing_id(test_exporter): span = test_exporter.get_finished_spans()[0] assert span.attributes[attributes.ACTIVITY_TYPE] == "message" assert span.attributes[attributes.ACTIVITY_ID] == attributes.UNKNOWN + assert span.attributes[attributes.ACTIVITY_NAME] == attributes.UNKNOWN def test_app_on_turn_records_turn_metrics(test_exporter, test_metric_reader):