Implement metrics and traces surfaces (currently stubbed) #4

Open
opened 2026-05-23 20:54:18 +00:00 by coilysiren · 0 comments
Owner

Originally filed by @coilysiren on 2026-04-24T12:38:05Z - https://github.com/coilysiren/eco-telemetry/issues/2

Both the metrics and traces surfaces are currently stubbed no-ops. V1 exception/log capture works; the remaining roadmap items are the OTel metric emitter and the trace-span wrapper.

Metrics (`src/MetricsWorker.cs:34-38`)

Currently a 5-minute sleep loop with no emission. Wire OTel gauges/counters for:

  • `UserManager.OnlineUsers.Count` -> `eco.players.online` gauge
  • `WorldObjectManager` totals (by type) -> `eco.world_objects.count` gauge, tagged by object type
  • `Simulation.Time.WorldTime.Seconds` -> `eco.sim.world_time_seconds` counter
  • Stats plugin data (if accessible) -> `eco.stats.*`

GC/threadpool metrics come free via `OpenTelemetry.Instrumentation.Runtime`; confirm the package is registered.

Traces (`src/TraceSurface.cs:18-21`)

`ActivitySource` is created but nothing starts spans. Candidate integrations:

  • Wrap `PluginManager` init paths in spans (likely needs reflection or a public hook from EcoModKit; investigate).
  • Slow-handler detector: sample handler durations over a threshold (config-driven, e.g. 100ms) and emit as spans.
  • Kestrel request pipeline if the server exposes a hook point.

Verification

  • `dotnet build` succeeds.
  • Local Eco server run with an OTLP collector (e.g. otel-collector-contrib in Docker) shows the new metrics and spans flowing.
  • No regression in exception capture or log interception.

Out of scope

  • Publishing to mod.io (separate task).
  • `IConfigurablePlugin` admin-UI config editing (separate task).
_Originally filed by @coilysiren on 2026-04-24T12:38:05Z - [https://github.com/coilysiren/eco-telemetry/issues/2](https://github.com/coilysiren/eco-telemetry/issues/2)_ Both the metrics and traces surfaces are currently stubbed no-ops. V1 exception/log capture works; the remaining roadmap items are the OTel metric emitter and the trace-span wrapper. ## Metrics (\`src/MetricsWorker.cs:34-38\`) Currently a 5-minute sleep loop with no emission. Wire OTel gauges/counters for: - \`UserManager.OnlineUsers.Count\` -> \`eco.players.online\` gauge - \`WorldObjectManager\` totals (by type) -> \`eco.world_objects.count\` gauge, tagged by object type - \`Simulation.Time.WorldTime.Seconds\` -> \`eco.sim.world_time_seconds\` counter - Stats plugin data (if accessible) -> \`eco.stats.*\` GC/threadpool metrics come free via \`OpenTelemetry.Instrumentation.Runtime\`; confirm the package is registered. ## Traces (\`src/TraceSurface.cs:18-21\`) \`ActivitySource\` is created but nothing starts spans. Candidate integrations: - Wrap \`PluginManager\` init paths in spans (likely needs reflection or a public hook from EcoModKit; investigate). - Slow-handler detector: sample handler durations over a threshold (config-driven, e.g. 100ms) and emit as spans. - Kestrel request pipeline if the server exposes a hook point. ## Verification - \`dotnet build\` succeeds. - Local Eco server run with an OTLP collector (e.g. otel-collector-contrib in Docker) shows the new metrics and spans flowing. - No regression in exception capture or log interception. ## Out of scope - Publishing to mod.io (separate task). - \`IConfigurablePlugin\` admin-UI config editing (separate task).
coilysiren added
P1
and removed
P0
labels 2026-05-31 07:00:26 +00:00
Sign in to join this conversation.
No labels
P0
P1
P2
P3
P4
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
coilyco-flight-deck/eco-telemetry#4
No description provided.