Skip to content

Commit d992a71

Browse files
refactor(metrics): drop metric/status log export (#677)
* refactor(metrics): drop metric/status log export The status log written to stdout is no longer consumed downstream. The statusTrack() call is kept because flushMetrics() also resets the metric accumulators, the CPU usage baseline and the incoming request stats. Co-authored-by: Cursor <cursoragent@cursor.com> * Release 6.51.1-beta * Update version to 6.51.1 --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent cde391b commit d992a71

2 files changed

Lines changed: 6 additions & 17 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vtex/api",
3-
"version": "6.51.0",
3+
"version": "6.51.1",
44
"description": "VTEX I/O API client",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",

src/service/worker/runtime/statusTrack.ts

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import cluster from 'cluster'
22

3-
import { ACCOUNT, APP, LINKED, PRODUCTION, WORKSPACE } from '../../../constants'
3+
import { LINKED } from '../../../constants'
44
import { ServiceContext } from './typings'
55

66
export type StatusTrack = () => EnvMetric[]
@@ -33,23 +33,12 @@ export const statusTrackHandler = async (ctx: ServiceContext) => {
3333
}
3434

3535
export const trackStatus = () => {
36-
global.metrics.statusTrack().forEach(status => {
37-
logStatus(status)
38-
})
36+
// Flushing resets the metric accumulators, the CPU usage baseline and the
37+
// incoming request stats, so it must keep running even though nothing
38+
// consumes the returned metrics anymore.
39+
global.metrics.statusTrack()
3940
}
4041

4142
export const broadcastStatusTrack = () => Object.values(cluster.workers).forEach(
4243
worker => worker?.send(STATUS_TRACK)
4344
)
44-
45-
const logStatus = (status: EnvMetric) => console.log(JSON.stringify({
46-
__VTEX_IO_LOG: true,
47-
account: ACCOUNT,
48-
app: APP.ID,
49-
isLink: LINKED,
50-
pid: process.pid,
51-
production: PRODUCTION,
52-
status,
53-
type: 'metric/status',
54-
workspace: WORKSPACE,
55-
}))

0 commit comments

Comments
 (0)