pub struct DataSourceBuilder {
pub authority: String,
pub scheme: Option<String>,
pub prefix: Option<String>,
pub query: Option<Query>,
pub http_timeout: Option<Duration>,
}
Expand description
A Builder struct to create the DataSource
Fields§
Allows setting the http://
scheme: Option<String>
Allows setting the
prefix: Option<String>
Allows setting the scheme://authority/authority
as other components and the api/v1/query should be
prefixed with a specific route.
query: Option<Query>
Sets the query parameter
http_timeout: Option<Duration>
Sets the timeout for the HTTP connection to the prometheus server
Implementations§
Source§impl DataSourceBuilder
impl DataSourceBuilder
Sourcepub fn new(authority: &str) -> Self
pub fn new(authority: &str) -> Self
Initializes the builder for the DataSource, required param is the authority, may contain
user:password@host:port
, or host:port
Sourcepub fn with_prefix(self, prefix: String) -> Self
pub fn with_prefix(self, prefix: String) -> Self
Sets the prefix that hosts prometheus, useful when prometheus is behind a shared reverse proxy
Sourcepub fn with_query(self, query: Query) -> Self
pub fn with_query(self, query: Query) -> Self
Sets the prometheus query param.
Sourcepub fn with_scheme(self, scheme: String) -> Self
pub fn with_scheme(self, scheme: String) -> Self
Sets the URL scheme, be it http or https
Sourcepub fn build(self) -> Result<DataSource, DataSourceError>
pub fn build(self) -> Result<DataSource, DataSourceError>
Builds into DataSource after checking and merging fields