#[non_exhaustive]pub struct PushGatewayConfig {
pub endpoint: Url,
pub job: String,
pub labels: Vec<(String, String)>,
pub timeout: Duration,
pub retries: u32,
pub user_agent: String,
pub metric_prefix: String,
pub delete_on_finish: bool,
}Expand description
Configuration for a PushGateway sink.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.endpoint: UrlBase Pushgateway URL.
The final request path is built as
/metrics/job/{job}/{label}/{value}/....
job: StringPushgateway job name.
labels: Vec<(String, String)>Grouping labels encoded into the Pushgateway request path.
timeout: DurationPer-request HTTP timeout.
retries: u32Number of retries after the first failed request.
user_agent: StringHTTP User-Agent header.
metric_prefix: StringPrefix for emitted Prometheus metric names.
delete_on_finish: boolDelete this grouping key from Pushgateway after the run finishes.
Implementations§
Source§impl PushGatewayConfig
impl PushGatewayConfig
Sourcepub const DEFAULT_JOB: &'static str = "iperf3"
pub const DEFAULT_JOB: &'static str = "iperf3"
Default Pushgateway job name used by the CLI and builder.
Sourcepub const DEFAULT_METRIC_PREFIX: &'static str = PrometheusEncoder::DEFAULT_PREFIX
pub const DEFAULT_METRIC_PREFIX: &'static str = PrometheusEncoder::DEFAULT_PREFIX
Default metric prefix used by the CLI and builder.
Sourcepub const DEFAULT_RETRIES: u32 = 0
pub const DEFAULT_RETRIES: u32 = 0
Default number of Pushgateway retries after the first failed request.
Sourcepub const MAX_RETRIES: u32 = 10
pub const MAX_RETRIES: u32 = 10
Maximum supported retry count.
Sourcepub fn new(endpoint: Url) -> Self
pub fn new(endpoint: Url) -> Self
Build a config with production-safe defaults for every field except the Pushgateway endpoint.
Sourcepub fn parse_endpoint(raw: &str) -> Result<Url>
pub fn parse_endpoint(raw: &str) -> Result<Url>
Parse a Pushgateway endpoint, defaulting bare host:port values to HTTP.
Sourcepub const fn default_timeout() -> Duration
pub const fn default_timeout() -> Duration
Default per-request timeout.
Sourcepub fn default_user_agent() -> String
pub fn default_user_agent() -> String
Default HTTP User-Agent.
Sourcepub fn label(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn label(self, name: impl Into<String>, value: impl Into<String>) -> Self
Add one grouping label.
Sourcepub fn retries(self, retries: u32) -> Self
pub fn retries(self, retries: u32) -> Self
Set the number of retries after the first failed request.
Sourcepub fn user_agent(self, user_agent: impl Into<String>) -> Self
pub fn user_agent(self, user_agent: impl Into<String>) -> Self
Set the HTTP User-Agent.
Sourcepub fn metric_prefix(self, metric_prefix: impl Into<String>) -> Self
pub fn metric_prefix(self, metric_prefix: impl Into<String>) -> Self
Set the Prometheus metric name prefix.
Sourcepub fn delete_on_finish(self, delete: bool) -> Self
pub fn delete_on_finish(self, delete: bool) -> Self
Delete this grouping key from Pushgateway after direct delivery finishes.
Trait Implementations§
Source§impl Clone for PushGatewayConfig
impl Clone for PushGatewayConfig
Source§fn clone(&self) -> PushGatewayConfig
fn clone(&self) -> PushGatewayConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more