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 4
4
mongoMeasurement ,
5
5
optimizeFunction ,
6
6
setupCore ,
7
+ StartInstrumentsRequestBody ,
8
+ StartInstrumentsResponse ,
7
9
teardownCore ,
8
10
tryIntrospect ,
9
11
} from "@codspeed/core" ;
@@ -101,3 +103,18 @@ function getCallingFile(): string {
101
103
}
102
104
return path . relative ( gitDir , callingFile ) ;
103
105
}
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