@@ -548,7 +548,10 @@ async fn create_database(
548
548
State ( mut server) : State < FrontendServer > ,
549
549
Json ( CreateDatabasePayload { name } ) : Json < CreateDatabasePayload > ,
550
550
) -> Result < Json < CreateDatabaseResponse > , ServerError > {
551
- server. metrics . create_database . add ( 1 , & [ ] ) ;
551
+ server
552
+ . metrics
553
+ . create_database
554
+ . add ( 1 , & [ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ] ) ;
552
555
tracing:: info!( "Creating database [{}] for tenant [{}]" , name, tenant) ;
553
556
server
554
557
. authenticate_and_authorize (
@@ -607,7 +610,10 @@ async fn list_databases(
607
610
Query ( ListDatabasesParams { limit, offset } ) : Query < ListDatabasesParams > ,
608
611
State ( mut server) : State < FrontendServer > ,
609
612
) -> Result < Json < ListDatabasesResponse > , ServerError > {
610
- server. metrics . list_databases . add ( 1 , & [ ] ) ;
613
+ server
614
+ . metrics
615
+ . list_databases
616
+ . add ( 1 , & [ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ] ) ;
611
617
tracing:: info!( "Listing database for tenant [{}]" , tenant) ;
612
618
server
613
619
. authenticate_and_authorize (
@@ -647,7 +653,10 @@ async fn get_database(
647
653
Path ( ( tenant, database) ) : Path < ( String , String ) > ,
648
654
State ( mut server) : State < FrontendServer > ,
649
655
) -> Result < Json < GetDatabaseResponse > , ServerError > {
650
- server. metrics . get_database . add ( 1 , & [ ] ) ;
656
+ server
657
+ . metrics
658
+ . get_database
659
+ . add ( 1 , & [ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ] ) ;
651
660
tracing:: info!( "Getting database [{}] for tenant [{}]" , database, tenant) ;
652
661
server
653
662
. authenticate_and_authorize (
@@ -687,7 +696,10 @@ async fn delete_database(
687
696
Path ( ( tenant, database) ) : Path < ( String , String ) > ,
688
697
State ( mut server) : State < FrontendServer > ,
689
698
) -> Result < Json < DeleteDatabaseResponse > , ServerError > {
690
- server. metrics . delete_database . add ( 1 , & [ ] ) ;
699
+ server
700
+ . metrics
701
+ . delete_database
702
+ . add ( 1 , & [ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ] ) ;
691
703
tracing:: info!( "Deleting database [{}] for tenant [{}]" , database, tenant) ;
692
704
server
693
705
. authenticate_and_authorize (
@@ -735,7 +747,10 @@ async fn list_collections(
735
747
Query ( ListCollectionsParams { limit, offset } ) : Query < ListCollectionsParams > ,
736
748
State ( mut server) : State < FrontendServer > ,
737
749
) -> Result < Json < ListCollectionsResponse > , ServerError > {
738
- server. metrics . list_collections . add ( 1 , & [ ] ) ;
750
+ server
751
+ . metrics
752
+ . list_collections
753
+ . add ( 1 , & [ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ] ) ;
739
754
tracing:: info!(
740
755
"Listing collections in database [{}] for tenant [{}] with limit [{:?}] and offset [{:?}]" ,
741
756
database,
@@ -788,7 +803,10 @@ async fn count_collections(
788
803
Path ( ( tenant, database) ) : Path < ( String , String ) > ,
789
804
State ( mut server) : State < FrontendServer > ,
790
805
) -> Result < Json < CountCollectionsResponse > , ServerError > {
791
- server. metrics . count_collections . add ( 1 , & [ ] ) ;
806
+ server
807
+ . metrics
808
+ . count_collections
809
+ . add ( 1 , & [ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ] ) ;
792
810
tracing:: info!( "Counting number of collections in database [{database}] for tenant [{tenant}]" , ) ;
793
811
server
794
812
. authenticate_and_authorize (
@@ -840,7 +858,10 @@ async fn create_collection(
840
858
State ( mut server) : State < FrontendServer > ,
841
859
Json ( payload) : Json < CreateCollectionPayload > ,
842
860
) -> Result < Json < Collection > , ServerError > {
843
- server. metrics . create_collection . add ( 1 , & [ ] ) ;
861
+ server
862
+ . metrics
863
+ . create_collection
864
+ . add ( 1 , & [ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ] ) ;
844
865
tracing:: info!( "Creating collection in database [{database}] for tenant [{tenant}]" ) ;
845
866
server
846
867
. authenticate_and_authorize (
@@ -908,7 +929,10 @@ async fn get_collection(
908
929
Path ( ( tenant, database, collection_name) ) : Path < ( String , String , String ) > ,
909
930
State ( mut server) : State < FrontendServer > ,
910
931
) -> Result < Json < Collection > , ServerError > {
911
- server. metrics . get_collection . add ( 1 , & [ ] ) ;
932
+ server
933
+ . metrics
934
+ . get_collection
935
+ . add ( 1 , & [ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ] ) ;
912
936
tracing:: info!(
913
937
"Getting collection [{collection_name}] in database [{database}] for tenant [{tenant}]"
914
938
) ;
@@ -960,7 +984,13 @@ async fn update_collection(
960
984
State ( mut server) : State < FrontendServer > ,
961
985
Json ( payload) : Json < UpdateCollectionPayload > ,
962
986
) -> Result < Json < UpdateCollectionResponse > , ServerError > {
963
- server. metrics . update_collection . add ( 1 , & [ ] ) ;
987
+ server. metrics . update_collection . add (
988
+ 1 ,
989
+ & [
990
+ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ,
991
+ KeyValue :: new ( "collection_id" , collection_id. clone ( ) ) ,
992
+ ] ,
993
+ ) ;
964
994
tracing:: info!(
965
995
"Updating collection [{collection_id}] in database [{database}] for tenant [{tenant}]"
966
996
) ;
@@ -1029,7 +1059,10 @@ async fn delete_collection(
1029
1059
Path ( ( tenant, database, collection_name) ) : Path < ( String , String , String ) > ,
1030
1060
State ( mut server) : State < FrontendServer > ,
1031
1061
) -> Result < Json < UpdateCollectionResponse > , ServerError > {
1032
- server. metrics . delete_collection . add ( 1 , & [ ] ) ;
1062
+ server
1063
+ . metrics
1064
+ . delete_collection
1065
+ . add ( 1 , & [ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ] ) ;
1033
1066
tracing:: info!(
1034
1067
"Deleting collection [{collection_name}] in database [{database}] for tenant [{tenant}]"
1035
1068
) ;
@@ -1080,7 +1113,13 @@ async fn collection_add(
1080
1113
State ( mut server) : State < FrontendServer > ,
1081
1114
Json ( payload) : Json < AddCollectionRecordsPayload > ,
1082
1115
) -> Result < ( StatusCode , Json < AddCollectionRecordsResponse > ) , ServerError > {
1083
- server. metrics . collection_add . add ( 1 , & [ ] ) ;
1116
+ server. metrics . collection_add . add (
1117
+ 1 ,
1118
+ & [
1119
+ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ,
1120
+ KeyValue :: new ( "collection_id" , collection_id. clone ( ) ) ,
1121
+ ] ,
1122
+ ) ;
1084
1123
server
1085
1124
. authenticate_and_authorize (
1086
1125
& headers,
@@ -1161,7 +1200,13 @@ async fn collection_update(
1161
1200
State ( mut server) : State < FrontendServer > ,
1162
1201
Json ( payload) : Json < UpdateCollectionRecordsPayload > ,
1163
1202
) -> Result < Json < UpdateCollectionRecordsResponse > , ServerError > {
1164
- server. metrics . collection_update . add ( 1 , & [ ] ) ;
1203
+ server. metrics . collection_update . add (
1204
+ 1 ,
1205
+ & [
1206
+ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ,
1207
+ KeyValue :: new ( "collection_id" , collection_id. clone ( ) ) ,
1208
+ ] ,
1209
+ ) ;
1165
1210
server
1166
1211
. authenticate_and_authorize (
1167
1212
& headers,
@@ -1246,7 +1291,13 @@ async fn collection_upsert(
1246
1291
State ( mut server) : State < FrontendServer > ,
1247
1292
Json ( payload) : Json < UpsertCollectionRecordsPayload > ,
1248
1293
) -> Result < Json < UpsertCollectionRecordsResponse > , ServerError > {
1249
- server. metrics . collection_upsert . add ( 1 , & [ ] ) ;
1294
+ server. metrics . collection_upsert . add (
1295
+ 1 ,
1296
+ & [
1297
+ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ,
1298
+ KeyValue :: new ( "collection_id" , collection_id. clone ( ) ) ,
1299
+ ] ,
1300
+ ) ;
1250
1301
server
1251
1302
. authenticate_and_authorize (
1252
1303
& headers,
@@ -1330,7 +1381,13 @@ async fn collection_delete(
1330
1381
State ( mut server) : State < FrontendServer > ,
1331
1382
Json ( payload) : Json < DeleteCollectionRecordsPayload > ,
1332
1383
) -> Result < Json < DeleteCollectionRecordsResponse > , ServerError > {
1333
- server. metrics . collection_delete . add ( 1 , & [ ] ) ;
1384
+ server. metrics . collection_delete . add (
1385
+ 1 ,
1386
+ & [
1387
+ KeyValue :: new ( "tenant" , tenant. clone ( ) ) ,
1388
+ KeyValue :: new ( "collection_id" , collection_id. clone ( ) ) ,
1389
+ ] ,
1390
+ ) ;
1334
1391
server
1335
1392
. authenticate_and_authorize (
1336
1393
& headers,
@@ -1401,7 +1458,6 @@ async fn collection_count(
1401
1458
1 ,
1402
1459
& [
1403
1460
KeyValue :: new ( "tenant" , tenant. clone ( ) ) ,
1404
- KeyValue :: new ( "database" , database. clone ( ) ) ,
1405
1461
KeyValue :: new ( "collection_id" , collection_id. clone ( ) ) ,
1406
1462
] ,
1407
1463
) ;
0 commit comments