A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://opentelemetry-python.readthedocs.io/en/latest/exporter/zipkin/zipkin.html below:

Website Navigation


OpenTelemetry Zipkin Exporters — OpenTelemetry Python documentation

OpenTelemetry Zipkin Exporters OpenTelemetry Zipkin JSON Exporter

This library allows to export tracing data to Zipkin.

Usage

The OpenTelemetry Zipkin JSON Exporter allows exporting of OpenTelemetry traces to Zipkin. This exporter sends traces to the configured Zipkin collector endpoint using JSON over HTTP and supports multiple versions (v1, v2).

import requests

from opentelemetry import trace
from opentelemetry.exporter.zipkin.json import ZipkinExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

trace.set_tracer_provider(TracerProvider())
tracer = trace.get_tracer(__name__)

# create a ZipkinExporter
zipkin_exporter = ZipkinExporter(
    # version=Protocol.V2
    # optional:
    # endpoint="http://localhost:9411/api/v2/spans",
    # local_node_ipv4="192.168.0.1",
    # local_node_ipv6="2001:db8::c001",
    # local_node_port=31313,
    # max_tag_value_length=256,
    # timeout=5 (in seconds),
    # session=requests.Session(),
)

# Create a BatchSpanProcessor and add the exporter to it
span_processor = BatchSpanProcessor(zipkin_exporter)

# add to the tracer
trace.get_tracer_provider().add_span_processor(span_processor)

with tracer.start_as_current_span("foo"):
    print("Hello world!")

The exporter supports the following environment variable for configuration:

API
class opentelemetry.exporter.zipkin.json.ZipkinExporter(version=Protocol.V2, endpoint=None, local_node_ipv4=None, local_node_ipv6=None, local_node_port=None, max_tag_value_length=None, timeout=None, session=None)[source]

Bases: SpanExporter

export(spans)[source]

Exports a batch of telemetry data.

Parameters:

spans (Sequence[Span]) – The list of opentelemetry.trace.Span objects to be exported

Return type:

SpanExportResult

Returns:

The result of the export

shutdown()[source]

Shuts down the exporter.

Called when the SDK is shut down.

Return type:

None

force_flush(timeout_millis=30000)[source]

Hint to ensure that the export of any spans the exporter has received prior to the call to ForceFlush SHOULD be completed as soon as possible, preferably before returning from this method.

Return type:

bool


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4