File tree Expand file tree Collapse file tree 3 files changed +78
-2
lines changed Expand file tree Collapse file tree 3 files changed +78
-2
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ export const teardownCore = () => {
25
25
linuxPerf . stop ( ) ;
26
26
} ;
27
27
28
+ export type {
29
+ StartInstrumentsRequestBody ,
30
+ StartInstrumentsResponse ,
31
+ } from "./generated/openapi" ;
28
32
export { getV8Flags , tryIntrospect } from "./introspection" ;
29
33
export { optimizeFunction , optimizeFunctionSync } from "./optimization" ;
30
34
export * from "./utils" ;
Original file line number Diff line number Diff line change 1
- import { MongoTracer } from "./generated/openapi" ;
1
+ import {
2
+ MongoTracer ,
3
+ StartInstrumentsRequestBody ,
4
+ StartInstrumentsResponse ,
5
+ } from "./generated/openapi" ;
6
+
7
+ export type { StartInstrumentsRequestBody } ;
2
8
3
9
export class MongoMeasurement {
4
10
private tracerClient : MongoTracer | undefined ;
@@ -13,6 +19,15 @@ export class MongoMeasurement {
13
19
}
14
20
}
15
21
22
+ public async startInstruments (
23
+ body : StartInstrumentsRequestBody
24
+ ) : Promise < StartInstrumentsResponse > {
25
+ if ( this . tracerClient === undefined ) {
26
+ throw new Error ( "MongoDB Instrumentation is not enabled" ) ;
27
+ }
28
+ return await this . tracerClient . instruments . start ( body ) ;
29
+ }
30
+
16
31
public async start ( uri : string ) {
17
32
if ( this . tracerClient !== undefined ) {
18
33
await this . tracerClient . instrumentation . start ( {
Original file line number Diff line number Diff line change 3
3
"info" : {
4
4
"title" : " CodSpeed MongoDB Tracer" ,
5
5
"description" : " Instrumentation API for CodSpeed Tracer" ,
6
- "version" : " 0.1.0 "
6
+ "version" : " 0.1.1-beta.4 "
7
7
},
8
8
"paths" : {
9
9
"/benchmark/start" : {
74
74
}
75
75
}
76
76
},
77
+ "/instruments/start" : {
78
+ "post" : {
79
+ "tags" : [" instruments" ],
80
+ "operationId" : " start" ,
81
+ "requestBody" : {
82
+ "content" : {
83
+ "application/json" : {
84
+ "schema" : {
85
+ "$ref" : " #/components/schemas/StartInstrumentsRequestBody"
86
+ }
87
+ }
88
+ },
89
+ "required" : true
90
+ },
91
+ "responses" : {
92
+ "200" : {
93
+ "description" : " successful operation" ,
94
+ "content" : {
95
+ "application/json" : {
96
+ "schema" : {
97
+ "$ref" : " #/components/schemas/StartInstrumentsResponse"
98
+ }
99
+ }
100
+ }
101
+ },
102
+ "4XX" : {
103
+ "$ref" : " #/components/responses/Error"
104
+ },
105
+ "5XX" : {
106
+ "$ref" : " #/components/responses/Error"
107
+ }
108
+ }
109
+ }
110
+ },
77
111
"/status" : {
78
112
"get" : {
79
113
"tags" : [" instrumentation" ],
249
283
" query_documents" ,
250
284
" response_documents"
251
285
]
286
+ },
287
+ "StartInstrumentsRequestBody" : {
288
+ "type" : " object" ,
289
+ "properties" : {
290
+ "mongoUrl" : {
291
+ "description" : " The full `MONGO_URL` that is usually used to connect to the database." ,
292
+ "type" : " string"
293
+ }
294
+ },
295
+ "required" : [" mongoUrl" ]
296
+ },
297
+ "StartInstrumentsResponse" : {
298
+ "type" : " object" ,
299
+ "properties" : {
300
+ "remoteAddr" : {
301
+ "description" : " The patched `MONGO_URL` that should be used to connect to the database." ,
302
+ "type" : " string"
303
+ }
304
+ },
305
+ "required" : [" remoteAddr" ]
252
306
}
253
307
}
254
308
},
255
309
"tags" : [
256
310
{
257
311
"name" : " instrumentation"
312
+ },
313
+ {
314
+ "name" : " instruments"
258
315
}
259
316
]
260
317
}
You can’t perform that action at this time.
0 commit comments