From f883ccf1f8079ac5c9b316187fc68c6185b82074 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 11:33:45 +0300 Subject: [PATCH 01/11] Expose `Info` metrics --- crates/vise/src/builder.rs | 12 +++++-- crates/vise/src/lib.rs | 2 +- crates/vise/src/tests.rs | 22 ++++++++++++ crates/vise/src/wrappers.rs | 68 ++++++++++++++++++++++++++++++++++++- 4 files changed, 100 insertions(+), 4 deletions(-) diff --git a/crates/vise/src/builder.rs b/crates/vise/src/builder.rs index 3d14808..7571509 100644 --- a/crates/vise/src/builder.rs +++ b/crates/vise/src/builder.rs @@ -1,5 +1,5 @@ use prometheus_client::{ - encoding::EncodeMetric, + encoding::{EncodeLabelSet, EncodeMetric}, metrics::{counter::Counter, TypedMetric}, }; @@ -7,7 +7,7 @@ use std::hash::Hash; use crate::{ traits::{GaugeValue, HistogramValue}, - wrappers::{Family, Gauge, Histogram}, + wrappers::{Family, Gauge, Histogram, Info}, Buckets, }; @@ -86,6 +86,14 @@ impl BuildMetric for Histogram { } } +impl BuildMetric for Info { + type Builder = MetricBuilder; + + fn build(_builder: Self::Builder) -> Self { + Self::default() + } +} + impl BuildMetric for Family where S: 'static + Clone + Eq + Hash, diff --git a/crates/vise/src/lib.rs b/crates/vise/src/lib.rs index f5e4b94..fcced5d 100644 --- a/crates/vise/src/lib.rs +++ b/crates/vise/src/lib.rs @@ -384,7 +384,7 @@ pub use crate::{ CollectToRegistry, MetricsCollection, MetricsVisitor, RegisteredDescriptors, Registry, METRICS_REGISTRATIONS, }, - wrappers::{Family, Gauge, GaugeGuard, Histogram, LabeledFamily, LatencyObserver}, + wrappers::{Family, Gauge, GaugeGuard, Histogram, Info, LabeledFamily, LatencyObserver}, }; #[cfg(doctest)] diff --git a/crates/vise/src/tests.rs b/crates/vise/src/tests.rs index bf96340..b3d3d53 100644 --- a/crates/vise/src/tests.rs +++ b/crates/vise/src/tests.rs @@ -17,9 +17,17 @@ impl From<&'static str> for Method { } } +#[derive(Debug, PartialEq, EncodeLabelSet)] +#[metrics(crate = crate)] +struct PackageMetadata { + version: &'static str, +} + #[derive(Debug, Metrics)] #[metrics(crate = crate, prefix = "test")] pub(crate) struct TestMetrics { + /// Test information. + package_metadata: Info, /// Test counter. counter: Counter, #[metrics(unit = Unit::Bytes)] @@ -45,6 +53,16 @@ fn testing_metrics() { let mut registry = Registry::empty(); registry.register_metrics(&test_metrics); + assert_eq!(test_metrics.package_metadata.get(), None); + test_metrics + .package_metadata + .set(PackageMetadata { version: "0.1.0" }) + .unwrap(); + assert_eq!( + test_metrics.package_metadata.get(), + Some(&PackageMetadata { version: "0.1.0" }) + ); + test_metrics.counter.inc(); assert_eq!(test_metrics.counter.get(), 1); // ^ Counters and gauges can be easily tested @@ -78,6 +96,10 @@ fn testing_metrics() { registry.encode(&mut buffer, Format::OpenMetrics).unwrap(); let lines: Vec<_> = buffer.lines().collect(); + assert!(lines.contains(&"# TYPE test_package_metadata info")); + assert!(lines.contains(&"# HELP test_package_metadata Test information.")); + assert!(lines.contains(&r#"test_package_metadata_info{version="0.1.0"} 1"#)); + // `_bytes` suffix is added automatically per Prometheus naming suggestions: // https://prometheus.io/docs/practices/naming/ assert!(lines.contains(&"# TYPE test_gauge_bytes gauge")); diff --git a/crates/vise/src/wrappers.rs b/crates/vise/src/wrappers.rs index b5a0404..381f462 100644 --- a/crates/vise/src/wrappers.rs +++ b/crates/vise/src/wrappers.rs @@ -1,8 +1,9 @@ //! Wrappers for metric types defined in `prometheus-client`. use elsa::sync::FrozenMap; +use once_cell::sync::OnceCell; use prometheus_client::{ - encoding::{EncodeMetric, MetricEncoder}, + encoding::{EncodeLabelSet, EncodeMetric, MetricEncoder}, metrics::{ gauge::Gauge as GaugeInner, histogram::Histogram as HistogramInner, MetricType, TypedMetric, }, @@ -195,6 +196,71 @@ impl LatencyObserver<'_> { } } +/// Information metric. +#[derive(Debug)] +pub struct Info(Arc>); + +impl Default for Info { + fn default() -> Self { + Self(Arc::default()) + } +} + +impl Clone for Info { + fn clone(&self) -> Self { + Self(self.0.clone()) + } +} + +impl Info { + /// Gets the current value of the metric. + pub fn get(&self) -> Option<&S> { + self.0.get() + } + + /// Sets the value of this metric. + /// + /// # Errors + /// + /// Returns an error if the value is already set. + pub fn set(&self, value: S) -> Result<(), InfoSetError> { + self.0.set(value).map_err(InfoSetError) + } +} + +impl EncodeMetric for Info { + fn encode(&self, mut encoder: MetricEncoder<'_, '_>) -> fmt::Result { + if let Some(value) = self.0.get() { + encoder.encode_info(value) + } else { + Ok(()) + } + } + + fn metric_type(&self) -> MetricType { + MetricType::Info + } +} + +impl TypedMetric for Info { + const TYPE: MetricType = MetricType::Info; +} + +#[derive(Debug)] +pub struct InfoSetError(S); + +impl InfoSetError { + pub fn into_inner(self) -> S { + self.0 + } +} + +impl fmt::Display for InfoSetError { + fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { + formatter.write_str("cannot set info metric value; it is already set") + } +} + struct FamilyInner { map: FrozenMap>, builder: M::Builder, From dbe05b96312794dce4020b00d66de45552bdd9bd Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 11:34:35 +0300 Subject: [PATCH 02/11] Translate info metrics for Prometheus --- crates/vise/src/format.rs | 88 +++++++++++++++++++++++++++---------- crates/vise/src/registry.rs | 7 ++- 2 files changed, 71 insertions(+), 24 deletions(-) diff --git a/crates/vise/src/format.rs b/crates/vise/src/format.rs index d01d6d4..fa48de6 100644 --- a/crates/vise/src/format.rs +++ b/crates/vise/src/format.rs @@ -1,5 +1,7 @@ //! Support for various metrics encoding formats. +use prometheus_client::metrics::MetricType; + use std::{fmt, mem}; /// Metrics export format. @@ -7,11 +9,11 @@ use std::{fmt, mem}; /// Supported formats are quite similar, but differ how they encode counter values and whether /// they specify the `# EOF` terminator: /// -/// | Format | `_total` suffix for counters | `# EOF` | -/// |:-------|:-----------------------------|:--------| -/// | [`Self::OpenMetrics`] | yes | yes | -/// | [`Self::OpenMetricsForPrometheus`] | no | yes | -/// | [`Self::Prometheus`] | no | no | +/// | Format | `_total` suffix for counters | `_info` suffix for info | `# EOF` | +/// |:-------|:-----------------------------|:------------------------|:--------| +/// | [`Self::OpenMetrics`] | yes | yes | yes | +/// | [`Self::OpenMetricsForPrometheus`] | no | no | yes | +/// | [`Self::Prometheus`] | no | no | no | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[non_exhaustive] pub enum Format { @@ -23,15 +25,16 @@ pub enum Format { OpenMetrics, /// [Prometheus text format][prom]. Since it's quite similar to the OpenMetrics format, it's obtained by /// a streaming transform of OpenMetrics-encoded metrics that removes `_total` suffixes from - /// reported counter values and removes the `# EOF` terminator. + /// reported counter values, `_info` suffixes from reported info values + changes info types to "gauge", + /// and removes the `# EOF` terminator. /// /// [prom]: https://prometheus.io/docs/instrumenting/exposition_formats/ Prometheus, /// OpenMetrics text format as understood by Prometheus. /// /// Prometheus *mostly* understands the OpenMetrics format (e.g., enforcing no empty lines for it). - /// The notable exception is counter definitions; OpenMetrics requires - /// to append `_total` to the counter name (like `_sum` / `_count` / `_bucket` are appended + /// The notable exception is counter and info definitions; OpenMetrics requires + /// to append `_total` to the counter name and `_info` to the info name (like `_sum` / `_count` / `_bucket` are appended /// to histogram names), but Prometheus doesn't understand this (yet?). /// /// See also: [issue in `prometheus-client`](https://github.com/prometheus/client_rust/issues/111) @@ -50,7 +53,7 @@ impl Format { #[derive(Debug)] struct MetricTypeDefinition { name: String, - is_counter: bool, + ty: MetricType, } impl MetricTypeDefinition { @@ -61,7 +64,13 @@ impl MetricTypeDefinition { .ok_or(fmt::Error)?; Ok(Self { name: name.to_owned(), - is_counter: ty == "counter", + ty: match ty { + "counter" => MetricType::Counter, + "gauge" => MetricType::Gauge, + "histogram" => MetricType::Histogram, + "info" => MetricType::Info, + _ => MetricType::Unknown, + }, }) } } @@ -71,20 +80,30 @@ impl MetricTypeDefinition { pub(crate) struct PrometheusWrapper<'a, W> { writer: &'a mut W, remove_eof_terminator: bool, + translate_info_metrics_type: bool, last_metric_definition: Option, last_line: String, } impl<'a, W: fmt::Write> PrometheusWrapper<'a, W> { - pub(crate) fn new(writer: &'a mut W, remove_eof_terminator: bool) -> Self { + pub(crate) fn new(writer: &'a mut W) -> Self { Self { writer, - remove_eof_terminator, + remove_eof_terminator: false, + translate_info_metrics_type: false, last_metric_definition: None, last_line: String::new(), } } + pub(crate) fn remove_eof_terminator(&mut self) { + self.remove_eof_terminator = true; + } + + pub(crate) fn translate_info_metrics_type(&mut self) { + self.translate_info_metrics_type = true; + } + fn handle_line(&mut self) -> fmt::Result { let line = mem::take(&mut self.last_line); if line == "# EOF" && self.remove_eof_terminator { @@ -94,7 +113,11 @@ impl<'a, W: fmt::Write> PrometheusWrapper<'a, W> { let mut transformed_line = None; if let Some(type_def) = line.strip_prefix("# TYPE ") { - self.last_metric_definition = Some(MetricTypeDefinition::parse(type_def)?); + let metric_def = MetricTypeDefinition::parse(type_def)?; + if self.translate_info_metrics_type && matches!(metric_def.ty, MetricType::Info) { + transformed_line = Some(format!("# TYPE {} gauge", metric_def.name)); + } + self.last_metric_definition = Some(metric_def); } else if !line.starts_with('#') { // `line` reports a metric value let name_end_pos = line @@ -102,13 +125,25 @@ impl<'a, W: fmt::Write> PrometheusWrapper<'a, W> { .ok_or(fmt::Error)?; let (name, rest) = line.split_at(name_end_pos); - if let Some(metric_type) = &self.last_metric_definition { - let truncated_name = name.strip_suffix("_total"); - - if truncated_name == Some(&metric_type.name) && metric_type.is_counter { - // Remove `_total` suffix to the metric name, which is not present - // in the Prometheus text format, but is mandatory for the OpenMetrics format. - transformed_line = Some(format!("{}{rest}", metric_type.name)); + if let Some(metric_def) = &self.last_metric_definition { + match metric_def.ty { + MetricType::Counter => { + // Remove `_total` suffix to the metric name, which is not present + // in the Prometheus text format, but is mandatory for the OpenMetrics format. + let truncated_name = name.strip_suffix("_total"); + if truncated_name == Some(&metric_def.name) { + transformed_line = Some(format!("{}{rest}", metric_def.name)); + } + } + MetricType::Info => { + // Remove `_info` suffix to the metric name, which is not present + // in the Prometheus text format, but is mandatory for the OpenMetrics format. + let truncated_name = name.strip_suffix("_info"); + if truncated_name == Some(&metric_def.name) { + transformed_line = Some(format!("{}{rest}", metric_def.name)); + } + } + _ => { /* do nothing */ } } } } @@ -149,7 +184,8 @@ mod tests { #[test] fn translating_open_metrics_format() { let mut buffer = String::new(); - let mut wrapper = PrometheusWrapper::new(&mut buffer, true); + let mut wrapper = PrometheusWrapper::new(&mut buffer); + wrapper.remove_eof_terminator(); // Emulating breaking line into multiple write instructions write!(wrapper, "# HELP ").unwrap(); @@ -187,6 +223,9 @@ mod tests { #[test] fn translating_sample() { let input = "\ + # TYPE modern_package_metadata info\n\ + # HELP modern_package_metadata Package information.\n\ + modern_package_metadata_info{version=\"0.1.0\"} 1\n\ # TYPE modern_counter counter\n\ modern_counter_total 1\n\ # TYPE modern_gauge gauge\n\ @@ -195,6 +234,9 @@ mod tests { modern_counter_with_labels_total{label=\"value\"} 3\n\ modern_counter_with_labels_total{label=\"other\"} 5"; let expected = "\ + # TYPE modern_package_metadata gauge\n\ + # HELP modern_package_metadata Package information.\n\ + modern_package_metadata{version=\"0.1.0\"} 1\n\ # TYPE modern_counter counter\n\ modern_counter 1\n\ # TYPE modern_gauge gauge\n\ @@ -204,7 +246,9 @@ mod tests { modern_counter_with_labels{label=\"other\"} 5\n"; let mut buffer = String::new(); - let mut wrapper = PrometheusWrapper::new(&mut buffer, true); + let mut wrapper = PrometheusWrapper::new(&mut buffer); + wrapper.remove_eof_terminator(); + wrapper.translate_info_metrics_type(); wrapper.write_str(input).unwrap(); wrapper.flush().unwrap(); diff --git a/crates/vise/src/registry.rs b/crates/vise/src/registry.rs index a424eef..b1b357b 100644 --- a/crates/vise/src/registry.rs +++ b/crates/vise/src/registry.rs @@ -265,8 +265,11 @@ impl Registry { pub fn encode(&self, writer: &mut W, format: Format) -> fmt::Result { match format { Format::Prometheus | Format::OpenMetricsForPrometheus => { - let remove_eof_terminator = matches!(format, Format::Prometheus); - let mut wrapper = PrometheusWrapper::new(writer, remove_eof_terminator); + let mut wrapper = PrometheusWrapper::new(writer); + if matches!(format, Format::Prometheus) { + wrapper.remove_eof_terminator(); + wrapper.translate_info_metrics_type(); + } text::encode(&mut wrapper, &self.inner)?; wrapper.flush() } From 94fb1015083b6e932bc5c086e5f90df73badd0bc Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 11:34:57 +0300 Subject: [PATCH 03/11] Test info metrics end-to-end --- e2e-tests/src/main.rs | 14 +++++++++++++- e2e-tests/tests/integration.rs | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/e2e-tests/src/main.rs b/e2e-tests/src/main.rs index 99ae230..a562f38 100644 --- a/e2e-tests/src/main.rs +++ b/e2e-tests/src/main.rs @@ -6,7 +6,7 @@ use tokio::sync::watch; use std::{env, time::Duration}; use vise::{ - Buckets, Counter, EncodeLabelSet, EncodeLabelValue, Family, Format, Gauge, Histogram, + Buckets, Counter, EncodeLabelSet, EncodeLabelValue, Family, Format, Gauge, Histogram, Info, LabeledFamily, Metrics, Unit, }; use vise_exporter::MetricsExporter; @@ -18,9 +18,16 @@ enum Method { SendTransaction, } +#[derive(Debug, EncodeLabelSet)] +struct PackageMetadata { + version: &'static str, +} + #[derive(Debug, Metrics)] #[metrics(prefix = "test")] struct TestMetrics { + /// Metadata about the current Cargo package. + package_metadata: Info, /// Test counter. counter: Counter, #[metrics(unit = Unit::Bytes)] @@ -94,6 +101,11 @@ static METRICS: vise::Global = vise::Global::new(); #[tokio::main(flavor = "current_thread")] async fn main() { + METRICS + .package_metadata + .set(PackageMetadata { version: "0.1.0" }) + .unwrap(); + const METRICS_INTERVAL: Duration = Duration::from_secs(5); let mut args: Vec<_> = env::args().skip(1).collect(); diff --git a/e2e-tests/tests/integration.rs b/e2e-tests/tests/integration.rs index d62f7c4..01d677c 100644 --- a/e2e-tests/tests/integration.rs +++ b/e2e-tests/tests/integration.rs @@ -253,6 +253,18 @@ async fn assert_metrics(client: &Client, prom_format: bool) -> anyhow::Result<() } // Check metrics metadata. + let metadata = client + .metric_metadata(Some("test_package_metadata"), None) + .await?; + tracing::info!(?metadata, "Got metadata for info"); + let metadata = &metadata["test_package_metadata"][0]; + assert_eq!(metadata.help(), "Metadata about the current Cargo package."); + if prom_format { + assert_matches!(metadata.metric_type(), MetricType::Gauge); + } else { + assert_matches!(metadata.metric_type(), MetricType::Info); + } + let metadata = client.metric_metadata(Some("test_counter"), None).await?; tracing::info!(?metadata, "Got metadata for counter"); let metadata = &metadata["test_counter"][0]; @@ -273,6 +285,15 @@ async fn assert_metrics(client: &Client, prom_format: bool) -> anyhow::Result<() assert_eq!(metadata.unit(), "seconds"); } + let info_result = client.query("test_package_metadata").get().await?; + tracing::info!(?info_result, "Got result for query: test_package_metadata"); + let info_vec = info_result + .data() + .as_vector() + .context("Info data is not a vector")?; + let info_labels = info_vec[0].metric(); + assert_eq!(info_labels["version"], "0.1.0", "{info_labels:?}"); + let gauge_result = client.query("test_gauge_bytes").get().await?; tracing::info!(?gauge_result, "Got result for query: test_gauge_bytes"); let gauge_vec = gauge_result From c222565c601741ae4bf0aa84bcd6316543824a84 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 12:13:05 +0300 Subject: [PATCH 04/11] Sketch units for labels in a label set --- crates/vise-macros/src/labels.rs | 22 ++++++++++++++---- crates/vise/src/lib.rs | 5 ++++- crates/vise/src/tests.rs | 38 ++++++++++++++++++++++++++++++++ crates/vise/src/wrappers.rs | 37 ++++++++++++++++++++++++++----- 4 files changed, 91 insertions(+), 11 deletions(-) diff --git a/crates/vise-macros/src/labels.rs b/crates/vise-macros/src/labels.rs index 1f5ae6c..279da9c 100644 --- a/crates/vise-macros/src/labels.rs +++ b/crates/vise-macros/src/labels.rs @@ -2,7 +2,9 @@ use proc_macro::TokenStream; use quote::{quote, quote_spanned}; -use syn::{Attribute, Data, DeriveInput, Field, Fields, Ident, LitStr, Path, PathArguments, Type}; +use syn::{ + Attribute, Data, DeriveInput, Expr, Field, Fields, Ident, LitStr, Path, PathArguments, Type, +}; use std::{collections::HashSet, fmt}; @@ -291,6 +293,7 @@ impl EncodeLabelValueImpl { #[derive(Default)] struct LabelFieldAttrs { skip: Option, + unit: Option, } impl fmt::Debug for LabelFieldAttrs { @@ -298,6 +301,7 @@ impl fmt::Debug for LabelFieldAttrs { formatter .debug_struct("LabelFieldAttrs") .field("skip", &self.skip.as_ref().map(|_| "..")) + .field("unit", &self.unit.as_ref().map(|_| "..")) .finish() } } @@ -309,6 +313,9 @@ impl ParseAttribute for LabelFieldAttrs { if meta.path.is_ident("skip") { attrs.skip = Some(meta.value()?.parse()?); Ok(()) + } else if meta.path.is_ident("unit") { + attrs.unit = Some(meta.value()?.parse()?); + Ok(()) } else { Err(meta.error("unsupported attribute")) } @@ -368,10 +375,18 @@ impl LabelField { ) } - fn encode(&self, encoding: &proc_macro2::TokenStream) -> proc_macro2::TokenStream { + fn encode(&self, cr: &proc_macro2::TokenStream) -> proc_macro2::TokenStream { + let encoding = quote!(#cr::_reexports::encoding); + let name = &self.name; let span = name.span(); let label = self.label_literal(); + let label = if let Some(unit) = &self.attrs.unit { + quote_spanned!(span=> #cr::LabelWithUnit::new(#label, #unit)) + } else { + quote_spanned!(span=> #label) + }; + // Skip `Option`al fields by default if they are `None`. let default_skip: Path; let skip = if self.is_option && self.attrs.skip.is_none() { @@ -469,8 +484,7 @@ impl EncodeLabelSetImpl { let fields = self.fields.as_ref().unwrap(); let fields = fields.iter().map(|field| { let cr = self.attrs.path_to_crate(field.name.span()); - let encoding = quote!(#cr::_reexports::encoding); - field.encode(&encoding) + field.encode(&cr) }); quote! { #(#fields)* diff --git a/crates/vise/src/lib.rs b/crates/vise/src/lib.rs index fcced5d..f211010 100644 --- a/crates/vise/src/lib.rs +++ b/crates/vise/src/lib.rs @@ -384,7 +384,10 @@ pub use crate::{ CollectToRegistry, MetricsCollection, MetricsVisitor, RegisteredDescriptors, Registry, METRICS_REGISTRATIONS, }, - wrappers::{Family, Gauge, GaugeGuard, Histogram, Info, LabeledFamily, LatencyObserver}, + wrappers::{ + Family, Gauge, GaugeGuard, Histogram, Info, LabelWithUnit, LabeledFamily, LatencyObserver, + SetInfoError, + }, }; #[cfg(doctest)] diff --git a/crates/vise/src/tests.rs b/crates/vise/src/tests.rs index b3d3d53..74c0d40 100644 --- a/crates/vise/src/tests.rs +++ b/crates/vise/src/tests.rs @@ -377,6 +377,44 @@ fn renamed_labels() { } } +#[test] +fn labels_with_unit() { + #[derive(Debug, EncodeLabelSet)] + #[metrics(crate = crate)] + struct LabelsWithUnits { + #[metrics(unit = Unit::Bytes)] + capacity: u64, + #[metrics(unit = Unit::Seconds)] + timeout: f64, + } + + #[derive(Debug, Metrics)] + #[metrics(crate = crate, prefix = "test")] + struct InfoMetrics { + config: Info, + } + + let test_metrics = InfoMetrics::default(); + test_metrics + .config + .set(LabelsWithUnits { + capacity: 128, + timeout: 0.1, + }) + .ok(); + + let mut registry = Registry::empty(); + registry.register_metrics(&test_metrics); + let mut buffer = String::new(); + registry.encode(&mut buffer, Format::OpenMetrics).unwrap(); + let lines: Vec<_> = buffer.lines().collect(); + + assert!( + lines.contains(&r#"test_config_info{capacity_bytes="128",timeout_seconds="0.1"} 1"#), + "{lines:#?}" + ); +} + #[test] fn labeled_family_with_multiple_labels() { type ThreeLabels = (&'static str, &'static str, u8); diff --git a/crates/vise/src/wrappers.rs b/crates/vise/src/wrappers.rs index 381f462..9b3c2bf 100644 --- a/crates/vise/src/wrappers.rs +++ b/crates/vise/src/wrappers.rs @@ -3,10 +3,11 @@ use elsa::sync::FrozenMap; use once_cell::sync::OnceCell; use prometheus_client::{ - encoding::{EncodeLabelSet, EncodeMetric, MetricEncoder}, + encoding::{EncodeLabelKey, EncodeLabelSet, EncodeMetric, LabelKeyEncoder, MetricEncoder}, metrics::{ gauge::Gauge as GaugeInner, histogram::Histogram as HistogramInner, MetricType, TypedMetric, }, + registry::Unit, }; use std::{ @@ -25,6 +26,28 @@ use crate::{ traits::{EncodedGaugeValue, GaugeValue, HistogramValue, MapLabels}, }; +/// Label with a unit suffix implementing [`EncodeLabelKey`]. +#[doc(hidden)] // used in proc macros only +#[derive(Debug)] +pub struct LabelWithUnit { + name: &'static str, + unit: Unit, +} + +impl LabelWithUnit { + pub const fn new(name: &'static str, unit: Unit) -> Self { + Self { name, unit } + } +} + +impl EncodeLabelKey for LabelWithUnit { + fn encode(&self, encoder: &mut LabelKeyEncoder<'_>) -> fmt::Result { + use std::fmt::Write as _; + + write!(encoder, "{}_{}", self.name, self.unit.as_str()) + } +} + /// Gauge metric. /// /// Gauges are integer or floating-point values that can go up or down. Logically, a reported gauge value @@ -223,8 +246,8 @@ impl Info { /// # Errors /// /// Returns an error if the value is already set. - pub fn set(&self, value: S) -> Result<(), InfoSetError> { - self.0.set(value).map_err(InfoSetError) + pub fn set(&self, value: S) -> Result<(), SetInfoError> { + self.0.set(value).map_err(SetInfoError) } } @@ -246,16 +269,18 @@ impl TypedMetric for Info { const TYPE: MetricType = MetricType::Info; } +/// Error returned from [`Info::set()`]. #[derive(Debug)] -pub struct InfoSetError(S); +pub struct SetInfoError(S); -impl InfoSetError { +impl SetInfoError { + /// Converts the error into the unsuccessfully set value. pub fn into_inner(self) -> S { self.0 } } -impl fmt::Display for InfoSetError { +impl fmt::Display for SetInfoError { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { formatter.write_str("cannot set info metric value; it is already set") } From f5ed4d7501ceb90d6ab05776c49bb2f93a0ab720 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 12:32:30 +0300 Subject: [PATCH 05/11] Add `DurationAsSecs` wrapper --- crates/vise/src/lib.rs | 36 +++++++++++++++++++++++++++++++++++- crates/vise/src/wrappers.rs | 22 +++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/crates/vise/src/lib.rs b/crates/vise/src/lib.rs index f211010..23eff61 100644 --- a/crates/vise/src/lib.rs +++ b/crates/vise/src/lib.rs @@ -243,6 +243,13 @@ pub use vise_macros::EncodeLabelValue; /// /// [`EncodeLabelSet`]: trait@prometheus_client::encoding::EncodeLabelSet /// +/// ## `unit` +/// +/// **Type:** expression evaluating to [`Unit`] +/// +/// Specifies unit of measurement for a label. The unit will be added to the label name as a suffix +/// (e.g., `timeout_seconds` if placed on a field named `timeout`). This is mostly useful for [`Info`] metrics. +/// /// # Examples /// /// ## Set with a single label @@ -270,6 +277,33 @@ pub use vise_macros::EncodeLabelValue; /// num: u8, /// } /// ``` +/// +/// ## Set for info metric +/// +/// ``` +/// use vise::{EncodeLabelSet, DurationAsSecs, Unit}; +/// use std::time::Duration; +/// +/// #[derive(Debug, EncodeLabelSet)] +/// struct InfoLabels { +/// /// Simple label. +/// version: &'static str, +/// /// Label with a unit. +/// #[metrics(unit = Unit::Seconds)] +/// request_timeout: DurationAsSecs, +/// /// Another label with a unit. +/// #[metrics(unit = Unit::Bytes)] +/// buffer_capacity: u64, +/// } +/// +/// let labels = InfoLabels { +/// version: "0.1.0", +/// request_timeout: Duration::from_millis(100).into(), +/// buffer_capacity: 1_024, +/// }; +/// // will be exported as the following labels: +/// // { version="0.1.0", request_timeout_seconds="0.1", buffer_capacity="1024" } +/// ``` pub use vise_macros::EncodeLabelSet; /// Derives the [`Metrics`](trait@Metrics) trait for a type. @@ -386,7 +420,7 @@ pub use crate::{ }, wrappers::{ Family, Gauge, GaugeGuard, Histogram, Info, LabelWithUnit, LabeledFamily, LatencyObserver, - SetInfoError, + SetInfoError, DurationAsSecs, }, }; diff --git a/crates/vise/src/wrappers.rs b/crates/vise/src/wrappers.rs index 9b3c2bf..cc9459b 100644 --- a/crates/vise/src/wrappers.rs +++ b/crates/vise/src/wrappers.rs @@ -3,7 +3,7 @@ use elsa::sync::FrozenMap; use once_cell::sync::OnceCell; use prometheus_client::{ - encoding::{EncodeLabelKey, EncodeLabelSet, EncodeMetric, LabelKeyEncoder, MetricEncoder}, + encoding::{EncodeLabelKey, EncodeLabelValue, LabelValueEncoder, EncodeLabelSet, EncodeMetric, LabelKeyEncoder, MetricEncoder}, metrics::{ gauge::Gauge as GaugeInner, histogram::Histogram as HistogramInner, MetricType, TypedMetric, }, @@ -48,6 +48,23 @@ impl EncodeLabelKey for LabelWithUnit { } } +/// Wraps a [`Duration`] so that it can be used as a label value, which will be set to the fractional +/// number of seconds in the duration, i.e. [`Duration::as_secs_f64()`]. Mostly useful for [`Info`] metrics. +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct DurationAsSecs(pub Duration); + +impl From for DurationAsSecs { + fn from(duration: Duration) -> Self { + Self(duration) + } +} + +impl EncodeLabelValue for DurationAsSecs { + fn encode(&self, encoder: &mut LabelValueEncoder) -> fmt::Result { + EncodeLabelValue::encode(&self.0.as_secs_f64(), encoder) + } +} + /// Gauge metric. /// /// Gauges are integer or floating-point values that can go up or down. Logically, a reported gauge value @@ -220,6 +237,9 @@ impl LatencyObserver<'_> { } /// Information metric. +/// +/// Information metrics represent pieces of information that are not changed during program lifetime +/// (e.g., config parameters of a certain component). #[derive(Debug)] pub struct Info(Arc>); From 424c50ea055eb2da7b2389a07ed44c83e8bb30d2 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 14:26:40 +0300 Subject: [PATCH 06/11] Mention info metrics in main crate readme --- crates/vise/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/vise/README.md b/crates/vise/README.md index 5291552..62c217d 100644 --- a/crates/vise/README.md +++ b/crates/vise/README.md @@ -32,6 +32,10 @@ Prometheus and compatible systems supports 3 main [metric types](https://prometh Metrics of all types can be supplied with _labels_. Each set of labels defines a separate metric. Thus, label space should be reasonably small. +Besides these main types, Prometheus and this library support an additional **info** metric type. It should be used to observe +values that do not change during the program lifetime (component configurations, metadata like app version / git commit, etc.). +Values for this metric type are encoded as labels. Conceptually, an info metric is similar to a gauge with a constant value 1. + ## Usage Add this to your Crate.toml: @@ -104,7 +108,7 @@ _See also: [Prometheus guidelines](https://prometheus.io/docs/practices/naming/) Prefixes should be separated by a single `_` char. - Metrics with a unit should have a corresponding suffix (e.g., `_seconds`). This suffix is automatically added to the metric name if you specify its unit; you **must not** specify it manually. -- Label names should not repeat the metric name and should not include units. +- Label names should not repeat the metric name. - Label values for each label should have reasonably low cardinality. - If a label value encodes to a string (as opposed to an integer, integer range etc.), it should use snake_case. - Metrics in a `Family` should have uniform meaning. If a `Family` can be documented without going into label specifics, From 21ea3961579d54d356bac1c153a6e7b796f120b5 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 15:35:41 +0300 Subject: [PATCH 07/11] Update `prometheus-client` to 0.22.2 --- Cargo.toml | 2 +- crates/vise-macros/src/metrics.rs | 2 +- crates/vise/src/collector.rs | 33 ++++++++-------------- crates/vise/src/lib.rs | 4 +-- crates/vise/src/metrics.rs | 6 ++-- crates/vise/src/registry.rs | 47 ++++++++++++++++++++++++------- crates/vise/src/wrappers.rs | 13 +++++---- 7 files changed, 64 insertions(+), 43 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8cd2dc9..9625738 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ metrics = "0.21" metrics-exporter-prometheus = { version = "0.12", default-features = false } once_cell = "1.17" proc-macro2 = "1.0.7" -prometheus-client = "0.21.2" +prometheus-client = "0.22.2" prometheus-http-query = "0.6.6" quote = "1" rand = "0.8" diff --git a/crates/vise-macros/src/metrics.rs b/crates/vise-macros/src/metrics.rs index 22efd7d..f982cd2 100644 --- a/crates/vise-macros/src/metrics.rs +++ b/crates/vise-macros/src/metrics.rs @@ -339,7 +339,7 @@ impl MetricsImpl { impl #cr::Metrics for #name { const DESCRIPTOR: #cr::descriptors::MetricGroupDescriptor = #descriptor; - fn visit_metrics(&self, mut visitor: #cr::MetricsVisitor<'_>) { + fn visit_metrics(&self, visitor: &mut #cr::MetricsVisitor<'_>) { #(#visit_fields;)* } } diff --git a/crates/vise/src/collector.rs b/crates/vise/src/collector.rs index a7ce254..ffd06cc 100644 --- a/crates/vise/src/collector.rs +++ b/crates/vise/src/collector.rs @@ -1,11 +1,7 @@ use once_cell::sync::{Lazy, OnceCell}; -use prometheus_client::{ - collector::Collector as CollectorTrait, - registry::{Descriptor, LocalMetric}, - MaybeOwned, -}; +use prometheus_client::{collector::Collector as CollectorTrait, encoding::DescriptorEncoder}; -use std::{borrow::Cow, error, fmt, iter}; +use std::{error, fmt}; use crate::{ descriptors::MetricGroupDescriptor, @@ -14,7 +10,6 @@ use crate::{ }; type CollectorFn = Box M + Send + Sync>; -type CollectorItem<'a> = (Cow<'a, Descriptor>, MaybeOwned<'a, Box>); /// Error that can occur when calling [`Collector::before_scrape()`]. #[derive(Debug)] @@ -80,23 +75,17 @@ impl Collector { } impl CollectorTrait for &'static Collector { - fn collect<'a>(&'a self) -> Box> + 'a> { + fn encode(&self, encoder: DescriptorEncoder<'_>) -> fmt::Result { if let Some(hook) = self.inner.get() { - Box::new(collect_metrics(&hook())) + let mut visitor = MetricsVisitor::for_collector(encoder); + hook().visit_metrics(&mut visitor); + visitor.check() } else { - Box::new(iter::empty()) + Ok(()) } } } -fn collect_metrics<'a>(metrics: &impl Metrics) -> impl Iterator> { - let mut boxed_metrics = vec![]; - metrics.visit_metrics(MetricsVisitor::for_collector(&mut boxed_metrics)); - boxed_metrics - .into_iter() - .map(|(descriptor, metric)| (Cow::Owned(descriptor), MaybeOwned::Owned(metric))) -} - impl CollectToRegistry for Collector { fn descriptor(&self) -> &'static MetricGroupDescriptor { &M::DESCRIPTOR @@ -126,11 +115,13 @@ impl LazyGlobalCollector { } impl CollectorTrait for LazyGlobalCollector { - fn collect<'a>(&'a self) -> Box> + 'a> { + fn encode(&self, encoder: DescriptorEncoder<'_>) -> fmt::Result { if let Some(metrics) = Lazy::get(self.0) { - Box::new(collect_metrics(metrics)) + let mut visitor = MetricsVisitor::for_collector(encoder); + metrics.visit_metrics(&mut visitor); + visitor.check() } else { - Box::new(iter::empty()) + Ok(()) } } } diff --git a/crates/vise/src/lib.rs b/crates/vise/src/lib.rs index 23eff61..fd80006 100644 --- a/crates/vise/src/lib.rs +++ b/crates/vise/src/lib.rs @@ -419,8 +419,8 @@ pub use crate::{ METRICS_REGISTRATIONS, }, wrappers::{ - Family, Gauge, GaugeGuard, Histogram, Info, LabelWithUnit, LabeledFamily, LatencyObserver, - SetInfoError, DurationAsSecs, + DurationAsSecs, Family, Gauge, GaugeGuard, Histogram, Info, LabelWithUnit, LabeledFamily, + LatencyObserver, SetInfoError, }, }; diff --git a/crates/vise/src/metrics.rs b/crates/vise/src/metrics.rs index 636e8ea..194a2b3 100644 --- a/crates/vise/src/metrics.rs +++ b/crates/vise/src/metrics.rs @@ -15,13 +15,13 @@ pub trait Metrics: 'static + Send + Sync { const DESCRIPTOR: MetricGroupDescriptor; #[doc(hidden)] // implementation detail - fn visit_metrics(&self, visitor: MetricsVisitor<'_>); + fn visit_metrics(&self, visitor: &mut MetricsVisitor<'_>); } impl Metrics for &'static M { const DESCRIPTOR: MetricGroupDescriptor = M::DESCRIPTOR; - fn visit_metrics(&self, visitor: MetricsVisitor<'_>) { + fn visit_metrics(&self, visitor: &mut MetricsVisitor<'_>) { (**self).visit_metrics(visitor); } } @@ -29,7 +29,7 @@ impl Metrics for &'static M { impl Metrics for Option { const DESCRIPTOR: MetricGroupDescriptor = M::DESCRIPTOR; - fn visit_metrics(&self, visitor: MetricsVisitor<'_>) { + fn visit_metrics(&self, visitor: &mut MetricsVisitor<'_>) { if let Some(metrics) = self { metrics.visit_metrics(visitor); } diff --git a/crates/vise/src/registry.rs b/crates/vise/src/registry.rs index b1b357b..d491f8b 100644 --- a/crates/vise/src/registry.rs +++ b/crates/vise/src/registry.rs @@ -2,8 +2,8 @@ use linkme::distributed_slice; use prometheus_client::{ - encoding::text, - registry::{Descriptor, LocalMetric, Metric, Registry as RegistryInner, Unit}, + encoding::{text, DescriptorEncoder}, + registry::{Metric, Registry as RegistryInner, Unit}, }; use std::{collections::HashMap, fmt}; @@ -237,8 +237,8 @@ impl Registry { /// Registers a group of metrics. pub fn register_metrics(&mut self, metrics: &M) { self.descriptors.push(&M::DESCRIPTOR); - let visitor = MetricsVisitor(MetricsVisitorInner::Registry(self)); - metrics.visit_metrics(visitor); + let mut visitor = MetricsVisitor(MetricsVisitorInner::Registry(self)); + metrics.visit_metrics(&mut visitor); } pub(crate) fn register_global_metrics(&mut self, metrics: &'static Global) { @@ -281,7 +281,7 @@ impl Registry { #[derive(Debug)] enum MetricsVisitorInner<'a> { Registry(&'a mut Registry), - Collector(&'a mut Vec<(Descriptor, Box)>), + Collector(Result, fmt::Error>), } /// Visitor for a group of metrics in a [`Registry`]. @@ -289,8 +289,15 @@ enum MetricsVisitorInner<'a> { pub struct MetricsVisitor<'a>(MetricsVisitorInner<'a>); impl<'a> MetricsVisitor<'a> { - pub(crate) fn for_collector(metrics: &'a mut Vec<(Descriptor, Box)>) -> Self { - Self(MetricsVisitorInner::Collector(metrics)) + pub(crate) fn for_collector(encoder: DescriptorEncoder<'a>) -> Self { + Self(MetricsVisitorInner::Collector(Ok(encoder))) + } + + pub(crate) fn check(self) -> fmt::Result { + match self.0 { + MetricsVisitorInner::Registry(_) => Ok(()), + MetricsVisitorInner::Collector(res) => res.map(drop), + } } /// Registers a metric of family of metrics. @@ -309,12 +316,32 @@ impl<'a> MetricsVisitor<'a> { registry.inner.register(name, help, metric); } } - MetricsVisitorInner::Collector(collector) => { - let descriptor = Descriptor::new(name, help, unit, None, vec![]); - collector.push((descriptor, Box::new(metric))); + MetricsVisitorInner::Collector(encode_result) => { + if let Ok(encoder) = encode_result { + let new_result = + Self::encode_metric(encoder, name, help, unit.as_ref(), &metric); + if let Err(err) = new_result { + *encode_result = Err(err); + } + } } } } + + fn encode_metric( + encoder: &mut DescriptorEncoder<'_>, + name: &'static str, + help: &'static str, + unit: Option<&Unit>, + metric: &impl Metric, + ) -> fmt::Result { + // Append a full stop to `help` to be consistent with registered metrics. + let mut help = String::from(help); + help.push('.'); + + let metric_encoder = encoder.encode_descriptor(name, &help, unit, metric.metric_type())?; + metric.encode(metric_encoder) + } } /// Collects metrics from this type to registry. This is used by the [`register`](crate::register) diff --git a/crates/vise/src/wrappers.rs b/crates/vise/src/wrappers.rs index cc9459b..69a565d 100644 --- a/crates/vise/src/wrappers.rs +++ b/crates/vise/src/wrappers.rs @@ -3,7 +3,10 @@ use elsa::sync::FrozenMap; use once_cell::sync::OnceCell; use prometheus_client::{ - encoding::{EncodeLabelKey, EncodeLabelValue, LabelValueEncoder, EncodeLabelSet, EncodeMetric, LabelKeyEncoder, MetricEncoder}, + encoding::{ + EncodeLabelKey, EncodeLabelSet, EncodeLabelValue, EncodeMetric, LabelKeyEncoder, + LabelValueEncoder, MetricEncoder, + }, metrics::{ gauge::Gauge as GaugeInner, histogram::Histogram as HistogramInner, MetricType, TypedMetric, }, @@ -129,7 +132,7 @@ impl Gauge { } impl EncodeMetric for Gauge { - fn encode(&self, mut encoder: MetricEncoder<'_, '_>) -> fmt::Result { + fn encode(&self, mut encoder: MetricEncoder<'_>) -> fmt::Result { match self.get().encode() { EncodedGaugeValue::I64(value) => encoder.encode_gauge(&value), EncodedGaugeValue::F64(value) => encoder.encode_gauge(&value), @@ -206,7 +209,7 @@ impl Histogram { } impl EncodeMetric for Histogram { - fn encode(&self, encoder: MetricEncoder<'_, '_>) -> fmt::Result { + fn encode(&self, encoder: MetricEncoder<'_>) -> fmt::Result { self.inner.encode(encoder) } @@ -272,7 +275,7 @@ impl Info { } impl EncodeMetric for Info { - fn encode(&self, mut encoder: MetricEncoder<'_, '_>) -> fmt::Result { + fn encode(&self, mut encoder: MetricEncoder<'_>) -> fmt::Result { if let Some(value) = self.0.get() { encoder.encode_info(value) } else { @@ -510,7 +513,7 @@ where S: Clone + Eq + Hash, L: MapLabels, { - fn encode(&self, mut encoder: MetricEncoder<'_, '_>) -> fmt::Result { + fn encode(&self, mut encoder: MetricEncoder<'_>) -> fmt::Result { for labels in &self.inner.map.keys_cloned() { let metric = self.inner.map.get(labels).unwrap(); let mapped_labels = self.labels.map_labels(labels); From d3ed1ace73051a93c8d5c8f7259f8f39cc1f9b36 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 15:36:05 +0300 Subject: [PATCH 08/11] Update `prometheus-http-query` to 0.8.2 --- Cargo.toml | 2 +- e2e-tests/tests/integration.rs | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9625738..4f26ce4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ metrics-exporter-prometheus = { version = "0.12", default-features = false } once_cell = "1.17" proc-macro2 = "1.0.7" prometheus-client = "0.22.2" -prometheus-http-query = "0.6.6" +prometheus-http-query = "0.8.2" quote = "1" rand = "0.8" syn = { version = "2.0", features = ["full"] } diff --git a/e2e-tests/tests/integration.rs b/e2e-tests/tests/integration.rs index 01d677c..ee743f7 100644 --- a/e2e-tests/tests/integration.rs +++ b/e2e-tests/tests/integration.rs @@ -254,7 +254,9 @@ async fn assert_metrics(client: &Client, prom_format: bool) -> anyhow::Result<() // Check metrics metadata. let metadata = client - .metric_metadata(Some("test_package_metadata"), None) + .metric_metadata() + .metric("test_package_metadata") + .get() .await?; tracing::info!(?metadata, "Got metadata for info"); let metadata = &metadata["test_package_metadata"][0]; @@ -265,14 +267,20 @@ async fn assert_metrics(client: &Client, prom_format: bool) -> anyhow::Result<() assert_matches!(metadata.metric_type(), MetricType::Info); } - let metadata = client.metric_metadata(Some("test_counter"), None).await?; + let metadata = client + .metric_metadata() + .metric("test_counter") + .get() + .await?; tracing::info!(?metadata, "Got metadata for counter"); let metadata = &metadata["test_counter"][0]; assert_eq!(metadata.help(), "Test counter."); assert_matches!(metadata.metric_type(), MetricType::Counter); let metadata = client - .metric_metadata(Some("test_family_of_histograms_seconds"), None) + .metric_metadata() + .metric("test_family_of_histograms_seconds") + .get() .await?; tracing::info!(?metadata, "Got metadata for family of histograms"); let metadata = &metadata["test_family_of_histograms_seconds"][0]; @@ -346,7 +354,11 @@ async fn assert_metrics(client: &Client, prom_format: bool) -> anyhow::Result<() } async fn assert_legacy_metrics(client: &Client) -> anyhow::Result<()> { - let metadata = client.metric_metadata(Some("legacy_counter"), None).await?; + let metadata = client + .metric_metadata() + .metric("legacy_counter") + .get() + .await?; tracing::info!(?metadata, "Got metadata for legacy counter"); let metadata = &metadata["legacy_counter"][0]; assert_matches!(metadata.metric_type(), MetricType::Counter); From 32030dba242fa5ca3fe87765b928f85bd6eba92a Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 15:36:14 +0300 Subject: [PATCH 09/11] Update workspace lockfile --- Cargo.lock | 410 +++++++++++++++++++++++++++++------------------------ 1 file changed, 225 insertions(+), 185 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59e106f..51264d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "once_cell", @@ -31,18 +31,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "assert_matches" @@ -52,15 +52,15 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -77,15 +77,6 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" -[[package]] -name = "basic-toml" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2db21524cad41c5591204d22d75e1970a2d1f71060214ca931dc7d5afe2c14e5" -dependencies = [ - "serde", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -94,30 +85,27 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" [[package]] name = "cfg-if" @@ -175,6 +163,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", + "serde", ] [[package]] @@ -204,9 +193,9 @@ checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "elsa" @@ -226,6 +215,18 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-as-inner" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ffccbb6966c05b32ef8fbac435df276c4ae4d3dc55a8cd0eb9745e6c12f546a" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.58", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -244,9 +245,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fnv" @@ -342,9 +343,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ "bytes", "fnv", @@ -352,7 +353,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.2", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -380,17 +381,23 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -485,9 +492,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -510,15 +517,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -537,22 +544,22 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "linkme" -version = "0.3.22" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b53ad6a33de58864705954edb5ad5d571a010f9e296865ed43dc72a5621b430" +checksum = "bb2cfee0de9bd869589fb9a015e155946d1be5ff415cb844c2caccc6cc4b5db9" dependencies = [ "linkme-impl", ] [[package]] name = "linkme-impl" -version = "0.3.22" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e542a18c94a9b6fcc7adb090fa3ba6b79ee220a16404f325672729f32a66ff" +checksum = "adf157a4dc5a29b7b464aa8fe7edeff30076e07e13646a1c3874f58477dc99f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", ] [[package]] @@ -573,9 +580,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "mach2" @@ -588,9 +595,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "metrics" @@ -625,7 +632,7 @@ checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", ] [[package]] @@ -651,18 +658,18 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", @@ -730,11 +737,11 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.63" +version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -751,7 +758,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", ] [[package]] @@ -762,9 +769,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.99" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", @@ -809,9 +816,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -821,9 +828,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "portable-atomic" @@ -861,18 +868,18 @@ checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] [[package]] name = "prometheus-client" -version = "0.21.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c99afa9a01501019ac3a14d71d9f94050346f55ca471ce90c799a15c58f61e2" +checksum = "c1ca959da22a332509f2a73ae9e5f23f9dcfc31fd3a54d71f159495bd5909baa" dependencies = [ "dtoa", "itoa", @@ -888,19 +895,19 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", ] [[package]] name = "prometheus-http-query" -version = "0.6.7" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6704e3a7a78545b1496524d518658005a6cc308abc90ce5fccf01891ecdc298b" +checksum = "e0de773a6ba25c9164ed9d86d653a92fac759a6f0e683fd141d56bb96e80fd8b" dependencies = [ + "enum-as-inner", "mime", "reqwest", "serde", - "serde_json", "time", "url", ] @@ -911,7 +918,7 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "memchr", "unicase", ] @@ -991,9 +998,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -1003,9 +1010,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -1014,15 +1021,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.11.24" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64", "bytes", @@ -1075,11 +1082,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.30" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -1097,9 +1104,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "schannel" @@ -1118,9 +1125,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -1131,9 +1138,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys", "libc", @@ -1141,35 +1148,35 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", ] [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ "itoa", "ryu", @@ -1217,9 +1224,9 @@ dependencies = [ [[package]] name = "sketches-ddsketch" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a406c1882ed7f29cd5e248c9848a80e7cb6ae0fea82346d2746f2f941c07e1" +checksum = "85636c14b73d81f541e525f585c0a2109e6744e1565b5c1668e31c70c10ed65c" [[package]] name = "slab" @@ -1232,18 +1239,18 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1265,9 +1272,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" dependencies = [ "proc-macro2", "quote", @@ -1303,13 +1310,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", "windows-sys 0.52.0", ] @@ -1325,29 +1331,29 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -1355,9 +1361,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe80ced77cbfb4cb91a94bf72b378b4b6791a0d9b7f09d0be747d1bdff4e68bd" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "num-conv", @@ -1400,9 +1406,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", @@ -1425,7 +1431,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", ] [[package]] @@ -1461,7 +1467,19 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.19.15", +] + +[[package]] +name = "toml" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.9", ] [[package]] @@ -1479,11 +1497,24 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" +dependencies = [ + "indexmap 2.2.6", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.5", ] [[package]] @@ -1511,7 +1542,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", ] [[package]] @@ -1580,17 +1611,17 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trybuild" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9d3ba662913483d6722303f619e75ea10b7855b0f8e0d72799cf8621bb488f" +checksum = "8ad7eb6319ebadebca3dacf1f85a93bc54b73dd81b9036795f73de7ddfe27d5a" dependencies = [ - "basic-toml", "glob", "once_cell", "serde", "serde_derive", "serde_json", "termcolor", + "toml 0.8.12", ] [[package]] @@ -1616,9 +1647,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -1657,8 +1688,8 @@ dependencies = [ "pulldown-cmark", "regex", "semver", - "syn 2.0.48", - "toml", + "syn 2.0.58", + "toml 0.7.8", "url", ] @@ -1726,7 +1757,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", "version-sync", ] @@ -1747,9 +1778,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1757,24 +1788,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -1784,9 +1815,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1794,28 +1825,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -1867,7 +1898,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.4", ] [[package]] @@ -1887,17 +1918,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -1908,9 +1939,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" @@ -1920,9 +1951,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" @@ -1932,9 +1963,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" @@ -1944,9 +1975,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" @@ -1956,9 +1987,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" @@ -1968,9 +1999,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" @@ -1980,15 +2011,24 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "winnow" -version = "0.5.36" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818ce546a11a9986bc24f93d0cdf38a8a1a400f1473ea8c82e59f6e0ffab9249" +checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" dependencies = [ "memchr", ] @@ -2020,5 +2060,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.58", ] From ab9e351d1348f9baaa2cf99497a5e3827fc992b4 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 15:49:09 +0300 Subject: [PATCH 10/11] Bump versions for GitHub Actions --- .github/workflows/cargo-license.yaml | 2 +- .github/workflows/rust.yml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cargo-license.yaml b/.github/workflows/cargo-license.yaml index 189b471..47e574b 100644 --- a/.github/workflows/cargo-license.yaml +++ b/.github/workflows/cargo-license.yaml @@ -4,5 +4,5 @@ jobs: cargo-deny: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: EmbarkStudios/cargo-deny-action@v1 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d9ab70a..ba703d4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,14 +20,14 @@ jobs: build-msrv: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.msrv }} - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.3 + uses: mozilla-actions/sccache-action@v0.0.4 - name: Build libraries run: cargo build --workspace --exclude vise-e2e-tests --lib --all-features @@ -37,7 +37,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@master @@ -45,7 +45,7 @@ jobs: toolchain: stable components: rustfmt, clippy, rust-src - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.3 + uses: mozilla-actions/sccache-action@v0.0.4 - name: Format run: cargo fmt --all -- --check @@ -69,14 +69,14 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.nightly }} - name: Install sccache - uses: mozilla-actions/sccache-action@v0.0.3 + uses: mozilla-actions/sccache-action@v0.0.4 - name: Build docs run: | From 8c82120dba612da9832ea707f449dccc46b35671 Mon Sep 17 00:00:00 2001 From: Alex Ostrovski Date: Wed, 3 Apr 2024 15:49:28 +0300 Subject: [PATCH 11/11] Update UI test snapshots --- crates/vise/tests/ui/labels/unimplemented_format.stderr | 2 +- crates/vise/tests/ui/metrics/bogus_buckets.stderr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/vise/tests/ui/labels/unimplemented_format.stderr b/crates/vise/tests/ui/labels/unimplemented_format.stderr index 09abb6f..66f48bc 100644 --- a/crates/vise/tests/ui/labels/unimplemented_format.stderr +++ b/crates/vise/tests/ui/labels/unimplemented_format.stderr @@ -9,6 +9,6 @@ error[E0277]: `Label` doesn't implement `std::fmt::Display` | $dst.write_fmt($crate::format_args!($($arg)*)) | ------------------------------ in this macro invocation | - = help: the trait `std::fmt::Display` is not implemented for `Label` + = help: the trait `std::fmt::Display` is not implemented for `Label`, which is required by `&Label: std::fmt::Display` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead = note: this error originates in the macro `$crate::format_args` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/vise/tests/ui/metrics/bogus_buckets.stderr b/crates/vise/tests/ui/metrics/bogus_buckets.stderr index cc09abf..fa92bcf 100644 --- a/crates/vise/tests/ui/metrics/bogus_buckets.stderr +++ b/crates/vise/tests/ui/metrics/bogus_buckets.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Buckets: From<&str>` is not satisfied --> tests/ui/metrics/bogus_buckets.rs:6:25 | 6 | #[metrics(buckets = "42")] - | ^^^^ the trait `From<&str>` is not implemented for `Buckets` + | ^^^^ the trait `From<&str>` is not implemented for `Buckets`, which is required by `&str: Into` 7 | histogram: Histogram, | --------- required by a bound introduced by this call |