3030
3131PYTHON26_OR_OLDER = sys .version_info < (2 , 7 )
3232
33+
3334def make_wsgi_app (registry = core .REGISTRY ):
3435 '''Create a WSGI app which serves the metrics from a registry.'''
3536 def prometheus_app (environ , start_response ):
@@ -179,7 +180,9 @@ def handle():
179180 return handle
180181
181182
182- def push_to_gateway (gateway , job , registry , grouping_key = None , timeout = None , handler = default_handler ):
183+ def push_to_gateway (
184+ gateway , job , registry , grouping_key = None , timeout = 30 ,
185+ handler = default_handler ):
183186 '''Push metrics to the given pushgateway.
184187
185188 `gateway` the url for your push gateway. Either of the form
@@ -190,7 +193,7 @@ def push_to_gateway(gateway, job, registry, grouping_key=None, timeout=None, han
190193 `grouping_key` please see the pushgateway documentation for details.
191194 Defaults to None
192195 `timeout` is how long push will attempt to connect before giving up.
193- Defaults to None
196+ Defaults to 30s, can be set to None for no timeout.
194197 `handler` is an optional function which can be provided to perform
195198 requests to the 'gateway'.
196199 Defaults to None, in which case an http or https request
@@ -221,7 +224,9 @@ def push_to_gateway(gateway, job, registry, grouping_key=None, timeout=None, han
221224 _use_gateway ('PUT' , gateway , job , registry , grouping_key , timeout , handler )
222225
223226
224- def pushadd_to_gateway (gateway , job , registry , grouping_key = None , timeout = None , handler = default_handler ):
227+ def pushadd_to_gateway (
228+ gateway , job , registry , grouping_key = None , timeout = 30 ,
229+ handler = default_handler ):
225230 '''PushAdd metrics to the given pushgateway.
226231
227232 `gateway` the url for your push gateway. Either of the form
@@ -232,7 +237,7 @@ def pushadd_to_gateway(gateway, job, registry, grouping_key=None, timeout=None,
232237 `grouping_key` please see the pushgateway documentation for details.
233238 Defaults to None
234239 `timeout` is how long push will attempt to connect before giving up.
235- Defaults to None
240+ Defaults to 30s, can be set to None for no timeout.
236241 `handler` is an optional function which can be provided to perform
237242 requests to the 'gateway'.
238243 Defaults to None, in which case an http or https request
@@ -245,7 +250,8 @@ def pushadd_to_gateway(gateway, job, registry, grouping_key=None, timeout=None,
245250 _use_gateway ('POST' , gateway , job , registry , grouping_key , timeout , handler )
246251
247252
248- def delete_from_gateway (gateway , job , grouping_key = None , timeout = None , handler = default_handler ):
253+ def delete_from_gateway (
254+ gateway , job , grouping_key = None , timeout = 30 , handler = default_handler ):
249255 '''Delete metrics from the given pushgateway.
250256
251257 `gateway` the url for your push gateway. Either of the form
@@ -255,7 +261,7 @@ def delete_from_gateway(gateway, job, grouping_key=None, timeout=None, handler=d
255261 `grouping_key` please see the pushgateway documentation for details.
256262 Defaults to None
257263 `timeout` is how long delete will attempt to connect before giving up.
258- Defaults to None
264+ Defaults to 30s, can be set to None for no timeout.
259265 `handler` is an optional function which can be provided to perform
260266 requests to the 'gateway'.
261267 Defaults to None, in which case an http or https request
0 commit comments