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

feat(metrics): add internal latency of actors, MVs and sinks #19639

Merged
merged 8 commits into from
Dec 3, 2024
Merged
Changes from 1 commit
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
Next Next commit
docs around RelabeledMetricVec
fuyufjh committed Nov 29, 2024
commit e460b6a8152e23cf6975ea29fcce329417404535
19 changes: 16 additions & 3 deletions src/common/metrics/src/relabeled_metric.rs
Original file line number Diff line number Diff line change
@@ -21,16 +21,25 @@ use crate::{
};

/// For all `Relabeled*Vec` below,
/// - when `metric_level` <= `relabel_threshold`, they behaves exactly the same as their inner
/// - when `metric_level` <= `relabel_threshold`, they behave exactly the same as their inner
/// metric.
/// - when `metric_level` > `relabel_threshold`, all their input label values are rewrite to "" when
/// - when `metric_level` > `relabel_threshold`, the first `relabel_num` labels are rewrite to "" when
/// calling `with_label_values`. That's means the metric vec is aggregated into a single metric.
///
///
/// These wrapper classes add a `metric_level` field to corresponding metric.
/// We could have use one single struct to represent all `MetricVec<T: MetricVecBuilder>`, rather
/// than specializing them one by one. However, that's undoable because prometheus crate doesn't
/// export `MetricVecBuilder` implementation like `HistogramVecBuilder`.
///
/// ## Note
///
/// CAUTION! Relabelling might cause expected result!
///
/// For counters (including histogram because it uses counters internally), it's usually natural
/// to sum up the count from multiple labels.
///
/// For the rest (such as Gauge), the semantics becomes "any/last of the recorded value". Please be
/// cautious.
#[derive(Clone, Debug)]
pub struct RelabeledMetricVec<M> {
relabel_threshold: MetricLevel,
@@ -160,5 +169,9 @@ pub type RelabeledGuardedHistogramVec<const N: usize> =
RelabeledMetricVec<LabelGuardedHistogramVec<N>>;
pub type RelabeledGuardedIntCounterVec<const N: usize> =
RelabeledMetricVec<LabelGuardedIntCounterVec<N>>;

/// CAUTION! Relabelling a Gauge might cause expected result!
///
/// See [`RelabeledMetricVec`] for details.
pub type RelabeledGuardedIntGaugeVec<const N: usize> =
RelabeledMetricVec<LabelGuardedIntGaugeVec<N>>;