Skip to content

Commit

Permalink
feat(s2n-quic-core): add metrics trait
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft committed Sep 25, 2024
1 parent e0ffbda commit be14fbf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions quic/s2n-quic-core/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
use crate::{connection, endpoint};
use core::{ops::RangeInclusive, time::Duration};

pub mod metrics;

mod generated;
pub use generated::*;

Expand Down
17 changes: 17 additions & 0 deletions quic/s2n-quic-core/src/event/metrics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

pub trait Recorder: 'static + Send + Sync {
type Counter: Counter;

/// Registers a counter with the recorder instance
fn register_counter(&self, name: &str) -> Self::Counter;

/// Associates a key/value pair with the recorder instance
fn set<V: core::fmt::Display>(&self, key: &str, value: V);
}

pub trait Counter: 'static + Send + Sync {
/// Increments the counter with the given amount
fn increment(&self, amount: usize);
}

0 comments on commit be14fbf

Please sign in to comment.