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

Skip to content

Commit e8aa55e

Browse files
authored
Reduce memory usage of profile encoding (#6381)
* Update pprof-nodejs to 5.10.0 * Mark thread labels and trace endpoint label as good deduplication candidates
1 parent 4de1d2c commit e8aa55e

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"@datadog/native-appsec": "10.2.1",
118118
"@datadog/native-iast-taint-tracking": "4.0.0",
119119
"@datadog/native-metrics": "3.1.1",
120-
"@datadog/pprof": "5.9.0",
120+
"@datadog/pprof": "5.10.0",
121121
"@datadog/sketches-js": "2.1.1",
122122
"@datadog/wasm-js-rewriter": "4.0.1",
123123
"@isaacs/ttlcache": "^1.4.1",
@@ -138,7 +138,7 @@
138138
"mutexify": "^1.4.0",
139139
"opentracing": ">=0.14.7",
140140
"path-to-regexp": "^0.1.12",
141-
"pprof-format": "^2.1.0",
141+
"pprof-format": "^2.1.1",
142142
"protobufjs": "^7.5.3",
143143
"retry": "^0.13.1",
144144
"rfdc": "^1.4.1",

packages/dd-trace/src/profiling/profilers/wall.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const {
1313
getThreadLabels,
1414
encodeProfileAsync
1515
} = require('./shared')
16+
const TRACE_ENDPOINT_LABEL = 'trace endpoint'
1617

1718
const { isWebServerSpan, endpointNameFromTags, getStartedSpans } = require('../webspan-utils')
1819

@@ -251,7 +252,12 @@ class NativeWallProfiler {
251252
this._enter()
252253
this._lastSampleCount = 0
253254
}
254-
const profile = this._pprof.time.stop(restart, this._generateLabels)
255+
256+
// Mark thread labels and trace endpoint label as good deduplication candidates
257+
const lowCardinalityLabels = Object.keys(getThreadLabels())
258+
lowCardinalityLabels.push(TRACE_ENDPOINT_LABEL)
259+
260+
const profile = this._pprof.time.stop(restart, this._generateLabels, lowCardinalityLabels)
255261

256262
if (restart) {
257263
const v8BugDetected = this._pprof.time.v8ProfilerStuckEventLoopDetected()
@@ -312,10 +318,10 @@ class NativeWallProfiler {
312318
labels[LOCAL_ROOT_SPAN_ID_LABEL] = rootSpanId
313319
}
314320
if (webTags !== undefined && Object.keys(webTags).length !== 0) {
315-
labels['trace endpoint'] = endpointNameFromTags(webTags)
321+
labels[TRACE_ENDPOINT_LABEL] = endpointNameFromTags(webTags)
316322
} else if (endpoint) {
317323
// fallback to endpoint computed when sample was taken
318-
labels['trace endpoint'] = endpoint
324+
labels[TRACE_ENDPOINT_LABEL] = endpoint
319325
}
320326

321327
return labels

yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,15 @@
239239
node-addon-api "^6.1.0"
240240
node-gyp-build "^3.9.0"
241241

242-
"@datadog/pprof@5.9.0":
243-
version "5.9.0"
244-
resolved "https://registry.yarnpkg.com/@datadog/pprof/-/pprof-5.9.0.tgz#beacd1507304e3490900ff39ea108e7ea772921b"
245-
integrity sha512-7KretVkHUANWe31u9cGJpxmUkyrXsCD+fmlZQUz/zk9mtQNC4uBIKX53VUFfrVj/bxAhEEIPw5XTYiMc5RJLsw==
242+
"@datadog/pprof@5.10.0":
243+
version "5.10.0"
244+
resolved "https://registry.yarnpkg.com/@datadog/pprof/-/pprof-5.10.0.tgz#47e9589c6d9c423470e312e00def06e249672571"
245+
integrity sha512-tEMhLeOM78FHC/rTltDd7pQN8WPAUZ1b0BPadYsKWqo/v6jWTbF6xeIMojdJa5yIW2vHjDU4LFJpkFFNacHpQw==
246246
dependencies:
247247
delay "^5.0.0"
248248
node-gyp-build "<4.0"
249249
p-limit "^3.1.0"
250-
pprof-format "^2.1.0"
250+
pprof-format "^2.2.1"
251251
source-map "^0.7.4"
252252

253253
"@datadog/[email protected]":
@@ -3793,10 +3793,10 @@ possible-typed-array-names@^1.0.0:
37933793
resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz#93e3582bc0e5426586d9d07b79ee40fc841de4ae"
37943794
integrity sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==
37953795

3796-
pprof-format@^2.1.0:
3797-
version "2.1.0"
3798-
resolved "https://registry.yarnpkg.com/pprof-format/-/pprof-format-2.1.0.tgz#acc8d7773bcf4faf0a3d3df11bceefba7ac06664"
3799-
integrity sha512-0+G5bHH0RNr8E5hoZo/zJYsL92MhkZjwrHp3O2IxmY8RJL9ooKeuZ8Tm0ZNBw5sGZ9TiM71sthTjWoR2Vf5/xw==
3796+
pprof-format@^2.1.1, pprof-format@^2.2.1:
3797+
version "2.2.1"
3798+
resolved "https://registry.yarnpkg.com/pprof-format/-/pprof-format-2.2.1.tgz#64d32207fb46990349eb52825defb449d6ccc9b4"
3799+
integrity sha512-p4tVN7iK19ccDqQv8heyobzUmbHyds4N2FI6aBMcXz6y99MglTWDxIyhFkNaLeEXs6IFUEzT0zya0icbSLLY0g==
38003800

38013801
prelude-ls@^1.2.1:
38023802
version "1.2.1"

0 commit comments

Comments
 (0)