Commit 3849e286 authored by Craig Weber's avatar Craig Weber

Refs #14129 Remove StatsD metrics

parent 2326637c
......@@ -18,7 +18,6 @@ What's instrumented-soap?
This package is a thin wrapper around the `suds-jurko <https://bitbucket.org/jurko/suds>`_ library that adds several useful features.
- Instrumentation and stat tracking using `django_statsd <https://pypi.python.org/pypi/django-statsd-mozilla>`_.
- Improved HTTP proxy support for SOAP Transports.
- Useful SOAP API mocking and unit-testing tools.
......
......@@ -3,7 +3,6 @@ Babel==2.6.0
certifi==2018.4.16
chardet==3.0.4
Django==2.0.5
django-statsd-mozilla==0.4.0
docutils==0.14
flake8==3.5.0
idna==2.6
......@@ -31,7 +30,6 @@ sphinxcontrib-htmlhelp==1.0.2
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.2
sphinxcontrib-serializinghtml==1.1.3
statsd==3.2.2
suds-jurko==0.6
tox==3.0.0
urllib3==1.22
......
......@@ -12,7 +12,6 @@ packages = find_packages('src')
install_requires = [
'Django>=1.11',
'django-statsd-mozilla>=0.3.16',
'suds-jurko>=0.6',
'requests>=2.9.1',
]
......@@ -39,7 +38,7 @@ cache_git_tag()
setup(
name='instrumented-soap',
description="Wrapper around suds-jurko that adds django_statsd instrumentation and improved proxy support.",
description="Wrapper around suds-jurko that adds improved proxy support and testing tools.",
version=get_version(pypi=True),
long_description=open('README.rst').read(),
classifiers=[
......
from django_statsd.clients import statsd
from suds.client import Client
from suds.plugin import MessagePlugin
from suds.cache import FileCache
......@@ -69,7 +68,6 @@ def get_client(wsdl, log_prefix, plugins=[], **kwargs):
try:
clients[wsdl] = Client(wsdl, plugins=plugins, transport=get_transport(), **kwargs)
except Exception as e:
statsd.incr('soap.wsdl-creation-error')
logger.fatal('Failed to create SOAP client with WSDL at %s' % wsdl)
raise e
return clients[wsdl]
from django_statsd.clients import statsd
from suds.transport import Transport, Reply
from . import settings
import urllib.request
......@@ -37,16 +36,14 @@ class HttpTransport(Transport):
"""
url = request.url
logger.debug('Opening WSDL: %s ' % url)
statsd.incr('soap.open')
with statsd.timer('soap.open'):
if url.startswith('file://'):
content = urllib.request.urlopen(url)
else:
resp = requests.get(url,
proxies=self.proxies(url),
timeout=self.open_timeout)
resp.raise_for_status()
content = io.BytesIO(resp.content)
if url.startswith('file://'):
content = urllib.request.urlopen(url)
else:
resp = requests.get(url,
proxies=self.proxies(url),
timeout=self.open_timeout)
resp.raise_for_status()
content = io.BytesIO(resp.content)
return content
......@@ -62,13 +59,11 @@ class HttpTransport(Transport):
msg = request.message
headers = request.headers
logger.debug('Sending SOAP request: %s' % url)
statsd.incr('soap.send')
with statsd.timer('soap.send'):
resp = requests.post(url,
proxies=self.proxies(url),
timeout=self.send_timeout,
data=msg,
headers=headers)
resp = requests.post(url,
proxies=self.proxies(url),
timeout=self.send_timeout,
data=msg,
headers=headers)
resp.raise_for_status()
reply = Reply(requests.codes.OK, resp.headers, resp.content)
return reply
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment