Files
ottyl/tickets/044-ottyl-fmt-reserved-param-and-renames.md
T

2.4 KiB

044 — Add ottyl_fmt reserved param; rename sequence/timestamp to ottyl_seq/ottyl_ts

Summary

sequence and timestamp are handled as reserved query metric names in the filter grammar (src/filter_parser.rs, e.g. parses_reserved_metric_sequence, parses_reserved_metric_timestamp_as_raw_value) and in alert evaluation (src/alerts.rs:199,208, restricted per the comment at src/alerts.rs:3 to regex/sequence/timestamp/json[field]), backed by LogLine { sequence, timestamp_ms } in src/dto.rs:11-12. These names collide with ordinary user-declared params and don't signal that they're ottyl-owned. Separately, there is currently no reserved param exposing which format (auto_declare_params/auto_derived, src/engine.rs and src/logfmt.rs, added in "Auto derived format") was used to parse a given log line — that information is computed but not surfaced as a queryable/orderable param.

Scope

  • Add a new reserved param ottyl_fmt: a text-enum value recording which format a line was derived with (e.g. auto-detected key=value/logfmt vs. JSON vs. plain/none), populated wherever auto_declare_params/format detection currently runs (src/engine.rs, src/logfmt.rs).
  • Rename the reserved metric names sequence → ottyl_seq and timestamp → ottyl_ts everywhere they're recognized: filter grammar (src/filter_parser.rs), alert query restriction and evaluation (src/alerts.rs), and any webapp references to these literal names (webapp/src/lib/api.ts, webapp/src/components/LogPreview.tsx).
  • Decide and implement backward compatibility: either accept both old and new names for one release, or treat this as a breaking rename (update fixtures/docs accordingly) — call this out explicitly in the PR.
  • Update any docs/help text (e.g. regex cheat sheet, param declaration UI) that reference sequence/timestamp by name.

Acceptance criteria

  • Filters, alert queries, and metric declarations recognize ottyl_seq and ottyl_ts; the old bare names either error clearly or continue to work per the compatibility decision above, but are no longer the documented names.
  • ottyl_fmt is queryable/filterable like other reserved params and its value reflects the actual detected format for a given log line (verified by a seeded fixture with mixed-format lines).
  • Existing tests referencing sequence/timestamp reserved metrics are updated and pass.

Depends on

None.