Stop emitting legacy metric/status logs#668
Draft
silvadenisaraujo wants to merge 3 commits into
Draft
Conversation
Specification only (no implementation) for removing the legacy type: metric/status console.log export from trackStatus() while preserving the flush and diagnostics gauge side effects. Internal task id: task-ac9cfeec (bean) Co-authored-by: Cursor <cursoragent@cursor.com>
Clarify that the /_status IPC flow is shared infrastructure (diagnostics gauge refresh + accumulator flush/onFlushMetrics), so only the console.log export is removed and the IPC path is kept. Add Sonar quality-gate note. Co-authored-by: Cursor <cursoragent@cursor.com>
Remove the console.log export (`type: metric/status` / `__VTEX_IO_LOG`) from `trackStatus()`. The status-track route, master/worker IPC flow, Prometheus `/metrics`, billing logs, and diagnostics gauges are unchanged. `global.metrics.statusTrack()` is still called (result discarded) so legacy metric batches keep being flushed and `onFlushMetrics` callbacks keep running; `HttpAgentSingleton.updateHttpAgentMetrics()` still refreshes diagnostics HTTP-agent gauges. Adds focused `statusTrack.test.ts` and updates `docs/METRICS_CATALOG.md`. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Production status tracking currently emits one
__VTEX_IO_LOGentry withtype: metric/statusper flushed legacy metric on every cluster-wide/_statustick, producing ~10M indexed log entries per hour for a stream that is no longer used. This work removes the console-log export fromlogStatus/trackStatus()insrc/service/worker/runtime/statusTrack.tswhile keeping theglobal.metrics.statusTrack()flush (result discarded) and theHttpAgentSingleton.updateHttpAgentMetrics()diagnostics gauge refresh, so the status endpoint, cluster broadcast/IPC flow, Prometheus/metrics, billing/app logs, and diagnostics metrics all stay unchanged.Spec
Status: ✅ approved & implemented.
See specs/stop-emitting-legacy-metric-status-logs.md.
Implementation
trackStatus()emits noconsole.logentry containingtype: metric/status. — Deleted the privatelogStatushelper (the only source of that line) and removed theforEach(...logStatus)loop fromtrackStatus(). Test spies onconsole.logand asserts no call and nometric/statusstring.trackStatus()invokesglobal.metrics.statusTrack()exactly once so legacy metric batches are still flushed. —trackStatus()now callsglobal.metrics.statusTrack()once and discards the return value (kept purely for its flushing side effect). Test mocksglobal.metrics.statusTrackand asserts exactly one call.trackStatus()invokesHttpAgentSingleton.updateHttpAgentMetrics()exactly once so diagnostics HTTP-agent gauges continue to update. — Kept the call as-is. Test spies the static method and asserts exactly one call.trackStatus()behaviors above. — Newsrc/service/worker/runtime/statusTrack.test.ts(3 tests, jest + ts-jest, mirrorsHttpAgentSingleton.test.tsconventions)./_statusroute andbroadcastStatusTrack/statusTrackIPC flow remain unchanged. — No edits tostatusTrackHandler,broadcastStatusTrack,isStatusTrack,isStatusTrackBroadcast,src/service/master.ts, orsrc/service/worker/index.ts./metrics,__VTEX_IO_LOGapplication logs, and__VTEX_IO_BILLINGprocess-time logs remain unchanged. — None of those code paths were touched; only themetric/statusexport insidetrackStatus()was removed. Prom-client cluster aggregation is independent of this legacy export.docs/METRICS_CATALOG.mdno longer describes MetricsAccumulator values as console.log exports and documents that status ticks flush and discard them. — Updated the visual-summary node and the### MetricsAccumulatorsection (and the architecture-overview line) to state the values are accumulated in memory and flushed & discarded on each/_statustick bytrackStatus(), no longer exported viaconsole.log.yarn test,yarn lint, andyarn buildpass. — All three pass locally (full suite: 209 passed, 24 skipped; lint only pre-existing warnings; build clean).Cleanup / notes
logStatus(ACCOUNT,APP,PRODUCTION,WORKSPACE).LINKEDis kept — still used bystatusTrackHandler.EnvMetric/NamedMetric/StatusTracktype exports are kept (imported byMetricsAccumulator.ts).Made with Cursor
Aerie status
Implementation complete
implementaerie/stop-emitting-legacy-metric-status-logsspecs/stop-emitting-legacy-metric-status-logs.mdAcceptance criteria
trackStatus()emits noconsole.logentry containingtype: metric/status.trackStatus()invokesglobal.metrics.statusTrack()exactly once so legacy metric batches are still flushed.trackStatus()invokesHttpAgentSingleton.updateHttpAgentMetrics()exactly once so diagnostics HTTP-agent gauges continue to update.trackStatus()behaviors above./_statusroute andbroadcastStatusTrack/statusTrackIPC flow remain unchanged./metrics,__VTEX_IO_LOGapplication logs, and__VTEX_IO_BILLINGprocess-time logs remain unchanged.docs/METRICS_CATALOG.mdno longer describes MetricsAccumulator values as console.log exports and documents that status ticks flush and discard them.yarn test,yarn lint, andyarn buildpass.Internal task id: task-ac9cfeec (bean)