@@ -106,15 +106,15 @@ describe('profiler', function () {
106
106
} )
107
107
108
108
it ( 'should start the internal time profilers' , async ( ) => {
109
- await profiler . _start ( { profilers, exporters } )
109
+ profiler . start ( { profilers, exporters } )
110
110
111
111
sinon . assert . calledOnce ( wallProfiler . start )
112
112
sinon . assert . calledOnce ( spaceProfiler . start )
113
113
} )
114
114
115
115
it ( 'should start only once' , async ( ) => {
116
- await profiler . _start ( { profilers, exporters } )
117
- await profiler . _start ( { profilers, exporters } )
116
+ profiler . start ( { profilers, exporters } )
117
+ profiler . start ( { profilers, exporters } )
118
118
119
119
sinon . assert . calledOnce ( wallProfiler . start )
120
120
sinon . assert . calledOnce ( spaceProfiler . start )
@@ -127,7 +127,7 @@ describe('profiler', function () {
127
127
]
128
128
129
129
for ( const exporters of checks ) {
130
- await profiler . _start ( {
130
+ profiler . start ( {
131
131
sourceMap : false ,
132
132
exporters
133
133
} )
@@ -149,7 +149,7 @@ describe('profiler', function () {
149
149
] . map ( profilers => profilers . filter ( profiler => samplingContextsAvailable || profiler !== EventsProfiler ) )
150
150
151
151
for ( const [ profilers , ...expected ] of checks ) {
152
- await profiler . _start ( {
152
+ profiler . start ( {
153
153
sourceMap : false ,
154
154
profilers
155
155
} )
@@ -164,7 +164,7 @@ describe('profiler', function () {
164
164
} )
165
165
166
166
it ( 'should stop the internal profilers' , async ( ) => {
167
- await profiler . _start ( { profilers, exporters } )
167
+ profiler . start ( { profilers, exporters } )
168
168
profiler . stop ( )
169
169
170
170
sinon . assert . calledOnce ( wallProfiler . stop )
@@ -174,7 +174,7 @@ describe('profiler', function () {
174
174
it ( 'should stop when starting failed' , async ( ) => {
175
175
wallProfiler . start . throws ( )
176
176
177
- await profiler . _start ( { profilers, exporters, logger } )
177
+ profiler . start ( { profilers, exporters, logger } )
178
178
179
179
sinon . assert . calledOnce ( wallProfiler . stop )
180
180
sinon . assert . calledOnce ( spaceProfiler . stop )
@@ -184,7 +184,7 @@ describe('profiler', function () {
184
184
it ( 'should stop when capturing failed' , async ( ) => {
185
185
wallProfiler . profile . throws ( new Error ( 'boom' ) )
186
186
187
- await profiler . _start ( { profilers, exporters, logger } )
187
+ profiler . start ( { profilers, exporters, logger } )
188
188
189
189
clock . tick ( interval )
190
190
@@ -200,7 +200,7 @@ describe('profiler', function () {
200
200
const rejected = Promise . reject ( new Error ( 'boom' ) )
201
201
wallProfiler . encode . returns ( rejected )
202
202
203
- await profiler . _start ( { profilers, exporters, logger } )
203
+ profiler . start ( { profilers, exporters, logger } )
204
204
205
205
clock . tick ( interval )
206
206
@@ -217,7 +217,7 @@ describe('profiler', function () {
217
217
const rejected = Promise . reject ( new Error ( 'boom' ) )
218
218
exporter . export . returns ( rejected )
219
219
220
- await profiler . _start ( { profilers, exporters, logger } )
220
+ profiler . start ( { profilers, exporters, logger } )
221
221
222
222
clock . tick ( interval )
223
223
@@ -230,7 +230,7 @@ describe('profiler', function () {
230
230
} )
231
231
232
232
it ( 'should flush when the interval is reached' , async ( ) => {
233
- await profiler . _start ( { profilers, exporters } )
233
+ profiler . start ( { profilers, exporters } )
234
234
235
235
clock . tick ( interval )
236
236
@@ -240,7 +240,7 @@ describe('profiler', function () {
240
240
} )
241
241
242
242
it ( 'should flush when the profiler is stopped' , async ( ) => {
243
- await profiler . _start ( { profilers, exporters } )
243
+ profiler . start ( { profilers, exporters } )
244
244
245
245
profiler . stop ( )
246
246
@@ -268,7 +268,7 @@ describe('profiler', function () {
268
268
process . env = {
269
269
DD_PROFILING_DEBUG_UPLOAD_COMPRESSION : compression
270
270
}
271
- await profiler . _start ( { profilers, exporters, tags : { foo : 'foo' } } )
271
+ profiler . start ( { profilers, exporters, tags : { foo : 'foo' } } )
272
272
process . env = env
273
273
274
274
clock . tick ( interval )
@@ -310,7 +310,7 @@ describe('profiler', function () {
310
310
it ( 'should log exporter errors' , async ( ) => {
311
311
exporter . export . rejects ( new Error ( 'boom' ) )
312
312
313
- await profiler . _start ( { profilers, exporters, logger } )
313
+ profiler . start ( { profilers, exporters, logger } )
314
314
315
315
clock . tick ( interval )
316
316
@@ -322,7 +322,7 @@ describe('profiler', function () {
322
322
it ( 'should log encoded profile' , async ( ) => {
323
323
exporter . export . rejects ( new Error ( 'boom' ) )
324
324
325
- await profiler . _start ( { profilers, exporters, logger } )
325
+ profiler . start ( { profilers, exporters, logger } )
326
326
327
327
clock . tick ( interval )
328
328
@@ -347,7 +347,7 @@ describe('profiler', function () {
347
347
} )
348
348
349
349
it ( 'should have a new start time for each capture' , async ( ) => {
350
- await profiler . _start ( { profilers, exporters } )
350
+ profiler . start ( { profilers, exporters } )
351
351
352
352
clock . tick ( interval )
353
353
await waitForExport ( )
@@ -374,7 +374,7 @@ describe('profiler', function () {
374
374
} )
375
375
376
376
it ( 'should not pass source mapper to profilers when disabled' , async ( ) => {
377
- await profiler . _start ( { profilers, exporters, sourceMap : false } )
377
+ profiler . start ( { profilers, exporters, sourceMap : false } )
378
378
379
379
const options = profilers [ 0 ] . start . args [ 0 ] [ 0 ]
380
380
expect ( options ) . to . have . property ( 'mapper' , undefined )
@@ -383,7 +383,7 @@ describe('profiler', function () {
383
383
it ( 'should pass source mapper to profilers when enabled' , async ( ) => {
384
384
const mapper = { }
385
385
sourceMapCreate . returns ( mapper )
386
- await profiler . _start ( { profilers, exporters, sourceMap : true } )
386
+ profiler . start ( { profilers, exporters, sourceMap : true } )
387
387
388
388
const options = profilers [ 0 ] . start . args [ 0 ] [ 0 ]
389
389
expect ( options ) . to . have . property ( 'mapper' )
@@ -393,7 +393,8 @@ describe('profiler', function () {
393
393
it ( 'should work with a root working dir and source maps on' , async ( ) => {
394
394
const error = new Error ( 'fail' )
395
395
sourceMapCreate . rejects ( error )
396
- await profiler . _start ( { profilers, exporters, logger, sourceMap : true } )
396
+ profiler . start ( { profilers, exporters, logger, sourceMap : true } )
397
+ await profiler . sourceMapsLoaded ( )
397
398
expect ( consoleLogger . error . args [ 0 ] [ 0 ] ) . to . equal ( error )
398
399
expect ( profiler . _enabled ) . to . equal ( true )
399
400
} )
@@ -429,7 +430,7 @@ describe('profiler', function () {
429
430
} )
430
431
431
432
it ( 'should increment profiled intervals after one interval elapses' , async ( ) => {
432
- await profiler . _start ( { profilers, exporters } )
433
+ profiler . start ( { profilers, exporters } )
433
434
expect ( profiler . _profiledIntervals ) . to . equal ( 0 )
434
435
435
436
clock . tick ( interval )
@@ -439,7 +440,7 @@ describe('profiler', function () {
439
440
} )
440
441
441
442
it ( 'should flush when flush after intervals is reached' , async ( ) => {
442
- await profiler . _start ( { profilers, exporters } )
443
+ profiler . start ( { profilers, exporters } )
443
444
444
445
// flushAfterIntervals + 1 becauses flushes after last interval
445
446
for ( let i = 0 ; i < flushAfterIntervals + 1 ; i ++ ) {
0 commit comments