Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/dd-trace/src/profiling/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ class Config {
Number(DD_PROFILING_EXPERIMENTAL_OOM_HEAP_LIMIT_EXTENSION_SIZE), 0)
const maxHeapExtensionCount = coalesce(options.oomMaxHeapExtensionCount,
Number(DD_PROFILING_EXPERIMENTAL_OOM_MAX_HEAP_EXTENSION_COUNT), 0)
const exportStrategies = ensureOOMExportStrategies(coalesce(options.oomExportStrategies,
DD_PROFILING_EXPERIMENTAL_OOM_EXPORT_STRATEGIES), this)
const exportStrategies = oomMonitoringEnabled
? ensureOOMExportStrategies(coalesce(options.oomExportStrategies, DD_PROFILING_EXPERIMENTAL_OOM_EXPORT_STRATEGIES,
[oomExportStrategies.PROCESS]), this)
: []
const exportCommand = oomMonitoringEnabled ? buildExportCommand(this) : undefined
this.oomMonitoring = {
enabled: oomMonitoringEnabled,
Expand Down
21 changes: 21 additions & 0 deletions packages/dd-trace/test/profiling/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,27 @@ describe('config', () => {
})
})

it('should use process as default strategy for OOM heap profiler', () => {
process.env = {
DD_PROFILING_EXPERIMENTAL_OOM_MONITORING_ENABLED: 'true'
}
const config = new Config()

expect(config.oomMonitoring).to.deep.equal({
enabled: true,
heapLimitExtensionSize: 0,
maxHeapExtensionCount: 0,
exportStrategies: ['process'],
exportCommand: [
process.execPath,
path.normalize(path.join(__dirname, '../../src/profiling', 'exporter_cli.js')),
'http://localhost:8126/',
`host:${config.host},service:node,snapshot:on_oom`,
'space'
]
})
})

it('should support OOM heap profiler configuration', () => {
process.env = {
DD_PROFILING_EXPERIMENTAL_OOM_MONITORING_ENABLED: '1',
Expand Down