Beispiel #1
0
def bind(endpoint=None):
    log.info("Binding zipkin to xmlrpclib")
    if not endpoint:
        endpoint = Endpoint("xmlrpc")

    xmlrpclib.Transport = MonkeyTransport

    log.info("zipkin bound to xmlrpclib")
Beispiel #2
0
def bind(app, endpoint=None):
    if not endpoint:
        endpoint = Endpoint(app.name)

    events.endpoint = endpoint

    log.info('Attaching zipkin to Flask signals')
    request_started.connect(events.pre_request, app)
    request_finished.connect(events.pre_response, app)
    log.info('zipkin signals attached')
Beispiel #3
0
def bind(endpoint=None):
    if not endpoint:
        endpoint = Endpoint("Celery")

    events.endpoint = endpoint

    log.info("Attaching zipkin to celery signals")
    before_task_publish.connect(events.task_send_handler)
    task_prerun.connect(events.task_prerun_handler)
    task_postrun.connect(events.task_postrun_handler)
    log.info("zipkin signals attached")
Beispiel #4
0
def bind(engine, endpoint=None):

    log.info("Binding zipkin to SQLALchemy")
    if not endpoint:
        endpoint = Endpoint("SQL")

    events.endpoints[engine] = endpoint
    event.listen(engine, "before_cursor_execute", events.before_cursor_execute)
    event.listen(engine, "after_cursor_execute", events.after_cursor_execute)
    # event.listen(engine, 'dbapi_error', events.dbapi_error)
    log.info("zipkin bound to SQLALchemy")
Beispiel #5
0
def init_trace(request):
    headers = request.headers
    trace_name = request.method + " " + request.path_info
    trace = Trace(
        trace_name,
        int_or_none(headers.get("X-B3-TraceId", None)),
        int_or_none(headers.get("X-B3-SpanId", None)),
        int_or_none(headers.get("X-B3-ParentSpanId", None)),
        endpoint=Endpoint(ZipkinConfig.service_name),
    )
    trace.record(Annotation.string("http.path", request.path_info))
    trace.record(Annotation.string("span.kind", "client"))
    trace.record(Annotation.server_recv())
    stack_trace(trace)
    return trace