-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Logging]metrics ops logs include event loop delay histogram data #120451
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,10 +30,29 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics) { | |
// HH:mm:ss message format for backward compatibility | ||
const uptimeValMsg = uptimeVal ? `uptime: ${numeral(uptimeVal).format('00:00:00')} ` : ''; | ||
|
||
// Event loop delay is in ms | ||
// Event loop delay metrics are in ms | ||
const eventLoopDelayVal = process?.event_loop_delay; | ||
const eventLoopDelayValMsg = eventLoopDelayVal | ||
? `delay: ${numeral(process?.event_loop_delay).format('0.000')}` | ||
? `mean delay: ${numeral(process?.event_loop_delay).format('0.000')}` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we have the histogram percentiles in the log message, we need to let folks know that the first delay entry is the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I wonder if it would be more readable to combine the values in the existing
(Edit: Mostly just trying to think how we can keep this as succinct as possible) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We could but that would be a breaking change for folks ingesting the log message. ATM, if someone was parsing the message string they might expect Admittedly, this PR also changes the message string but keeps the delay type the same. Appending the additional data seems like a less risky option here. Admittedly, ingesting log message data isn't the best approach and folks should be using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
However, in the past we have not considered the message format to be stable, and have made breaking changes to it in minors anyway. So I am not super concerned about this either way. |
||
: ''; | ||
|
||
const eventLoopDelayPercentiles = process?.event_loop_delay_histogram?.percentiles; | ||
|
||
// Extract 50th, 95th and 99th percentiles for log meta | ||
const eventLoopDelayHistVals = eventLoopDelayPercentiles | ||
? { | ||
50: eventLoopDelayPercentiles[50], | ||
95: eventLoopDelayPercentiles[95], | ||
99: eventLoopDelayPercentiles[99], | ||
} | ||
: undefined; | ||
// Format message from 50th, 95th and 99th percentiles | ||
const eventLoopDelayHistMsg = eventLoopDelayPercentiles | ||
? ` delay histogram: { 50: ${numeral(eventLoopDelayPercentiles['50']).format( | ||
'0.000' | ||
)}; 95: ${numeral(eventLoopDelayPercentiles['95']).format('0.000')}; 99: ${numeral( | ||
eventLoopDelayPercentiles['99'] | ||
).format('0.000')} }` | ||
: ''; | ||
|
||
const loadEntries = { | ||
|
@@ -65,6 +84,7 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics) { | |
}, | ||
}, | ||
eventLoopDelay: eventLoopDelayVal, | ||
eventLoopDelayHistogram: eventLoopDelayHistVals, | ||
}, | ||
host: { | ||
os: { | ||
|
@@ -75,7 +95,13 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics) { | |
}; | ||
|
||
return { | ||
message: `${processMemoryUsedInBytesMsg}${uptimeValMsg}${loadValsMsg}${eventLoopDelayValMsg}`, | ||
message: [ | ||
processMemoryUsedInBytesMsg, | ||
uptimeValMsg, | ||
loadValsMsg, | ||
eventLoopDelayValMsg, | ||
eventLoopDelayHistMsg, | ||
].join(''), | ||
meta, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The snapshot was getting too big to easily notice a change, so I've changed this assertion to only test the
meta
field.