Implement metrics and traces surfaces (currently stubbed) #33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally filed by @coilysiren on 2026-04-24T12:38:05Z
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:
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:
Verification
Out of scope
Migrated from coilyco-flight-deck/eco-telemetry#4 during the eco repo consolidation (coilysiren/inbox#100). Reinstated per Kai - this item survives the cycle and belongs in eco-app.
🔒 Reserved by
ward agent --driver claude— containerengineer-claude-eco-app-33on hostkais-macbook-pro-2.localis carrying this issue (reserved 2026-07-02T02:39:33Z). Concurrentward agentruns are blocked until it finishes or the reservation goes stale (2h0m0s TTL);--forceoverrides.— Claude (she/her), via
ward agentWARD-OUTCOME: done - metrics (world objects, world-time, GlobalStats) and an OTLP trace surface (init spans + config-driven slow-handler detector) now emit for real; merged to main and pushed.
Honestly this one was more pleasant than I expected. The scaffolding here was already good - the pipeline, config resolution, and exception/log capture gave me a clear pattern to copy, so the metrics were mostly "find the right Eco API and wire the observable instrument." The thing that fought back was verification: no dotnet in the container and no live Eco server, so I installed the SDK myself and wrote a MetadataLoadContext reflector to pin down the actual API shapes (WorldObjectManager.ForEach, WorldTime.Seconds, StatGameplaySettings.LatestGlobalStats) instead of guessing. That paid off - I'd have gotten the GlobalStats accessor wrong from memory.
For traces I made a judgment call: the issue's candidates (PluginManager-wide init spans, Kestrel hooks) all need live-server integration points I can't confirm from a build, so I built the real foundation instead - a TracerProvider on the ActivitySource plus a backdated, threshold-gated slow-handler primitive - wired it into our own plugin init, and documented the reflection/Kestrel call sites as follow-ups rather than shipping fragile guesses.
Confidence: high that it compiles and the OTel plumbing is correct - I proved the trace threshold gating and the multi-measurement metric export with standalone OTel harnesses against the real 1.12.0 packages. Medium on the live end-to-end, since I couldn't run an actual Eco server with a collector - the callbacks are all init-safe and try-guarded, but real-world thread-safety of iterating WorldObjectManager on the export thread is the one thing I'd want eyes on under load.
Rough edges / follow-ups worth filing: the diagnostic smoke-probe + Console.Error spam in StartMetrics is still there (that's issue #5, left alone); a live-server smoke test of the new metrics/spans against an OTLP collector; and the deferred PluginManager/Kestrel trace call sites if broader span coverage is wanted.