Skip to content

all_message_events truncation #1054

@goradawid

Description

@goradawid

Question

Unable to prevent truncation of all_messages_events in Pydantic Logfire

Issue Description

I'm using PydanticAI with Logfire for monitoring my LLM conversations. I'm working with very long user messages and need to see them completely in Logfire, but I'm consistently encountering truncation:

"logfire.truncated" : [ 0: "all_messages_events", ]

What I've Tried

  • Set OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT and OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT environment variables to large values (10M characters)
  • Used InstrumentationSettings(event_mode="logs") as recommended in the documentation:
    from pydantic_ai import Agent
    from pydantic_ai.agent import InstrumentationSettings
    import logfire
    
    # Configure logfire
    logfire.configure()
    
    # Create instrumentation settings with event_mode='logs'
    instrumentation_settings = InstrumentationSettings(event_mode="logs")
    
    # Create agent with these settings
    agent = Agent(
        'google-gla:gemini-2.5-flash-preview-04-17',
        output_type=KnowledgeGraph,
        deps_type=KnowledgeGraphDeps,
        instrument=instrumentation_settings,
    )

pydantic-ai==0.1.8
logfire==3.14.1

Is there any configuration option or approach I'm missing that would prevent the truncation of these large messages? I need to capture the complete conversation for debugging purposes.
Thanks for any help or guidance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions