Skip to content

observability: promote slot-read profiling into request-scoped NDJSON telemetry #43

Description

@Jesssullivan

Why

#40 gave us phase-level slot-read profiling, and live beta checks now show the remaining tail is a generalized cold first-read cost rather than a later-date-specific outlier.

What is still missing is a durable observability surface:

  • hot-path HTTP handlers still emit ad-hoc console.log / console.error
  • slot-read profiles are not correlated with request-level context
  • there is no consistent event schema for perf analysis across /health, /availability/*, and booking flows
  • Modal logs are usable, but not yet structured enough for reliable phase analysis or downstream ingestion

Goals

  • route hot-path bridge logs through the NDJSON logger instead of raw console output
  • add request-scoped context where practical:
    • endpoint
    • service id / resolved service name
    • date / datetime
    • request id or correlation token
    • runtime metadata (modalEnvironment, release sha/version, flow owner)
  • emit slot-read profile events as structured NDJSON records with a stable event name/schema
  • distinguish cold-path events from warm-path events explicitly
  • make the logs legible for both Modal tailing and future external ingestion

Deliverables

  • replace ad-hoc availability/service logs in src/server/handler.ts and related hot paths with ndjsonLog or the shared structured logger
  • define a stable event taxonomy for:
    • request started
    • request completed
    • request failed
    • slot profile long-tail
    • service catalog resolution
  • document the env knobs for profiling / forced logging in the README
  • add focused tests for log formatting/helpers where appropriate

Success Criteria

  • a cold /availability/slots read can be traced in logs with enough structure to separate navigation, settle, wait, DOM-read, and parse time
  • downstream log analysis does not depend on parsing human prose strings
  • Modal runtime logs become a reliable evidence source for #148-style perf investigation and future paper material

Related

  • follows #20
  • supports #10
  • should inform future runtime portability work beyond Modal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions