bug 822759 - more debugging patches to diagnose problem in -dev

* re-enabled the tests for test_metlog_*
* added double logging for each of the generate_error events that
  route through metlog. one through the default metlog instance,
  another through the local metlog client instance
* bumped to metlog-py 0.9.10 to see the full client configuration as a
  JSON blob
* pulled out all METLOG_CONF configuration from settings_base and just
  set it at once.  This has to be done in settings_mkt.py and
  settings_addons.py
This commit is contained in:
Victor Ng 2012-12-28 15:10:57 -05:00
Родитель 7d8a4a14f1
Коммит 90f59fb374
6 изменённых файлов: 58 добавлений и 38 удалений

Просмотреть файл

@ -294,14 +294,6 @@ class GenerateErrorForm(happyforms.Form):
from metlog.config import client_from_dict_config
new_metlog = client_from_dict_config(settings.METLOG_CONF)
# The next two variables are captured by the raven client as local variables
# which are passed into the sentry server.
# They are needed to verify that the active metlog
# configuration is not the actual expected metlog
# configuration.
metlog_conf = settings.METLOG_CONF
active_metlog_conf = settings.METLOG._config
if error == 'zerodivisionerror':
1 / 0
elif error == 'iorequesterror':
@ -319,17 +311,37 @@ class GenerateErrorForm(happyforms.Form):
'cef.product': 'zamboni',
'cef': True}
settings.METLOG.cef('xx\nx|xx\rx', 5, environ, config,
username='me', ext1='ok=ok', ext2='ok\\ok',
logger_info='settings.METLOG')
new_metlog.cef('xx\nx|xx\rx', 5, environ, config,
username='me', ext1='ok=ok', ext2='ok\\ok')
username='me', ext1='ok=ok', ext2='ok\\ok',
logger_info='new_metlog')
elif error == 'metlog_statsd':
new_metlog.incr(name=LOGGER_NAME)
new_metlog.incr(name="new_metlog:" + LOGGER_NAME)
settings.METLOG.incr(name=LOGGER_NAME)
elif error == 'metlog_json':
new_metlog.metlog(type="metlog_json",
fields={'foo': 'bar', 'secret': 42})
fields={'foo': 'bar', 'secret': 42,
'logger_type': 'new_metlog'})
settings.METLOG.metlog(type="metlog_json",
fields={'foo': 'bar', 'secret': 42,
'logger_type': 'settings.METLOG'})
elif error == 'metlog_sentry':
# If this works, we have some kind of import ordering
# problem
# Try to fire off two messages to verify that we don't
# have some kind of transient issue where settings.METLOG
# doesn't work
try:
1 / 0
2 / 0
except:
new_metlog.raven('metlog_sentry error triggered')
new_metlog.raven('new_metlog: metlog_sentry error triggered',
metlog_conf=settings.METLOG_CONF,
active_metlog_conf=settings.METLOG._config,)
finally:
try:
1 / 0
except:
settings.METLOG.raven('metlog_sentry error triggered',
metlog_conf=settings.METLOG_CONF,
active_metlog_conf=settings.METLOG._config,)

Просмотреть файл

@ -4,7 +4,6 @@ import json
from django.conf import settings
from nose.tools import eq_
from nose import SkipTest
from pyquery import PyQuery as pq
import amo
@ -51,7 +50,6 @@ class TestGenerateError(amo.tests.TestCase):
self.metlog.sender.msgs.clear()
def test_metlog_statsd(self):
raise SkipTest("this always passes in test, but not on -dev")
self.url = reverse('zadmin.generate-error')
self.client.post(self.url,
{'error': 'metlog_statsd'})
@ -67,7 +65,6 @@ class TestGenerateError(amo.tests.TestCase):
eq_(msg['fields']['name'], 'z.zadmin')
def test_metlog_json(self):
raise SkipTest("this always passes in test, but not on -dev")
self.url = reverse('zadmin.generate-error')
self.client.post(self.url,
{'error': 'metlog_json'})
@ -81,7 +78,6 @@ class TestGenerateError(amo.tests.TestCase):
eq_(msg['fields']['secret'], 42)
def test_metlog_cef(self):
raise SkipTest("this always passes in test, but not on -dev")
self.url = reverse('zadmin.generate-error')
self.client.post(self.url,
{'error': 'metlog_cef'})
@ -93,7 +89,6 @@ class TestGenerateError(amo.tests.TestCase):
eq_(msg['logger'], 'zamboni')
def test_metlog_sentry(self):
raise SkipTest("this always passes in test, but not on -dev")
self.url = reverse('zadmin.generate-error')
self.client.post(self.url,
{'error': 'metlog_sentry'})

Просмотреть файл

@ -44,7 +44,7 @@ html5lib==0.90
httplib2==0.7.6
importlib==1.0.2
kombu==2.1.2
metlog-py==0.9.9
metlog-py==0.9.10
metlog-cef==0.2
metlog-raven==0.3
mimeparse==0.1.3

Просмотреть файл

@ -80,6 +80,20 @@ AMO_LANGUAGES = AMO_LANGUAGES + ('dbg',)
LANGUAGES = lazy(lazy_langs, dict)(AMO_LANGUAGES)
LANGUAGE_URL_MAP = dict([(i.lower(), i) for i in AMO_LANGUAGES])
METLOG_CONF['logger'] = 'addons-dev'
METLOG_CONF['plugins']['raven'] = ('metlog_raven.raven_plugin:config_plugin', {'dsn': private_addons.SENTRY_DSN})
METLOG_CONF = {
'plugins': {'cef': ('metlog_cef.cef_plugin:config_plugin', {}),
'raven': (
'metlog_raven.raven_plugin:config_plugin', {'dsn': private_addons.SENTRY_DSN}),
},
'sender': {
'class': 'metlog.senders.UdpSender',
'host': splitstrip(private.METLOG_CONF_SENDER_HOST),
'port': private.METLOG_CONF_SENDER_PORT,
},
'logger': 'addons-dev',
}
METLOG = client_from_dict_config(METLOG_CONF)
USE_METLOG_FOR_CEF = True
USE_METLOG_FOR_RAVEN = False

Просмотреть файл

@ -188,16 +188,4 @@ XSENDFILE_HEADER = 'X-Accel-Redirect'
GEOIP_NOOP = 0
METLOG_CONF = {
'plugins': {'cef': ('metlog_cef.cef_plugin:config_plugin', {})},
'sender': {
'class': 'metlog.senders.UdpSender',
'host': splitstrip(private.METLOG_CONF_SENDER_HOST),
'port': private.METLOG_CONF_SENDER_PORT,
},
}
USE_METLOG_FOR_CEF = True
USE_METLOG_FOR_RAVEN = False
ALLOW_SELF_REVIEWS = True

Просмотреть файл

@ -146,10 +146,21 @@ SIGNED_APPS_SERVER = private_mkt.SIGNED_APPS_SERVER
SIGNED_APPS_REVIEWER_SERVER_ACTIVE = True
SIGNED_APPS_REVIEWER_SERVER = private_mkt.SIGNED_APPS_REVIEWER_SERVER
METLOG_CONF['logger'] = 'addons-marketplace-dev'
METLOG_CONF['plugins']['raven'] = (
'metlog_raven.raven_plugin:config_plugin', {'dsn': SENTRY_DSN})
METLOG_CONF = {
'plugins': {'cef': ('metlog_cef.cef_plugin:config_plugin', {}),
'raven': (
'metlog_raven.raven_plugin:config_plugin', {'dsn': SENTRY_DSN}),
},
'sender': {
'class': 'metlog.senders.UdpSender',
'host': splitstrip(private.METLOG_CONF_SENDER_HOST),
'port': private.METLOG_CONF_SENDER_PORT,
},
'logger': 'addons-marketplace-dev',
}
METLOG = client_from_dict_config(METLOG_CONF)
USE_METLOG_FOR_CEF = True
USE_METLOG_FOR_RAVEN = False
WEBTRENDS_USERNAME = private_mkt.WEBTRENDS_USERNAME
WEBTRENDS_PASSWORD = private_mkt.WEBTRENDS_PASSWORD