Skip to content

Commit

Permalink
Have the OOM exporter also include SSI metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
szegedi committed Aug 14, 2024
1 parent d6cd3b2 commit 4f786ba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
12 changes: 5 additions & 7 deletions integration-tests/profiler/profiler.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ function expectProfileMessagePromise (agent, timeout,
assert.propertyVal(files[0], 'originalname', 'event.json')
event = JSON.parse(files[0].buffer.toString())
assert.propertyVal(event, 'family', 'node')
if (!event.tags_profiler.split(',').includes('snapshot:on_oom')) {
assert.isString(event.info.profiler.activation)
const ssiEnabled = event.info.profiler.ssi.enabled
assert.isBoolean(ssiEnabled)
if (ssiEnabled) {
assert.isString(event.info.profiler.ssi.mechanism)
}
assert.isString(event.info.profiler.activation)
const ssiEnabled = event.info.profiler.ssi.enabled
assert.isBoolean(ssiEnabled)
if (ssiEnabled) {
assert.isString(event.info.profiler.ssi.mechanism)
}
assert.deepPropertyVal(event, 'attachments', fileNames)
for (const [index, fileName] of fileNames.entries()) {
Expand Down
14 changes: 13 additions & 1 deletion packages/dd-trace/src/profiling/exporter_cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,22 @@ function exporterFromURL (url) {
if (url.protocol === 'file:') {
return new FileExporter({ pprofPrefix: fileURLToPath(url) })
} else {
const injectionEnabled = (process.env.DD_INJECTION_ENABLED || '').split(',')
const libraryInjected = injectionEnabled.length > 0
const profilingEnabled = (process.env.DD_PROFILING_ENABLED || '').toLowerCase()
const activation = ['true', '1'].includes(profilingEnabled)
? 'manual'
: profilingEnabled === 'auto'
? 'auto'
: injectionEnabled.includes('profiling')
? 'injection'
: 'unknown'
return new AgentExporter({
url,
logger,
uploadTimeout: timeoutMs
uploadTimeout: timeoutMs,
libraryInjected,
activation
})
}
}
Expand Down

0 comments on commit 4f786ba

Please sign in to comment.