pub struct PrometheusConfig { /* private fields */ }observability and prometheus only.Expand description
Where and how metrics are exposed.
Implementations§
Source§impl PrometheusConfig
impl PrometheusConfig
Sourcepub fn new() -> PrometheusConfig
pub fn new() -> PrometheusConfig
/metrics on the application listener.
Sourcepub fn path(self, path: impl Into<String>) -> PrometheusConfig
pub fn path(self, path: impl Into<String>) -> PrometheusConfig
Sourcepub fn listen(self, address: SocketAddr) -> PrometheusConfig
pub fn listen(self, address: SocketAddr) -> PrometheusConfig
Serves metrics on a separate listener instead of the application’s. Recommended in production: the port can be firewalled to the Prometheus servers, and scrapes never share a connection limit or middleware with user traffic.
Sourcepub fn scope_labels(self, enabled: bool) -> PrometheusConfig
pub fn scope_labels(self, enabled: bool) -> PrometheusConfig
Adds otel_scope_name/otel_scope_version labels to every series.
Off by default: they add a label to every series without helping
most dashboards.
Sourcepub fn target_info(self, enabled: bool) -> PrometheusConfig
pub fn target_info(self, enabled: bool) -> PrometheusConfig
Emits the target_info series carrying resource attributes. Default
on; join it in PromQL to filter by service or environment.
Sourcepub fn resource_labels<I, K>(self, keys: I) -> PrometheusConfig
pub fn resource_labels<I, K>(self, keys: I) -> PrometheusConfig
Resource attributes copied onto every series as labels (dots become
underscores). Default: service.name, so dashboards can filter by
service_name both here and behind an OpenTelemetry Collector with
resource_to_telemetry_conversion. Each entry is one constant label
per process and does not increase cardinality.
Sourcepub fn namespace(self, namespace: impl Into<String>) -> PrometheusConfig
pub fn namespace(self, namespace: impl Into<String>) -> PrometheusConfig
Prefixes every metric name with namespace_.
Sourcepub fn scrape_path(&self) -> &str
pub fn scrape_path(&self) -> &str
The configured scrape path.
Sourcepub fn listen_address(&self) -> Option<SocketAddr>
pub fn listen_address(&self) -> Option<SocketAddr>
The separate listener address, if any.
Trait Implementations§
Source§impl Clone for PrometheusConfig
impl Clone for PrometheusConfig
Source§fn clone(&self) -> PrometheusConfig
fn clone(&self) -> PrometheusConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PrometheusConfig
impl Debug for PrometheusConfig
Source§impl Default for PrometheusConfig
impl Default for PrometheusConfig
Source§fn default() -> PrometheusConfig
fn default() -> PrometheusConfig
Auto Trait Implementations§
impl Forget for PrometheusConfig
impl Freeze for PrometheusConfig
impl RefUnwindSafe for PrometheusConfig
impl Send for PrometheusConfig
impl Sync for PrometheusConfig
impl Unpin for PrometheusConfig
impl UnsafeUnpin for PrometheusConfig
impl UnwindSafe for PrometheusConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
compression-br or compression-deflate or compression-gzip or compression-zstd only.Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
trace only.Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
trace only.Source§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
request-id only.Source§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
request-id only.x-request-id as the header name. Read moreSource§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
request-id only.Source§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
request-id only.x-request-id as the header name. Read more