vector/sinks/prometheus/
mod.rs1#[cfg(test)]
2use vector_lib::event::Metric;
3use vector_lib::sensitive_string::SensitiveString;
4
5mod collector;
6pub mod exporter;
7pub mod remote_write;
8
9use vector_lib::configurable::configurable_component;
10
11#[configurable_component]
13#[derive(Clone, Debug)]
14#[serde(deny_unknown_fields, rename_all = "snake_case", tag = "strategy")]
15#[configurable(metadata(docs::enum_tag_description = "The authentication strategy to use."))]
16pub enum PrometheusRemoteWriteAuth {
17 Basic {
19 user: String,
21
22 password: String,
24 },
25
26 Bearer {
30 token: SensitiveString,
32 },
33
34 #[cfg(feature = "aws-core")]
35 Aws(crate::aws::AwsAuthentication),
37}
38
39fn default_histogram_buckets() -> Vec<f64> {
40 vec![
41 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0,
42 ]
43}
44
45fn default_summary_quantiles() -> Vec<f64> {
46 vec![0.5, 0.75, 0.9, 0.95, 0.99]
47}
48
49#[cfg(test)]
50fn distribution_to_agg_histogram(metric: Metric, buckets: &[f64]) -> Option<Metric> {
51 let new_value = metric
53 .value()
54 .clone()
55 .distribution_to_agg_histogram(buckets);
56 new_value.map(move |value| metric.with_value(value))
57}
58
59#[cfg(test)]
60fn distribution_to_ddsketch(metric: Metric) -> Option<Metric> {
61 let new_value = metric.value().clone().distribution_to_sketch();
63 new_value.map(move |value| metric.with_value(value))
64}