@@ -12,31 +12,32 @@ const WallProfiler = require('./profilers/wall')
12
12
const SpaceProfiler = require ( './profilers/space' )
13
13
const { oomExportStrategies, snapshotKinds } = require ( './constants' )
14
14
const { tagger } = require ( './tagger' )
15
-
16
- const {
17
- DD_PROFILING_ENABLED ,
18
- DD_PROFILING_PROFILERS ,
19
- DD_PROFILING_ENDPOINT_COLLECTION_ENABLED ,
20
- DD_ENV ,
21
- DD_TAGS ,
22
- DD_SERVICE ,
23
- DD_VERSION ,
24
- DD_TRACE_AGENT_URL ,
25
- DD_AGENT_HOST ,
26
- DD_TRACE_AGENT_PORT ,
27
- DD_PROFILING_UPLOAD_TIMEOUT ,
28
- DD_PROFILING_SOURCE_MAP ,
29
- DD_PROFILING_UPLOAD_PERIOD ,
30
- DD_PROFILING_PPROF_PREFIX ,
31
- DD_PROFILING_EXPERIMENTAL_OOM_MONITORING_ENABLED ,
32
- DD_PROFILING_EXPERIMENTAL_OOM_HEAP_LIMIT_EXTENSION_SIZE ,
33
- DD_PROFILING_EXPERIMENTAL_OOM_MAX_HEAP_EXTENSION_COUNT ,
34
- DD_PROFILING_EXPERIMENTAL_OOM_EXPORT_STRATEGIES
35
- } = process . env
15
+ const { isTrue } = require ( '../util' )
36
16
37
17
class Config {
38
18
constructor ( options = { } ) {
39
- const enabled = coalesce ( options . enabled , DD_PROFILING_ENABLED , true )
19
+ const {
20
+ DD_PROFILING_ENABLED ,
21
+ DD_PROFILING_PROFILERS ,
22
+ DD_PROFILING_ENDPOINT_COLLECTION_ENABLED ,
23
+ DD_ENV ,
24
+ DD_TAGS ,
25
+ DD_SERVICE ,
26
+ DD_VERSION ,
27
+ DD_TRACE_AGENT_URL ,
28
+ DD_AGENT_HOST ,
29
+ DD_TRACE_AGENT_PORT ,
30
+ DD_PROFILING_UPLOAD_TIMEOUT ,
31
+ DD_PROFILING_SOURCE_MAP ,
32
+ DD_PROFILING_UPLOAD_PERIOD ,
33
+ DD_PROFILING_PPROF_PREFIX ,
34
+ DD_PROFILING_EXPERIMENTAL_OOM_MONITORING_ENABLED ,
35
+ DD_PROFILING_EXPERIMENTAL_OOM_HEAP_LIMIT_EXTENSION_SIZE ,
36
+ DD_PROFILING_EXPERIMENTAL_OOM_MAX_HEAP_EXTENSION_COUNT ,
37
+ DD_PROFILING_EXPERIMENTAL_OOM_EXPORT_STRATEGIES
38
+ } = process . env
39
+
40
+ const enabled = isTrue ( coalesce ( options . enabled , DD_PROFILING_ENABLED , true ) )
40
41
const env = coalesce ( options . env , DD_ENV )
41
42
const service = options . service || DD_SERVICE || 'node'
42
43
const host = os . hostname ( )
@@ -53,7 +54,7 @@ class Config {
53
54
const pprofPrefix = coalesce ( options . pprofPrefix ,
54
55
DD_PROFILING_PPROF_PREFIX )
55
56
56
- this . enabled = String ( enabled ) !== 'false'
57
+ this . enabled = enabled
57
58
this . service = service
58
59
this . env = env
59
60
this . host = host
@@ -84,8 +85,8 @@ class Config {
84
85
new AgentExporter ( this )
85
86
] , this )
86
87
87
- const oomMonitoringEnabled = coalesce ( options . oomMonitoring ,
88
- DD_PROFILING_EXPERIMENTAL_OOM_MONITORING_ENABLED , false )
88
+ const oomMonitoringEnabled = isTrue ( coalesce ( options . oomMonitoring ,
89
+ DD_PROFILING_EXPERIMENTAL_OOM_MONITORING_ENABLED , false ) )
89
90
const heapLimitExtensionSize = coalesce ( options . oomHeapLimitExtensionSize ,
90
91
Number ( DD_PROFILING_EXPERIMENTAL_OOM_HEAP_LIMIT_EXTENSION_SIZE ) , 0 )
91
92
const maxHeapExtensionCount = coalesce ( options . oomMaxHeapExtensionCount ,
@@ -136,7 +137,7 @@ function ensureOOMExportStrategies (strategies, options) {
136
137
}
137
138
}
138
139
139
- return strategies
140
+ return [ ... new Set ( strategies ) ]
140
141
}
141
142
142
143
function getExporter ( name , options ) {
0 commit comments