Skip to content

Commit

Permalink
Revert "Merge pull request #221 from GPeaky/207-implementing-metrics"
Browse files Browse the repository at this point in the history
This reverts commit 1d77969, reversing
changes made to 6f53114.
  • Loading branch information
GPeaky committed Oct 17, 2024
1 parent ea96d74 commit f072c0d
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 33 deletions.
1 change: 0 additions & 1 deletion crates/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ dashmap.workspace = true
tokio-stream.workspace = true
ntex-cors.workspace = true
openssl.workspace = true
opentelemetry.workspace = true
1 change: 0 additions & 1 deletion crates/api/src/handlers/auth/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use crate::states::AppState;

const DISCORD_REDIRECT: &str = "https://intellitelemetry.live/auth/discord/callback";

#[tracing::instrument(skip(state))]
pub async fn discord_callback(
state: State<AppState>,
query: Query<OauthAuthorizationCode>,
Expand Down
5 changes: 0 additions & 5 deletions crates/api/src/handlers/auth/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use crate::states::AppState;

// TODO: Add rate limiting to the register endpoint
#[inline]
#[tracing::instrument(skip(state), fields(email = %user_registration.email))]
pub(crate) async fn register(
state: State<AppState>,
Json(user_registration): Json<UserRegistrationData>,
Expand Down Expand Up @@ -51,7 +50,6 @@ pub(crate) async fn register(
}

#[inline]
#[tracing::instrument(skip(state, _query), fields(email = %login_credentials.email))]
pub(crate) async fn login(
state: State<AppState>,
Query(_query): Query<ClientFingerprint>,
Expand Down Expand Up @@ -97,7 +95,6 @@ pub(crate) async fn login(
}

#[inline]
#[tracing::instrument(skip(state))]
pub(crate) async fn refresh_token(
state: State<AppState>,
Query(query): Query<RefreshTokenRequest>,
Expand Down Expand Up @@ -127,7 +124,6 @@ pub(crate) async fn logout(
}

#[inline]
#[tracing::instrument(skip(state))]
pub(crate) async fn forgot_password(
state: State<AppState>,
password_reset: Json<PasswordResetRequest>,
Expand Down Expand Up @@ -165,7 +161,6 @@ pub(crate) async fn forgot_password(

// TODO: Add rate limiting to the reset password endpoint
#[inline]
#[tracing::instrument(skip(state, password_update))]
pub async fn reset_password(
state: State<AppState>,
Query(query): Query<TokenVerification>,
Expand Down
1 change: 0 additions & 1 deletion crates/api/src/handlers/auth/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use intelli_core::services::UserServiceOperations;
use structs::{EmailVerificationConfirmationTemplate, TokenVerification};

#[inline]
#[tracing::instrument(skip(state))]
pub async fn verify_email(
state: State<AppState>,
Query(query): Query<TokenVerification>,
Expand Down
5 changes: 0 additions & 5 deletions crates/api/src/handlers/championships/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub(crate) mod core {
use crate::states::AppState;

#[inline]
#[tracing::instrument(skip(req, state))]
pub async fn create(
req: HttpRequest,
state: State<AppState>,
Expand Down Expand Up @@ -57,7 +56,6 @@ pub(crate) mod core {
}

#[inline]
#[tracing::instrument(skip(req, state))]
pub async fn update(
req: HttpRequest,
state: State<AppState>,
Expand All @@ -78,7 +76,6 @@ pub(crate) mod core {
}

#[inline]
#[tracing::instrument(skip(req, state))]
pub async fn add_user(
req: HttpRequest,
state: State<AppState>,
Expand All @@ -99,7 +96,6 @@ pub(crate) mod core {
}

#[inline]
#[tracing::instrument(skip(req, state))]
pub async fn remove_user(
req: HttpRequest,
state: State<AppState>,
Expand All @@ -119,7 +115,6 @@ pub(crate) mod core {
}

#[inline]
#[tracing::instrument(skip(state))]
pub async fn get(
state: State<AppState>,
path: Path<ChampionshipId>,
Expand Down
3 changes: 0 additions & 3 deletions crates/api/src/handlers/championships/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use error::{AppResult, ChampionshipError, CommonError};
use structs::ChampionshipId;

#[inline]
#[tracing::instrument(skip(state))]
pub async fn start(state: State<AppState>, path: Path<ChampionshipId>) -> AppResult<HttpResponse> {
if path.validate().is_err() {
Err(CommonError::ValidationFailed)?
Expand All @@ -28,7 +27,6 @@ pub async fn start(state: State<AppState>, path: Path<ChampionshipId>) -> AppRes
}

#[inline]
#[tracing::instrument(skip(state))]
pub async fn status(state: State<AppState>, path: Path<ChampionshipId>) -> AppResult<HttpResponse> {
if path.validate().is_err() {
Err(CommonError::ValidationFailed)?
Expand All @@ -44,7 +42,6 @@ pub async fn status(state: State<AppState>, path: Path<ChampionshipId>) -> AppRe
}

#[inline]
#[tracing::instrument(skip(state))]
pub async fn stop(state: State<AppState>, path: Path<ChampionshipId>) -> AppResult<HttpResponse> {
if path.validate().is_err() {
Err(CommonError::ValidationFailed)?
Expand Down
2 changes: 0 additions & 2 deletions crates/api/src/handlers/championships/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ impl<S> Drop for CleanupStream<S> {
}

#[inline]
#[tracing::instrument(skip(state))]
pub async fn stream_live_session(
state: State<AppState>,
path: Path<ChampionshipId>,
Expand Down Expand Up @@ -90,7 +89,6 @@ pub async fn stream_live_session(
}
}

#[tracing::instrument(skip(req, state))]
pub async fn stream_telemetry_session(
req: HttpRequest,
state: State<AppState>,
Expand Down
3 changes: 0 additions & 3 deletions crates/api/src/handlers/user/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use crate::states::AppState;
pub(crate) mod admin;

#[inline]
#[tracing::instrument(skip(req, state))]
pub(crate) async fn get(req: HttpRequest, state: State<AppState>) -> AppResult<HttpResponse> {
let user = req.user()?;
let championships = state.user_repo.championships(user.id).await?;
Expand All @@ -26,7 +25,6 @@ pub(crate) async fn get(req: HttpRequest, state: State<AppState>) -> AppResult<H
}

#[inline]
#[tracing::instrument(skip(req, state))]
pub(crate) async fn update(
req: HttpRequest,
state: State<AppState>,
Expand All @@ -42,7 +40,6 @@ pub(crate) async fn update(
}

#[inline]
#[tracing::instrument(skip(req, state))]
pub async fn get_championships(
req: HttpRequest,
state: State<AppState>,
Expand Down
8 changes: 2 additions & 6 deletions crates/api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
#[tokio::main]
async fn main() -> std::io::Result<()> {
dotenv().ok();
let _tracer = initialize_tracing_and_telemetry().expect("Error initializing metrics");
initialize_tracing_and_telemetry().expect("Error initializing metrics");

ntex::rt::System::new("intelli-api")
.run_local(async {
Expand Down Expand Up @@ -61,9 +61,5 @@ async fn main() -> std::io::Result<()> {
.run()
.await
})
.await?;

opentelemetry::global::shutdown_tracer_provider();

Ok(())
.await
}
6 changes: 3 additions & 3 deletions crates/structs/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use entities::Provider;
use utils::deserialize_i64_from_string;

// Authentication Structures
#[derive(Debug, Deserialize, Validate)]
#[derive(Deserialize, Validate)]
pub struct LoginCredentials {
#[garde(email)]
#[serde(deserialize_with = "string_trim")]
Expand Down Expand Up @@ -61,7 +61,7 @@ impl UserRegistrationData {
}

// Password Management
#[derive(Debug, Deserialize, Validate)]
#[derive(Deserialize, Validate)]
pub struct PasswordResetRequest {
#[garde(email)]
#[serde(deserialize_with = "string_trim")]
Expand Down Expand Up @@ -92,7 +92,7 @@ pub struct ClientFingerprint {
pub fingerprint: String,
}

#[derive(Deserialize, Debug)]
#[derive(Deserialize)]
pub struct OauthAuthorizationCode {
pub code: String,
}
Expand Down
6 changes: 3 additions & 3 deletions crates/structs/src/championship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct ChampionshipCreationData {
pub category: Category,
}

#[derive(Debug, Deserialize, Validate)]
#[derive(Deserialize, Validate)]
pub struct ChampionshipUserAddForm {
#[serde(deserialize_with = "string_trim")]
#[garde(email)]
Expand Down Expand Up @@ -44,10 +44,10 @@ pub struct ServiceStatus {
}

// Path Parameters
#[derive(Debug, Deserialize, Validate)]
#[derive(Deserialize, Validate)]
pub struct ChampionshipId(#[garde(range(min = 700000000, max = 799999999))] pub i32);

#[derive(Debug, Deserialize, Validate)]
#[derive(Deserialize, Validate)]
pub struct ChampionshipAndUserId {
#[garde(range(min = 700000000, max = 799999999))]
pub championship_id: i32,
Expand Down

0 comments on commit f072c0d

Please sign in to comment.