File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
packages/benchmark.js-plugin/src Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 4
4
optimizeFunction ,
5
5
optimizeFunctionSync ,
6
6
setupCore ,
7
+ SetupInstrumentsRequestBody ,
8
+ SetupInstrumentsResponse ,
7
9
teardownCore ,
8
10
tryIntrospect ,
9
11
} from "@codspeed/core" ;
@@ -221,3 +223,18 @@ async function runBenchmarks({
221
223
teardownCore ( ) ;
222
224
console . log ( `[CodSpeed] Done running ${ benches . length } benches.` ) ;
223
225
}
226
+
227
+ /**
228
+ * Dynamically setup the CodSpeed instruments.
229
+ */
230
+ export async function setupInstruments (
231
+ body : SetupInstrumentsRequestBody
232
+ ) : Promise < SetupInstrumentsResponse > {
233
+ if ( ! Measurement . isInstrumented ( ) ) {
234
+ console . warn ( "[CodSpeed] No instrumentation found, using default mongoUrl" ) ;
235
+
236
+ return { remoteAddr : body . mongoUrl } ;
237
+ }
238
+
239
+ return await mongoMeasurement . setupInstruments ( body ) ;
240
+ }
You can’t perform that action at this time.
0 commit comments