@@ -36,6 +36,7 @@ use std::borrow::Cow;
36
36
use std:: path:: PathBuf ;
37
37
use tokio:: select;
38
38
use tokio:: sync:: watch;
39
+ use tracing:: instrument;
39
40
40
41
type Taker = TakerActorSystem <
41
42
oracle:: Actor ,
@@ -54,6 +55,7 @@ pub struct IdentityInfo {
54
55
}
55
56
56
57
#[ rocket:: get( "/feed" ) ]
58
+ #[ instrument( name = "GET /feed" , skip( rx) ) ]
57
59
pub async fn feed (
58
60
rx : & State < Feeds > ,
59
61
rx_wallet : & State < watch:: Receiver < Option < WalletInfo > > > ,
@@ -148,6 +150,7 @@ pub struct CfdOrderRequest {
148
150
}
149
151
150
152
#[ rocket:: post( "/cfd/order" , data = "<cfd_order_request>" ) ]
153
+ #[ instrument( name = "POST /cfd/order" , skip( taker) ) ]
151
154
pub async fn post_order_request (
152
155
cfd_order_request : Json < CfdOrderRequest > ,
153
156
taker : & State < Taker > ,
@@ -170,6 +173,7 @@ pub async fn post_order_request(
170
173
}
171
174
172
175
#[ rocket:: post( "/cfd/<id>/<action>" ) ]
176
+ #[ instrument( name = "POST /cfd/<id>/<action>" , skip( taker) ) ]
173
177
pub async fn post_cfd_action (
174
178
id : Uuid ,
175
179
action : String ,
@@ -205,6 +209,7 @@ pub async fn post_cfd_action(
205
209
}
206
210
207
211
#[ rocket:: get( "/alive" ) ]
212
+ #[ instrument( name = "GET /alive" ) ]
208
213
pub fn get_health_check ( ) { }
209
214
210
215
#[ derive( Debug , Clone , Copy , Deserialize ) ]
@@ -233,12 +238,14 @@ pub struct MarginResponse {
233
238
struct Asset ;
234
239
235
240
#[ rocket:: get( "/assets/<file..>" ) ]
241
+ #[ instrument( name = "GET /assets/<file>" ) ]
236
242
pub fn dist < ' r > ( file : PathBuf , _auth : Authenticated ) -> impl Responder < ' r , ' static > {
237
243
let filename = format ! ( "assets/{}" , file. display( ) ) ;
238
244
Asset :: get ( & filename) . into_response ( file)
239
245
}
240
246
241
247
#[ rocket:: get( "/<_paths..>" , format = "text/html" ) ]
248
+ #[ instrument( name = "GET /<_paths>" ) ]
242
249
pub fn index < ' r > ( _paths : PathBuf , _auth : Authenticated ) -> impl Responder < ' r , ' static > {
243
250
let asset = Asset :: get ( "index.html" ) . ok_or ( Status :: NotFound ) ?;
244
251
Ok :: < ( ContentType , Cow < [ u8 ] > ) , Status > ( ( ContentType :: HTML , asset. data ) )
@@ -253,6 +260,7 @@ pub struct WithdrawRequest {
253
260
}
254
261
255
262
#[ rocket:: post( "/withdraw" , data = "<withdraw_request>" ) ]
263
+ #[ instrument( name = "POST /withdraw" , skip( taker) ) ]
256
264
pub async fn post_withdraw_request (
257
265
withdraw_request : Json < WithdrawRequest > ,
258
266
taker : & State < Taker > ,
@@ -279,6 +287,7 @@ pub async fn post_withdraw_request(
279
287
}
280
288
281
289
#[ rocket:: get( "/metrics" ) ]
290
+ #[ instrument( name = "GET /metrics" ) ]
282
291
pub async fn get_metrics < ' r > ( _auth : Authenticated ) -> Result < String , HttpApiProblem > {
283
292
let metrics = prometheus:: TextEncoder :: new ( )
284
293
. encode_to_string ( & prometheus:: gather ( ) )
@@ -292,6 +301,7 @@ pub async fn get_metrics<'r>(_auth: Authenticated) -> Result<String, HttpApiProb
292
301
}
293
302
294
303
#[ rocket:: put( "/sync" ) ]
304
+ #[ instrument( name = "PUT /sync" , skip( taker) ) ]
295
305
pub async fn put_sync_wallet (
296
306
taker : & State < Taker > ,
297
307
_auth : Authenticated ,
@@ -311,6 +321,7 @@ pub struct HealthCheck {
311
321
}
312
322
313
323
#[ rocket:: get( "/version" ) ]
324
+ #[ instrument( name = "GET /version" ) ]
314
325
pub async fn get_version ( ) -> Json < HealthCheck > {
315
326
Json ( HealthCheck {
316
327
daemon_version : daemon:: version:: version ( ) . to_string ( ) ,
0 commit comments