Skip to content

Add type-specific observation helpers: trace.generation / trace.span / trace.event #5

Description

@isaka1022

What

Introduce convenience methods on a Trace object so callers can write trace.generation(...), trace.span(...), and trace.event(...) instead of always going through client.observations.create(type: 'GENERATION', trace_id: ...).

Why

The current API requires callers to pass both type and trace_id on every observation, which is verbose and error-prone. Official SDKs (Python, JavaScript) expose typed builder methods on the trace object. Providing the same ergonomics makes the gem feel idiomatic and reduces boilerplate in instrumented code. The competing langfuse-ruby (ai-firstly) gem already ships this pattern.

Effort estimate

M (2–3 days) — introduce a Trace wrapper class that holds trace_id and delegates typed creation calls to the observations client; update docs and add specs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    nowHigh priority - next uproadmapPlanned roadmap item

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions