11use std:: collections:: HashMap ;
2- #[ cfg( feature = "push-gateway" ) ]
2+ #[ cfg( any ( feature = "push-gateway" , feature = "push-gateway-no-tls-provider" ) ) ]
33use std:: convert:: TryFrom ;
44#[ cfg( feature = "http-listener" ) ]
55use std:: net:: { IpAddr , Ipv4Addr , SocketAddr } ;
66use std:: num:: NonZeroU32 ;
77use std:: sync:: RwLock ;
8- #[ cfg( any( feature = "http-listener" , feature = "push-gateway" ) ) ]
8+ #[ cfg( any(
9+ feature = "http-listener" ,
10+ feature = "push-gateway" ,
11+ feature = "push-gateway-no-tls-provider"
12+ ) ) ]
913use std:: thread;
1014use std:: time:: Duration ;
1115
12- #[ cfg( feature = "push-gateway" ) ]
16+ #[ cfg( any ( feature = "push-gateway" , feature = "push-gateway-no-tls-provider" ) ) ]
1317use hyper:: Uri ;
1418use indexmap:: IndexMap ;
1519#[ cfg( feature = "http-listener" ) ]
@@ -29,13 +33,24 @@ use crate::registry::AtomicStorage;
2933use crate :: { common:: BuildError , PrometheusHandle } ;
3034
3135use super :: ExporterConfig ;
32- #[ cfg( any( feature = "http-listener" , feature = "push-gateway" ) ) ]
36+ #[ cfg( any(
37+ feature = "http-listener" ,
38+ feature = "push-gateway" ,
39+ feature = "push-gateway-no-tls-provider"
40+ ) ) ]
3341use super :: ExporterFuture ;
3442
3543/// Builder for creating and installing a Prometheus recorder/exporter.
3644#[ derive( Debug ) ]
3745pub struct PrometheusBuilder {
38- #[ cfg_attr( not( any( feature = "http-listener" , feature = "push-gateway" ) ) , allow( dead_code) ) ]
46+ #[ cfg_attr(
47+ not( any(
48+ feature = "http-listener" ,
49+ feature = "push-gateway" ,
50+ feature = "push-gateway-no-tls-provider"
51+ ) ) ,
52+ allow( dead_code)
53+ ) ]
3954 exporter_config : ExporterConfig ,
4055 #[ cfg( feature = "http-listener" ) ]
4156 allowed_addresses : Option < Vec < IpNet > > ,
@@ -120,8 +135,11 @@ impl PrometheusBuilder {
120135 /// If the given endpoint cannot be parsed into a valid URI, an error variant will be returned describing the error.
121136 ///
122137 /// [push gateway]: https://prometheus.io/docs/instrumenting/pushing/
123- #[ cfg( feature = "push-gateway" ) ]
124- #[ cfg_attr( docsrs, doc( cfg( feature = "push-gateway" ) ) ) ]
138+ #[ cfg( any( feature = "push-gateway" , feature = "push-gateway-no-tls-provider" ) ) ]
139+ #[ cfg_attr(
140+ docsrs,
141+ doc( cfg( any( feature = "push-gateway" , feature = "push-gateway-no-tls-provider" ) ) )
142+ ) ]
125143 pub fn with_push_gateway < T > (
126144 mut self ,
127145 endpoint : T ,
@@ -399,8 +417,19 @@ impl PrometheusBuilder {
399417 ///
400418 /// If there is an error while either building the recorder and exporter, or installing the recorder and exporter,
401419 /// an error variant will be returned describing the error.
402- #[ cfg( any( feature = "http-listener" , feature = "push-gateway" ) ) ]
403- #[ cfg_attr( docsrs, doc( cfg( any( feature = "http-listener" , feature = "push-gateway" ) ) ) ) ]
420+ #[ cfg( any(
421+ feature = "http-listener" ,
422+ feature = "push-gateway" ,
423+ feature = "push-gateway-no-tls-provider"
424+ ) ) ]
425+ #[ cfg_attr(
426+ docsrs,
427+ doc( cfg( any(
428+ feature = "http-listener" ,
429+ feature = "push-gateway" ,
430+ feature = "push-gateway-no-tls-provider"
431+ ) ) )
432+ ) ]
404433 pub fn install ( self ) -> Result < ( ) , BuildError > {
405434 use tokio:: runtime;
406435
@@ -476,8 +505,19 @@ impl PrometheusBuilder {
476505 /// If there is an error while building the recorder and exporter, an error variant will be returned describing the
477506 /// error.
478507 #[ warn( clippy:: too_many_lines) ]
479- #[ cfg( any( feature = "http-listener" , feature = "push-gateway" ) ) ]
480- #[ cfg_attr( docsrs, doc( cfg( any( feature = "http-listener" , feature = "push-gateway" ) ) ) ) ]
508+ #[ cfg( any(
509+ feature = "http-listener" ,
510+ feature = "push-gateway" ,
511+ feature = "push-gateway-no-tls-provider"
512+ ) ) ]
513+ #[ cfg_attr(
514+ docsrs,
515+ doc( cfg( any(
516+ feature = "http-listener" ,
517+ feature = "push-gateway" ,
518+ feature = "push-gateway-no-tls-provider"
519+ ) ) )
520+ ) ]
481521 #[ cfg_attr( not( feature = "http-listener" ) , allow( unused_mut) ) ]
482522 pub fn build ( mut self ) -> Result < ( PrometheusRecorder , ExporterFuture ) , BuildError > {
483523 #[ cfg( feature = "http-listener" ) ]
@@ -516,7 +556,7 @@ impl PrometheusBuilder {
516556 }
517557 } ,
518558
519- #[ cfg( feature = "push-gateway" ) ]
559+ #[ cfg( any ( feature = "push-gateway" , feature = "push-gateway-no-tls-provider" ) ) ]
520560 ExporterConfig :: PushGateway {
521561 endpoint,
522562 interval,
0 commit comments