Пример #1
0
 def test_constant_tags(self):
     metrics.init('service',
                  env.Environment.LOCAL,
                  constant_tags={
                      'env': 'BAD',
                      'another': 'GOOD',
                  })
     self.assertEqual(set(metrics._constant_tags),
                      {'env:local', 'another:GOOD'})
Пример #2
0
    "version": 1,
    "disable_existing_loggers": False,
    "formatters": {
        "verbose": {
            "format": (
                "%(levelname)-8s %(asctime)s %(name)s "
                "%(filename)s:%(lineno)s %(message)s"
            )
        }
    },
    "handlers": {
        "console": {
            "level": "INFO",
            "class": "logging.StreamHandler",
            "formatter": "verbose",
        }
    },
    "loggers": {
        "django.db.backends": {
            "handlers": ["console"],
            "level": LOGGING_LEVEL,
            "propagate": False,
        },
        "botocore": {"handlers": ["console"], "level": "ERROR", "propagate": False},
        "boto3": {"handlers": ["console"], "level": "ERROR", "propagate": False},
        "": {"handlers": ["console"], "level": LOGGING_LEVEL},
    },
}

metrics.init("ranch", env.Environment.LOCAL, {})
Пример #3
0
 def setUpClass(cls):
     metrics.init('service', env.Environment.LOCAL)
Пример #4
0
 def test_init(self):
     metrics.init('service', env.Environment.LOCAL)
     self.assertTrue(metrics._initialized)
Пример #5
0
from mbq import env, metrics

SECRET_KEY = "fake-key"
DEBUG = True
RANCH = {"env": "Test", "service": "test-service"}
DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": ":memory:"
    }
}
INSTALLED_APPS = ["mbq.ranch"]
USE_TZ = True
metrics.init("ranch-test", env.Environment.LOCAL)
Пример #6
0
import boto3
import dj_database_url

from mbq import env, metrics

SECRET_KEY = 'fake-key'
DEBUG = True
ATOMIQ = {
    'env': 'Test',
    'service': 'test-service',
}

database_url = os.environ.get('DATABASE_URL',
                              'mysql://root:@mysql:3306/atomiqdb')
DATABASES = {
    'default': dj_database_url.parse(database_url),
}

INSTALLED_APPS = [
    'mbq.atomiq',
]

USE_TZ = True

boto3.setup_default_session(region_name='us-east-1', )

ENV = env.get_environment("ENV_NAME")

metrics.init('mbq.atomiq', env=ENV, constant_tags={"env": ENV.long_name})