@@ -119,7 +119,7 @@ def write_to_textfile(path, registry):
119119 os .rename (tmppath , path )
120120
121121
122- def push_to_gateway (gateway , job , registry , grouping_key = None , timeout = None , handler = None , handler_args = None ):
122+ def push_to_gateway (gateway , job , registry , grouping_key = None , timeout = None , handler = None ):
123123 '''Push metrics to the given pushgateway.
124124
125125 `gateway` the url for your push gateway. Either of the form
@@ -155,14 +155,13 @@ def push_to_gateway(gateway, job, registry, grouping_key=None, timeout=None, han
155155 failure.
156156 'content' is the data which should be used to form the HTTP
157157 Message Body.
158- `handler_args` is an optional dict of extra arguments to provide
159158
160159 This overwrites all metrics with the same job and grouping_key.
161160 This uses the PUT HTTP method.'''
162- _use_gateway ('PUT' , gateway , job , registry , grouping_key , timeout , handler , handler_args )
161+ _use_gateway ('PUT' , gateway , job , registry , grouping_key , timeout , handler )
163162
164163
165- def pushadd_to_gateway (gateway , job , registry , grouping_key = None , timeout = None , handler = None , handler_args = None ):
164+ def pushadd_to_gateway (gateway , job , registry , grouping_key = None , timeout = None , handler = None ):
166165 '''PushAdd metrics to the given pushgateway.
167166
168167 `gateway` the url for your push gateway. Either of the form
@@ -183,10 +182,10 @@ def pushadd_to_gateway(gateway, job, registry, grouping_key=None, timeout=None,
183182
184183 This replaces metrics with the same name, job and grouping_key.
185184 This uses the POST HTTP method.'''
186- _use_gateway ('POST' , gateway , job , registry , grouping_key , timeout , handler , handler_args )
185+ _use_gateway ('POST' , gateway , job , registry , grouping_key , timeout , handler )
187186
188187
189- def delete_from_gateway (gateway , job , grouping_key = None , timeout = None , handler = None , handler_args = None ):
188+ def delete_from_gateway (gateway , job , grouping_key = None , timeout = None , handler = None ):
190189 '''Delete metrics from the given pushgateway.
191190
192191 `gateway` the url for your push gateway. Either of the form
@@ -206,10 +205,10 @@ def delete_from_gateway(gateway, job, grouping_key=None, timeout=None, handler=N
206205
207206 This deletes metrics with the given job and grouping_key.
208207 This uses the DELETE HTTP method.'''
209- _use_gateway ('DELETE' , gateway , job , None , grouping_key , timeout , handler , handler_args )
208+ _use_gateway ('DELETE' , gateway , job , None , grouping_key , timeout , handler )
210209
211210
212- def _use_gateway (method , gateway , job , registry , grouping_key , timeout , handler , handler_args ):
211+ def _use_gateway (method , gateway , job , registry , grouping_key , timeout , handler ):
213212 gateway_url = urlparse (gateway )
214213 if not gateway_url .scheme :
215214 gateway = 'http://{0}' .format (gateway )
@@ -227,10 +226,8 @@ def _use_gateway(method, gateway, job, registry, grouping_key, timeout, handler,
227226 headers = [('Content-Type' , CONTENT_TYPE_LATEST )]
228227 if handler is None :
229228 handler = default_handler
230- if handler_args is None :
231- handler_args = dict ()
232229 handler (url = url , method = method , timeout = timeout ,
233- headers = headers , data = data , ** handler_args )
230+ headers = headers , data = data )( )
234231
235232def instance_ip_grouping_key ():
236233 '''Grouping key with instance set to the IP Address of this host.'''
0 commit comments