Ejemplo n.º 1
0
def make_jaeger_span(span):
    jaeger_span = ttypes.Span(
        traceIdLow=id_to_int(_id_to_low(span.trace_id)),
        traceIdHigh=id_to_int(_id_to_high(span.trace_id)),
        spanId=id_to_int(span.span_id),
        parentSpanId=id_to_int(span.parent_id) or 0,
        operationName=span.operation_name,
        # references = references, # TODO
        flags=span.context.flags,
        startTime=timestamp_micros(span.start_time),
        duration=timestamp_micros(span.end_time - span.start_time),
        tags=span.tags,  # TODO
        logs=span.logs,  # TODO
    )
    return jaeger_span
Ejemplo n.º 2
0
def make_jaeger_batch(spans, process):
    batch = ttypes.Batch(
        spans=[],
        process=process,
    )
    for span in spans:
        with span.update_lock:
            jaeger_span = ttypes.Span(
                traceIdLow=id_to_int(_id_to_low(span.trace_id)),
                traceIdHigh=id_to_int(_id_to_high(span.trace_id)),
                spanId=id_to_int(span.span_id),
                parentSpanId=id_to_int(span.parent_id) or 0,
                operationName=span.operation_name,
                references=make_references(span.references),
                flags=span.context.flags,
                startTime=timestamp_micros(span.start_time),
                duration=timestamp_micros(span.end_time - span.start_time),
                tags=span.tags,  # TODO
                logs=span.logs,  # TODO
            )
        batch.spans.append(jaeger_span)
    return batch