Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Switch to metrics middleware from svc-utils #ULMS-2472 (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
wakeful-kitten authored Jul 31, 2023
1 parent 997cba5 commit 7e0f1cd
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 100 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ svc-agent = { version = "0.20", features = ["sqlx", "queue-counter"] }
svc-authn = { version = "0.8", features = ["jose", "sqlx"] }
svc-authz = { version = "0.12" }
svc-error = { version = "0.5", features = ["sqlx", "svc-agent", "svc-authn", "svc-authz", "sentry-extension"] }
svc-utils = { version = "0.7", features = ["authn-extractor", "cors-middleware", "log-middleware"] }
svc-utils = { version = "0.7", features = ["authn-extractor", "cors-middleware", "log-middleware", "metrics-middleware"] }
svc-nats-client = { version = "0.2" }
svc-conference-events = { version = "0.2" }
tokio = { version = "1.28", features = ["full"] }
Expand Down
6 changes: 3 additions & 3 deletions src/app/endpoint/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Arc;
use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::extract::{
Json, {Path, Query, State},
self, Json, {Path, Query},
};
use serde_derive::{Deserialize, Serialize};
use serde_json::json;
Expand Down Expand Up @@ -39,7 +39,7 @@ pub struct ListRequest {
}

pub async fn list(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
Query(payload): Query<ListPayload>,
Expand Down Expand Up @@ -150,7 +150,7 @@ pub struct TenantBanNotification {
}

pub async fn update(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
Json(payload): Json<UpdatePayload>,
Expand Down
4 changes: 2 additions & 2 deletions src/app/endpoint/ban.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::extract::{Path, State};
use axum::extract::{self, Path};
use serde_derive::Deserialize;
use svc_agent::mqtt::ResponseStatus;
use svc_authn::Authenticable;
Expand All @@ -21,7 +21,7 @@ pub struct ListRequest {
}

pub async fn list(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
) -> RequestResult {
Expand Down
4 changes: 2 additions & 2 deletions src/app/endpoint/change/create.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::{
extract::{Path, State},
extract::{self, Path},
Json,
};
use svc_agent::mqtt::ResponseStatus;
Expand All @@ -18,7 +18,7 @@ use crate::db;
pub struct CreateHandler;

pub async fn create(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(edition_id): Path<Uuid>,
Json(changeset): Json<Changeset>,
Expand Down
4 changes: 2 additions & 2 deletions src/app/endpoint/change/delete.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::extract::{Path, State};
use axum::extract::{self, Path};
use serde_derive::Deserialize;
use svc_agent::mqtt::ResponseStatus;
use svc_authn::Authenticable;
Expand All @@ -22,7 +22,7 @@ pub struct DeleteRequest {
}

pub async fn delete(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(id): Path<Uuid>,
) -> RequestResult {
Expand Down
4 changes: 2 additions & 2 deletions src/app/endpoint/change/list.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::extract::{Path, Query, State};
use axum::extract::{self, Path, Query};
use chrono::{DateTime, Utc};
use serde_derive::Deserialize;
use svc_agent::mqtt::ResponseStatus;
Expand Down Expand Up @@ -29,7 +29,7 @@ pub struct ListRequest {
}

pub async fn list(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(id): Path<Uuid>,
Query(payload): Query<ListPayload>,
Expand Down
4 changes: 2 additions & 2 deletions src/app/endpoint/edition/commit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::extract::{Json, Path, State};
use axum::extract::{self, Json, Path};
use chrono::Utc;
use serde_derive::{Deserialize, Serialize};
use serde_json::{json, Value as JsonValue};
Expand Down Expand Up @@ -35,7 +35,7 @@ pub struct CommitRequest {
}

pub async fn commit(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(id): Path<Uuid>,
Json(payload): Json<CommitPayload>,
Expand Down
4 changes: 2 additions & 2 deletions src/app/endpoint/edition/create.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::extract::{Path, State};
use axum::extract::{self, Path};
use serde_derive::Deserialize;
use svc_agent::{mqtt::ResponseStatus, Addressable};
use svc_authn::Authenticable;
Expand All @@ -20,7 +20,7 @@ pub struct CreateRequest {
}

pub async fn create(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
) -> RequestResult {
Expand Down
4 changes: 2 additions & 2 deletions src/app/endpoint/edition/delete.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::extract::{Path, State};
use axum::extract::{self, Path};
use serde_derive::Deserialize;
use svc_agent::mqtt::ResponseStatus;
use svc_authn::Authenticable;
Expand All @@ -20,7 +20,7 @@ pub struct DeleteRequest {
}

pub async fn delete(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(id): Path<Uuid>,
) -> RequestResult {
Expand Down
4 changes: 2 additions & 2 deletions src/app/endpoint/edition/list.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::extract::{Path, Query, State};
use axum::extract::{self, Path, Query};
use chrono::{DateTime, Utc};
use serde_derive::Deserialize;
use svc_agent::mqtt::ResponseStatus;
Expand Down Expand Up @@ -29,7 +29,7 @@ pub struct ListRequest {
}

pub async fn list(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
Query(payload): Query<ListPayload>,
Expand Down
6 changes: 3 additions & 3 deletions src/app/endpoint/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Arc;
use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::{
extract::{Path, Query, State},
extract::{self, Path, Query},
Json,
};
use chrono::Utc;
Expand Down Expand Up @@ -55,7 +55,7 @@ impl CreateRequest {
}

pub async fn create(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
Json(payload): Json<CreatePayload>,
Expand Down Expand Up @@ -332,7 +332,7 @@ pub struct ListRequest {
}

pub async fn list(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
Query(payload): Query<ListPayload>,
Expand Down
16 changes: 8 additions & 8 deletions src/app/endpoint/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::sync::Arc;
use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::{
extract::{Path, State},
extract::{self, Path},
Json,
};
use chrono::{DateTime, Utc};
Expand Down Expand Up @@ -47,7 +47,7 @@ pub struct CreateRequest {
}

pub async fn create(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Json(request): Json<CreateRequest>,
) -> RequestResult {
Expand Down Expand Up @@ -167,7 +167,7 @@ pub struct ReadRequest {
}

pub async fn read(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
) -> RequestResult {
Expand Down Expand Up @@ -242,7 +242,7 @@ pub struct UpdateRequest {
}

pub async fn update(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
Json(payload): Json<UpdatePayload>,
Expand Down Expand Up @@ -397,7 +397,7 @@ pub struct RoomEnterEvent {
pub struct EnterHandler;

pub async fn enter(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
Json(payload): Json<EnterPayload>,
Expand Down Expand Up @@ -555,7 +555,7 @@ pub struct LockedTypesRequest {
}

pub async fn locked_types(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
Json(payload): Json<LockedTypesPayload>,
Expand Down Expand Up @@ -669,7 +669,7 @@ pub struct WhiteboardAccessRequest {
}

pub async fn whiteboard_access(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
Json(payload): Json<WhiteboardAccessPayload>,
Expand Down Expand Up @@ -792,7 +792,7 @@ pub struct AdjustRequest {
}

pub async fn adjust(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
Json(payload): Json<AdjustPayload>,
Expand Down
2 changes: 1 addition & 1 deletion src/app/endpoint/room/dump_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl EventsDumpResult {
}

pub async fn dump_events(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
) -> RequestResult {
Expand Down
4 changes: 2 additions & 2 deletions src/app/endpoint/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::ops::Bound;

use anyhow::Context as AnyhowContext;
use async_trait::async_trait;
use axum::extract::{Path, RawQuery, State};
use axum::extract::{self, Path, RawQuery};
use serde_derive::Deserialize;
use serde_json::{map::Map as JsonMap, Value as JsonValue};
use svc_agent::mqtt::ResponseStatus;
Expand Down Expand Up @@ -36,7 +36,7 @@ pub struct ReadRequest {
}

pub async fn read(
State(ctx): State<Arc<AppContext>>,
ctx: extract::Extension<Arc<AppContext>>,
AgentIdExtractor(agent_id): AgentIdExtractor,
Path(room_id): Path<Uuid>,
RawQuery(query): RawQuery,
Expand Down
Loading

0 comments on commit 7e0f1cd

Please sign in to comment.