Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Logfire Observability Integration
Summary
Add comprehensive structured logging and observability to MassGen using Logfire (by the Pydantic team). This enables detailed tracing of LLM calls, tool executions, and agent coordination for debugging, performance analysis, and production monitoring.
Key Features
1. Automatic LLM Instrumentation
2. Tool Execution Tracing
3. Agent Coordination Observability
4. Graceful Degradation
Usage
CLI Flag (Recommended)
massgen --logfire --config your_config.yaml "Your question"Environment Variable
Programmatic
Setup
logfire auth login--logfireflagType of Change
feat:) - Non-breaking change which adds functionalityFiles Changed
New Files
massgen/structured_logging.pymassgen/tests/test_structured_logging.pydocs/source/user_guide/logging.rstmassgen/skills/massgen-log-analyzer/SKILL.mdmassgen/coordination_tracker.pyModified Files
massgen/cli.py--logfireflag,_setup_logfire_observability()helpermassgen/orchestrator.pymassgen/tool/_manager.pymassgen/mcp_tools/client.pymassgen/subagent/manager.pymassgen/backend/base_with_custom_tool_and_mcp.pymassgen/backend/claude_code.pymassgen/backend/claude.pymassgen/backend/chat_completions.pymassgen/persona_generator.pymassgen/logger_config.pydocs/source/reference/cli.rstpyproject.tomlArchitecture
TracerProxy Pattern
Context Propagation
Span Hierarchy
Querying Data
Logfire uses SQL via DataFusion. The main table is
records. Custom attributes are stored in theattributesJSON column:Environment Variables
MASSGEN_LOGFIRE_ENABLEDtrueto enable (alternative to--logfire)LOGFIRE_TOKENlogfire auth login)LOGFIRE_SERVICE_NAMEmassgen)LOGFIRE_ENVIRONMENTproduction)Checklist
Pre-commit Status
# TODO: Run before PR submission uv run pre-commit run --all-filesHow to Test
Basic Test
Unit Tests
Verify Graceful Degradation
Related Documentation
docs/source/user_guide/logging.rst(Logfire Observability section)docs/source/reference/cli.rst