Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove histogram::Histogram from public API #935

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions scylla/src/transport/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
use histogram::Histogram;
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::{Arc, Mutex, MutexGuard, PoisonError};
use std::sync::{Arc, Mutex};

const ORDER_TYPE: Ordering = Ordering::Relaxed;

#[derive(Debug)]
pub enum MetricsError<'a> {
Poison(PoisonError<MutexGuard<'a, Histogram>>),
Histogram(&'static str),
pub struct MetricsError {
cause: &'static str,
}

impl<'a> From<PoisonError<MutexGuard<'a, Histogram>>> for MetricsError<'a> {
fn from(err: PoisonError<MutexGuard<'_, Histogram>>) -> MetricsError {
MetricsError::Poison(err)
}
}

impl From<&'static str> for MetricsError<'_> {
impl From<&'static str> for MetricsError {
fn from(err: &'static str) -> MetricsError {
MetricsError::Histogram(err)
MetricsError { cause: err }
}
}

impl std::fmt::Display for MetricsError<'_> {
impl std::fmt::Display for MetricsError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
write!(f, "metrics error: {}", self.cause)
}
}

Expand Down
Loading