Skip to content

Telemetry sink cannot be set after Runtime construction #22

Description

@liamcrumm

Runtime takes its telemetry sink at construction and exposes no way to change or read it afterwards. Its fields are private and it offers no accessors, so a host that wants to install a sink after building a runtime has to rebuild the runtime from the inputs it retained. That only works for manifest-based constructors, and it silently discards anything the original build derived.

agent-governance-toolkit works around this in AgentControl::with_telemetry, which keeps the manifest, dispatchers, and limits so it can call Runtime::with_telemetry_perf_and_limits again. Retaining the limits was not obvious: an earlier version rebuilt with Runtime::with_telemetry, which restores Limits::default() and quietly widened a budget the caller had tightened.

Two smaller pieces are missing alongside it:

  • TelemetrySink has no force_flush, so a host cannot drain buffered events before exit
  • TelemetryEvent has no to_json, so every consumer writes its own projection and they drift

The pre-extraction AGT engine had Runtime::set_telemetry and with_telemetry_sink, plus both of the above. AGT now carries reimplementations in core/src/telemetry_sinks.rs.

A setter on Runtime, or accessors sufficient to rebuild faithfully, would remove the workaround. force_flush and to_json are independent and smaller.

Verified against the published 0.4.0-alpha.1 sources.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions