30
30
31
31
PYTHON26_OR_OLDER = sys .version_info < (2 , 7 )
32
32
33
+
33
34
def make_wsgi_app (registry = core .REGISTRY ):
34
35
'''Create a WSGI app which serves the metrics from a registry.'''
35
36
def prometheus_app (environ , start_response ):
@@ -179,7 +180,9 @@ def handle():
179
180
return handle
180
181
181
182
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 ):
183
186
'''Push metrics to the given pushgateway.
184
187
185
188
`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
190
193
`grouping_key` please see the pushgateway documentation for details.
191
194
Defaults to None
192
195
`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.
194
197
`handler` is an optional function which can be provided to perform
195
198
requests to the 'gateway'.
196
199
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
221
224
_use_gateway ('PUT' , gateway , job , registry , grouping_key , timeout , handler )
222
225
223
226
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 ):
225
230
'''PushAdd metrics to the given pushgateway.
226
231
227
232
`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,
232
237
`grouping_key` please see the pushgateway documentation for details.
233
238
Defaults to None
234
239
`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.
236
241
`handler` is an optional function which can be provided to perform
237
242
requests to the 'gateway'.
238
243
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,
245
250
_use_gateway ('POST' , gateway , job , registry , grouping_key , timeout , handler )
246
251
247
252
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 ):
249
255
'''Delete metrics from the given pushgateway.
250
256
251
257
`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
255
261
`grouping_key` please see the pushgateway documentation for details.
256
262
Defaults to None
257
263
`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.
259
265
`handler` is an optional function which can be provided to perform
260
266
requests to the 'gateway'.
261
267
Defaults to None, in which case an http or https request
0 commit comments