pub struct RemapperRule { /* private fields */ }Expand description
A metric remapping rule.
Rules define the basic matching behavior (metric name, and optionally tags) as well as how to remap the new copy of the metric. This can include copying tags as-is from the source metric, copying specific tags over with a new name, and adding an additional fixed set of tags to the new metric.
Implementations§
Source§impl RemapperRule
impl RemapperRule
Sourcepub fn by_name(existing_name: &'static str, new_name: &'static str) -> Self
pub fn by_name(existing_name: &'static str, new_name: &'static str) -> Self
Creates a new RemapperRule that matches a source metric by name only.
Creates a new RemapperRule that matches a source metric by name and tags.
Adds a set of tags to remap from the source metric by changing their name.
Remapped tags must be given in the form of (source_tag, destination_tag). If a tag by the name source_tag is
found in the source metric, it’s copied to the remapped metric with a name of destination_tag.
This method is additive, so it can be called multiple times to add more remapped tags. Tag remapping is order-dependent, so if a tag is configured to be remapped, or copied, multiple times, then the first match will take precedence.
Adds a set of tags to remap from the source metric without changing their name.
Remapped tags must be given in the form of source_tag. If a tag by the name source_tag is found in the
source metric, it’s copied to the remapped metric with the same name.
This method is additive, so it can be called multiple times to add more original tags. Tag remapping is order-dependent, so if a tag is configured to be copied, or remapped, multiple times, then the first match will take precedence.
Adds a fixed set of tags to add to the remapped metric.
Additional tags are given in the form of tag, which can be any valid tag value: bare or key/value.
This method is additive, so it can be called multiple times to add more additional tags.
Sourcepub fn with_continued_matching(self) -> Self
pub fn with_continued_matching(self) -> Self
Allows later rules to also match the same source metric.
Sourcepub fn with_help_text(self, help_text: &'static str) -> Self
pub fn with_help_text(self, help_text: &'static str) -> Self
Sets the Prometheus # HELP text that should be emitted alongside the remapped metric.
Some downstream collectors (notably the Datadog Agent’s OpenMetrics check) require a specific help text on overlapped metric names. Setting this here keeps the help text next to the rule that produces the name.
Sourcepub const fn should_continue_matching(&self) -> bool
pub const fn should_continue_matching(&self) -> bool
Returns true if matching should continue after this rule matches.
Sourcepub const fn remapped_name(&self) -> &'static str
pub const fn remapped_name(&self) -> &'static str
Returns the remapped metric name produced by this rule.
Sourcepub const fn help_text(&self) -> Option<&'static str>
pub const fn help_text(&self) -> Option<&'static str>
Returns the help text associated with this rule, if any.
Sourcepub fn try_match_no_context(&self, context: &Context) -> Option<RemappedMetric>
pub fn try_match_no_context(&self, context: &Context) -> Option<RemappedMetric>
Attempts to match the given context against this rule.
If the rule matches, returns a RemappedMetric containing the new metric name and tags.
Trait Implementations§
Source§impl Clone for RemapperRule
impl Clone for RemapperRule
Source§fn clone(&self) -> RemapperRule
fn clone(&self) -> RemapperRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RemapperRule
impl RefUnwindSafe for RemapperRule
impl Send for RemapperRule
impl Sync for RemapperRule
impl Unpin for RemapperRule
impl UnsafeUnpin for RemapperRule
impl UnwindSafe for RemapperRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Track for T
impl<T> Track for T
§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more