Пример #1
0
def main(global_config, **settings):
    config = get_configurator(global_config, **settings)
    # Ensure we have metlog loaded as early as possible.
    load_metlog_client(config)
    config.begin()
    try:
        config.include(includeme)
    finally:
        config.end()
    return config.make_wsgi_app()
Пример #2
0
def main(global_config, **settings):
    config = get_configurator(global_config, **settings)
    # Ensure that we have metlog loaded and ready for use as early as possible.
    load_metlog_client(config)
    config.begin()
    try:
        config.include(includeme)
    finally:
        config.end()
    return config.make_wsgi_app()
Пример #3
0
def includeme(config):
    # Ensure that we have metlog loaded and ready for use as early as possible.
    load_metlog_client(config)
    # Include dependencies from other packages.
    config.include("cornice")
    config.include("mozsvc")
    config.include("mozsvc.user")
    # Add in the stuff we define ourselves.
    config.include("syncstorage.tweens")
    config.include("syncstorage.storage")
    config.include("syncstorage.views")
Пример #4
0
def includeme(config):
    # Ensure we have metlog loaded as early as possible.
    load_metlog_client(config)
    # Add exception logging.
    # Putting it first prevents other things from converting errors
    # into HTTP responses before we get to see them.
    config.include("aitc.tweens")
    # Include the basic mozsvc project dependencies.
    config.include("cornice")
    config.include("mozsvc")
    config.include("mozsvc.user")
    # Re-use some framework stuff from syncstorage.
    config.include("syncstorage.tweens")
    config.include("syncstorage.storage")
    # Add in the stuff we define ourselves.
    config.scan("aitc.views")
    # Create the "controller" object for handling requests.
    config.registry["aitc.controller"] = AITCController(config)
Пример #5
0
    def get_configurator(self):
        config = super(StorageTestCase, self).get_configurator()
        self.metlog = load_metlog_client(config)

        # override MetlogDecorator's `client` property
        self.orig_client = MetlogDecorator.client
        MetlogDecorator.client = self.metlog

        config.registry['metlog'] = self.metlog
        config.include("syncstorage")
        return config
Пример #6
0
    def get_configurator(self):
        config = super(StorageTestCase, self).get_configurator()
        self.metlog = load_metlog_client(config)

        # override MetlogDecorator's `client` property
        self.orig_client = MetlogDecorator.client
        MetlogDecorator.client = self.metlog

        config.registry['metlog'] = self.metlog
        config.include("syncstorage")
        return config
Пример #7
0
 def test_loading_from_configurator_with_explicit_sender(self):
     config = get_configurator({}, **{
         "metlog.backend": "mozsvc.metrics.MetlogPlugin",
         "metlog.sender_class": "metlog.senders.UdpSender",
         "metlog.sender_host": "localhost",
         "metlog.sender_port": 23456,
     })
     client = load_metlog_client(config)
     self.failUnless(isinstance(client.sender, UdpSender))
     destination = client.sender._destinations[0]
     self.assertEquals(destination, ("localhost", 23456))
Пример #8
0
 def test_loading_from_configurator_with_default_sender(self):
     config = get_configurator({})
     client = load_metlog_client(config)
     self.failUnless(isinstance(client.sender, StdLibLoggingSender))