Skip to content

Conversation

mxiamxia
Copy link
Member

Description of changes:
Handle specific span events by recognizing them via event.name. Move their associated attributes into Log events (as content) and remove them from the original Span Event.

  • gen_ai.assistant.message (output)
  • gen_ai.tool.message (input)
  • gen_ai.user.message (input)
  • gen_ai.system.message (input)
  • gen_ai.choice (output)

Test

{
    "resource": {
        "attributes": {
            "aws.local.service": "langgraph-min",
            "aws.service.type": "gen_ai_agent",
            "telemetry.sdk.language": "python",
            "service.name": "langgraph-min",
            "cloud.resource_id": "fastapi-app",
            "aws.log.group.names": "test_trace-min-4",
            "telemetry.sdk.version": "1.33.1",
            "telemetry.auto.version": "0.11.0.dev0-aws",
            "telemetry.sdk.name": "opentelemetry"
        }
    },
    "scope": {
        "name": "strands.telemetry.tracer"
    },
    "timeUnixNano": 1756004845660372000,
    "observedTimeUnixNano": 1756004845662834000,
    "severityNumber": 9,
    "severityText": "",
    "body": {
        "output": {
            "messages": [
                {
                    "content": {
                        "message": "# Weather Forecast for New York City 🌤️\n\nHere's the current weather forecast for New York City (Manhattan area):\n\n## **Current Conditions (Tonight - Saturday Night, Aug 23)**\n🌙 **Tonight**: Partly Cloudy  \n- **Temperature**: Low around 70°F  \n- **Wind**: South 7-13 mph  \n- **Precipitation**: 0% chance  \n\n## **This Weekend**\n\n### **Sunday (Aug 24)**\n🌤️ **Partly Sunny**  \n- **High**: 77°F  \n- **Wind**: South 7-16 mph  \n- **Precipitation**: 10% chance  \n\n### **Sunday Night**  \n🌧️ **Chance Rain Showers** (after 8pm)  \n- **Low**: 72°F  \n- **Wind**: South 6-15 mph  \n- **Precipitation**: 40% chance  \n\n### **Monday (Aug 25)**  \n🌦️ **Chance Rain Showers**  \n- **High**: 80°F  \n- **Wind**: Southwest 6-10 mph  \n- **Precipitation**: 40% chance  \n\n## **Looking Ahead (Tuesday - Saturday)**\n\n**Tuesday**: ☀️ Sunny, High 76°F - Beautiful day!  \n**Wednesday**: 🌤️ Mostly Sunny, High 73°F  \n**Thursday**: 🌤️ Mostly Sunny, High 76°F  \n**Friday**: 🌤️ Mostly Sunny, High 76°F  \n**Saturday**: 🌤️ Mostly Sunny, High 75°F  \n\n## **Key Highlights**\n- **Pleasant temperatures** in the mid-70s to near 80°F\n- **Possible rain** Sunday night through Monday morning\n- **Great weather** returning Tuesday with sunny skies\n- **Comfortable humidity** levels expected\n- **Light to moderate winds** throughout the period\n\nThis forecast shows typical late August weather for NYC with comfortable temperatures and mostly pleasant conditions, with just a brief chance of showers early in the week before clearing up nicely!\n",
                        "finish_reason": "end_turn"
                    },
                    "role": "assistant"
                }
            ]
        },
        "input": {
            "messages": [
                {
                    "content": "You are a weather assistant with HTTP capabilities. You can:\n\n1. Make HTTP requests to the National Weather Service API\n2. Process and display weather forecast data\n3. Provide weather information for locations in the United States\n\nWhen retrieving weather information:\n1. First get the coordinates or grid information using https://api.weather.gov/points/{latitude},{longitude} or https://api.weather.gov/points/{zipcode}\n2. Then use the returned forecast URL to get the actual forecast\n\nWhen displaying responses:\n- Format weather data in a human-readable way\n- Highlight important information like temperature, precipitation, and alerts\n- Handle errors appropriately\n- Convert technical terms to user-friendly language\n\nAlways explain the weather conditions clearly and provide context for the forecast.\n",
                    "role": "system"
                },
                {
                    "content": {
                        "content": "[{\"text\": \"What is the weather in New York?\"}]"
                    },
                    "role": "user"
                }
            ]
        }
    },
    "attributes": {
        "event.name": "strands.telemetry.tracer"
    },
    "flags": 1,
    "traceId": "68aa81cd356fb8ea277cca6fbd34640d",
    "spanId": "5a3802fa510a2725"
}

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mxiamxia mxiamxia requested a review from a team as a code owner August 24, 2025 03:16
@mxiamxia mxiamxia requested a review from yiyuan-he August 24, 2025 03:29
Copy link
Contributor

@yiyuan-he yiyuan-he left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mxiamxia mxiamxia merged commit 56f3b08 into aws-observability:main Aug 25, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants