@@ -9,6 +9,7 @@ const { AgentExporter } = require('../../src/profiling/exporters/agent')
9
9
const { FileExporter } = require ( '../../src/profiling/exporters/file' )
10
10
const WallProfiler = require ( '../../src/profiling/profilers/wall' )
11
11
const SpaceProfiler = require ( '../../src/profiling/profilers/space' )
12
+ const EventsProfiler = require ( '../../src/profiling/profilers/events' )
12
13
const { ConsoleLogger } = require ( '../../src/profiling/loggers/console' )
13
14
14
15
const samplingContextsAvailable = process . platform !== 'win32'
@@ -54,7 +55,7 @@ describe('config', () => {
54
55
expect ( config . profilers [ 0 ] . codeHotspotsEnabled ( ) ) . to . equal ( samplingContextsAvailable )
55
56
expect ( config . profilers [ 1 ] ) . to . be . an . instanceof ( SpaceProfiler )
56
57
expect ( config . v8ProfilerBugWorkaroundEnabled ) . true
57
- expect ( config . cpuProfilingEnabled ) . false
58
+ expect ( config . cpuProfilingEnabled ) . to . equal ( samplingContextsAvailable )
58
59
} )
59
60
60
61
it ( 'should support configuration options' , ( ) => {
@@ -86,10 +87,13 @@ describe('config', () => {
86
87
expect ( config . exporters [ 0 ] . _url . toString ( ) ) . to . equal ( options . url )
87
88
expect ( config . exporters [ 1 ] ) . to . be . an . instanceof ( FileExporter )
88
89
expect ( config . profilers ) . to . be . an ( 'array' )
89
- expect ( config . profilers . length ) . to . equal ( 2 )
90
+ expect ( config . profilers . length ) . to . equal ( 2 + samplingContextsAvailable )
90
91
expect ( config . profilers [ 0 ] ) . to . be . an . instanceOf ( SpaceProfiler )
91
92
expect ( config . profilers [ 1 ] ) . to . be . an . instanceOf ( WallProfiler )
92
93
expect ( config . profilers [ 1 ] . codeHotspotsEnabled ( ) ) . false
94
+ if ( samplingContextsAvailable ) {
95
+ expect ( config . profilers [ 2 ] ) . to . be . an . instanceOf ( EventsProfiler )
96
+ }
93
97
} )
94
98
95
99
it ( 'should filter out invalid profilers' , ( ) => {
@@ -145,9 +149,12 @@ describe('config', () => {
145
149
const config = new Config ( options )
146
150
147
151
expect ( config . profilers ) . to . be . an ( 'array' )
148
- expect ( config . profilers . length ) . to . equal ( 1 )
152
+ expect ( config . profilers . length ) . to . equal ( 1 + samplingContextsAvailable )
149
153
expect ( config . profilers [ 0 ] ) . to . be . an . instanceOf ( WallProfiler )
150
154
expect ( config . profilers [ 0 ] . codeHotspotsEnabled ( ) ) . to . equal ( samplingContextsAvailable )
155
+ if ( samplingContextsAvailable ) {
156
+ expect ( config . profilers [ 1 ] ) . to . be . an . instanceOf ( EventsProfiler )
157
+ }
151
158
expect ( config . v8ProfilerBugWorkaroundEnabled ) . false
152
159
expect ( config . cpuProfilingEnabled ) . to . equal ( samplingContextsAvailable )
153
160
} )
@@ -181,8 +188,11 @@ describe('config', () => {
181
188
const config = new Config ( options )
182
189
183
190
expect ( config . profilers ) . to . be . an ( 'array' )
184
- expect ( config . profilers . length ) . to . equal ( 1 )
191
+ expect ( config . profilers . length ) . to . equal ( 1 + samplingContextsAvailable )
185
192
expect ( config . profilers [ 0 ] ) . to . be . an . instanceOf ( WallProfiler )
193
+ if ( samplingContextsAvailable ) {
194
+ expect ( config . profilers [ 1 ] ) . to . be . an . instanceOf ( EventsProfiler )
195
+ }
186
196
} )
187
197
188
198
it ( 'should prioritize options over env variables' , ( ) => {
@@ -204,10 +214,11 @@ describe('config', () => {
204
214
const config = new Config ( options )
205
215
206
216
expect ( config . profilers ) . to . be . an ( 'array' )
207
- expect ( config . profilers . length ) . to . equal ( 1 )
217
+ expect ( config . profilers . length ) . to . equal ( 2 )
208
218
expect ( config . profilers [ 0 ] ) . to . be . an . instanceOf ( WallProfiler )
209
219
expect ( config . profilers [ 0 ] . codeHotspotsEnabled ( ) ) . false
210
220
expect ( config . profilers [ 0 ] . endpointCollectionEnabled ( ) ) . false
221
+ expect ( config . profilers [ 1 ] ) . to . be . an . instanceOf ( EventsProfiler )
211
222
} )
212
223
213
224
it ( 'should prioritize non-experimental env variables and warn about experimental ones' , ( ) => {
@@ -245,10 +256,11 @@ describe('config', () => {
245
256
'Use DD_PROFILING_CODEHOTSPOTS_ENABLED instead.' )
246
257
247
258
expect ( config . profilers ) . to . be . an ( 'array' )
248
- expect ( config . profilers . length ) . to . equal ( 1 )
259
+ expect ( config . profilers . length ) . to . equal ( 2 )
249
260
expect ( config . profilers [ 0 ] ) . to . be . an . instanceOf ( WallProfiler )
250
261
expect ( config . profilers [ 0 ] . codeHotspotsEnabled ( ) ) . false
251
262
expect ( config . profilers [ 0 ] . endpointCollectionEnabled ( ) ) . false
263
+ expect ( config . profilers [ 1 ] ) . to . be . an . instanceOf ( EventsProfiler )
252
264
} )
253
265
254
266
function optionOnlyWorksWithGivenCondition ( property , name , condition ) {
0 commit comments