Skip to content

Commit

Permalink
Move ConnectionStats to mod
Browse files Browse the repository at this point in the history
Summary: Similar to D50838010, this struct was stubbed out in the OSS version, but moving it to `mod.rs` removed duplication later in the stack when a new implementation is introduced and the need for stubbing it out.

Reviewed By: gustavoavena

Differential Revision: D50841364

fbshipit-source-id: 01821db46e7aad75ec48bf41c14d458c79eeae9e
  • Loading branch information
Clara Rull authored and facebook-github-bot committed Nov 2, 2023
1 parent f9f22a5 commit ba2734a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 7 additions & 4 deletions shed/sql/common/mysql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ pub use facebook::opt_try_from_rowfield;
#[cfg(fbcode_build)]
pub use facebook::Connection;
#[cfg(fbcode_build)]
pub use facebook::ConnectionStats;
#[cfg(fbcode_build)]
pub use facebook::MysqlError;
#[cfg(fbcode_build)]
pub use facebook::OptionalTryFromRowField;
Expand All @@ -41,8 +39,6 @@ pub use mysql_stub::opt_try_from_rowfield;
#[cfg(not(fbcode_build))]
pub use mysql_stub::Connection;
#[cfg(not(fbcode_build))]
pub use mysql_stub::ConnectionStats;
#[cfg(not(fbcode_build))]
pub use mysql_stub::MysqlError;
#[cfg(not(fbcode_build))]
pub use mysql_stub::OptionalTryFromRowField;
Expand All @@ -56,9 +52,16 @@ pub use mysql_stub::TransactionResult;
pub use mysql_stub::TryFromRowField;
#[cfg(not(fbcode_build))]
pub use mysql_stub::ValueError;
use stats::prelude::*;

use super::WriteResult as SqlWriteResult;

define_stats_struct! {
ConnectionStats("sql.mysql_ffi.{}", label: String),
get_connection_ms: histogram(100, 0, 5_000, Average, Count; P 50; P 95; P 99),
raw_query_ms: histogram(100, 0, 5_000, Average, Count; P 50; P 95; P 99),
}

/// A simple wrapper struct around a SQL string, just to add some type
/// safety.
#[derive(Debug, Clone, Eq, PartialEq)]
Expand Down
3 changes: 0 additions & 3 deletions shed/sql/common/mysql/mysql_stub/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ impl From<ValueError> for MysqlError {
}
}

/// ODS counters
pub struct ConnectionStats;

/// Connection object.
#[derive(Clone)]
pub struct Connection;
Expand Down

0 comments on commit ba2734a

Please sign in to comment.