Skip to content

Instrument CLI entrypoints to create root spans for user-initiated operations #469

@psschwei

Description

@psschwei

Description:
Instrument CLI entrypoints to create root spans for user-initiated operations.

Detailed Requirements:

  1. Create root span for each CLI command:
    • cli.serve - Serve command execution
    • cli.decompose - Decomposition command
    • cli.eval - Evaluation command
    • cli.alora - ALoRA commands
  2. Add command-specific attributes:
    • cli.command - Command name
    • cli.args - Sanitized argument summary (no secrets)
  3. Create reusable decorator or context manager for CLI tracing
  4. Ensure spans are properly closed even on exceptions

Files to Modify:

  • cli/m.py - Add tracing infrastructure
  • cli/serve/app.py - Instrument serve command
  • cli/decompose/decompose.py - Instrument decompose
  • cli/eval/commands.py - Instrument eval commands
  • cli/alora/commands.py - Instrument alora commands

Example Usage:

@app.command()
def serve(port: int = 8000):
    with trace_application("cli.serve", command="serve", port=port):
        # ... serve implementation

Acceptance Criteria:

  • Root span created for each CLI command
  • Command name and relevant args captured
  • Spans closed on success and exception
  • CLI remains functional when tracing disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions