Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e57ed0f

Browse files
authored
fix gc pause metric using millis instead of nanos (#6321)
* fix gc pause metric using millis instead of nanos * remove object support for gc option which was unintended
1 parent ecf3445 commit e57ed0f

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

packages/dd-trace/src/config.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,6 @@ class Config {
323323
}
324324
}
325325

326-
if (typeof options.runtimeMetrics?.gc === 'boolean') {
327-
options.runtimeMetrics.gc = {
328-
enabled: options.runtimeMetrics.gc
329-
}
330-
}
331-
332326
const DD_INSTRUMENTATION_INSTALL_ID = coalesce(
333327
getEnvironmentVariable('DD_INSTRUMENTATION_INSTALL_ID'),
334328
null
@@ -1202,7 +1196,7 @@ class Config {
12021196
this._setBoolean(opts, 'reportHostname', options.reportHostname)
12031197
this._setBoolean(opts, 'runtimeMetrics.enabled', options.runtimeMetrics?.enabled)
12041198
this._setBoolean(opts, 'runtimeMetrics.eventLoop', options.runtimeMetrics?.eventLoop)
1205-
this._setBoolean(opts, 'runtimeMetrics.gc', options.runtimeMetrics?.gc?.enabled)
1199+
this._setBoolean(opts, 'runtimeMetrics.gc', options.runtimeMetrics?.gc)
12061200
this._setBoolean(opts, 'runtimeMetricsRuntimeId', options.runtimeMetricsRuntimeId)
12071201
this._setArray(opts, 'sampler.spanSamplingRules', reformatSpanSamplingRules(options.spanSamplingRules))
12081202
this._setUnit(opts, 'sampleRate', coalesce(options.sampleRate, options.ingestion.sampleRate))

packages/dd-trace/src/runtime_metrics/runtime_metrics.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,10 @@ function startGCObserver () {
274274
gcObserver = new PerformanceObserver(list => {
275275
for (const entry of list.getEntries()) {
276276
const type = gcType(entry.detail?.kind || entry.kind)
277+
const duration = entry.duration * 1_000_000
277278

278-
runtimeMetrics.histogram('runtime.node.gc.pause.by.type', entry.duration, `gc_type:${type}`)
279-
runtimeMetrics.histogram('runtime.node.gc.pause', entry.duration)
279+
runtimeMetrics.histogram('runtime.node.gc.pause.by.type', duration, `gc_type:${type}`)
280+
runtimeMetrics.histogram('runtime.node.gc.pause', duration)
280281
}
281282
})
282283

0 commit comments

Comments
 (0)