File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
packages/tinybench-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 mongoMeasurement ,
55 optimizeFunction ,
66 setupCore ,
7+ StartInstrumentsRequestBody ,
8+ StartInstrumentsResponse ,
79 teardownCore ,
810 tryIntrospect ,
911} from "@codspeed/core" ;
@@ -101,3 +103,18 @@ function getCallingFile(): string {
101103 }
102104 return path . relative ( gitDir , callingFile ) ;
103105}
106+
107+ /**
108+ * Dynamically starts the CodSpeed instruments.
109+ */
110+ export async function startInstruments (
111+ body : StartInstrumentsRequestBody
112+ ) : Promise < StartInstrumentsResponse > {
113+ if ( ! Measurement . isInstrumented ( ) ) {
114+ console . warn ( "[CodSpeed] No instrumentation found, using default mongoUrl" ) ;
115+
116+ return { remoteAddr : body . mongoUrl } ;
117+ }
118+
119+ return await mongoMeasurement . startInstruments ( body ) ;
120+ }
You can’t perform that action at this time.
0 commit comments