Пример #1
0
    def init_tracer(self, service):
        logging.getLogger('').handlers = []
        logging.basicConfig(format='%(message)s', level=logging.DEBUG)

        config = Config(
            config={
                'sampler': {
                    'type': 'const',
                    'param': 1,
                },
                'logging': True,
            },
            service_name=service,
        )
        return config.initialize_tracer()
Пример #2
0
    'category': fields.String(required=True, description='Category Name'),
})

upload_parser = api.parser()
upload_parser.add_argument('file', location='files',
                           type=FileStorage, required=True)

# Create configuration object with enabled logging and sampling of all requests.
config = Config(config={'sampler': {'type': 'const', 'param': 1},
                        'logging': True,
                        'local_agent':
                        # Also, provide a hostname of Jaeger instance to send traces to.
                            {'reporting_host': app.config['JAEGER_HOST']}},
                # Service name can be arbitrary string describing this particular web service.
                service_name=app.config['APP_NAME'])
jaeger_tracer = config.initialize_tracer()
tracing = FlaskTracing(tracer=jaeger_tracer, app=app)


createPermissions = lambda f: admin_required(f, roles=['ROLE_ADMIN', 'ROLE_PRODUCTS_CREATE', 'SCOPE_openid'])


ALLOWED_EXTENSIONS = app.config['ALLOWED_EXTENSIONS']


def allowed_file(filename):
    return '.' in filename and \
           filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS


@traced(log)