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 44 optimizeFunction ,
55 optimizeFunctionSync ,
66 setupCore ,
7+ SetupInstrumentsRequestBody ,
8+ SetupInstrumentsResponse ,
79 teardownCore ,
810 tryIntrospect ,
911} from "@codspeed/core" ;
@@ -221,3 +223,18 @@ async function runBenchmarks({
221223 teardownCore ( ) ;
222224 console . log ( `[CodSpeed] Done running ${ benches . length } benches.` ) ;
223225}
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