Skip to content

Commit

Permalink
Add ELU to ops metrics logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeelmers committed Mar 27, 2023
1 parent 1461f3a commit 23617c1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ const testMetrics = {
uptime_in_millis: 1500,
event_loop_delay: 50,
event_loop_delay_histogram: { percentiles: { '50': 50, '75': 75, '95': 95, '99': 99 } },
event_loop_utilization: {
active: 629.1224170000005,
idle: 359.23554199999995,
utilization: 0.6365329598160299,
},
},
os: {
load: {
Expand All @@ -65,7 +70,7 @@ describe('getEcsOpsMetricsLog', () => {
it('provides correctly formatted message', () => {
const result = getEcsOpsMetricsLog(createMockOpsMetrics(testMetrics));
expect(result.message).toMatchInlineSnapshot(
`"memory: 100.0B uptime: 0:00:01 load: [10.00,20.00,30.00] mean delay: 50.000 delay histogram: { 50: 50.000; 95: 95.000; 99: 99.000 }"`
`"memory: 100.0B uptime: 0:00:01 load: [10.00,20.00,30.00] mean delay: 50.000 delay histogram: { 50: 50.000; 95: 95.000; 99: 99.000 } utilization: 0.63653"`
);
});

Expand Down Expand Up @@ -116,6 +121,11 @@ describe('getEcsOpsMetricsLog', () => {
"95": 95,
"99": 99,
},
"eventLoopUtilization": Object {
"active": 629.1224170000005,
"idle": 359.23554199999995,
"utilization": 0.6365329598160299,
},
"memory": Object {
"heap": Object {
"usedInBytes": 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics) {
).format('0.000')} }`
: '';

const eventLoopUtilizationVal = process?.event_loop_utilization;
const eventLoopUtilizationMsg = eventLoopUtilizationVal
? ` utilization: ${numeral(process?.event_loop_utilization.utilization).format('0.00000')}`
: '';

const loadEntries = {
'1m': os?.load ? os?.load['1m'] : undefined,
'5m': os?.load ? os?.load['5m'] : undefined,
Expand Down Expand Up @@ -85,6 +90,7 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics) {
},
eventLoopDelay: eventLoopDelayVal,
eventLoopDelayHistogram: eventLoopDelayHistVals,
eventLoopUtilization: eventLoopUtilizationVal,
},
host: {
os: {
Expand All @@ -101,6 +107,7 @@ export function getEcsOpsMetricsLog(metrics: OpsMetrics) {
loadValsMsg,
eventLoopDelayValMsg,
eventLoopDelayHistMsg,
eventLoopUtilizationMsg,
].join(''),
meta,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ describe('MetricsService', () => {
"process": Object {
"eventLoopDelay": undefined,
"eventLoopDelayHistogram": undefined,
"eventLoopUtilization": undefined,
"memory": Object {
"heap": Object {
"usedInBytes": undefined,
Expand Down

0 comments on commit 23617c1

Please sign in to comment.