Exporter - Zipkin Exporter

Export the spans data to Zipkin Collector.

class opencensus.ext.zipkin.trace_exporter.ZipkinExporter(service_name='my_service', host_name='localhost', port=9411, endpoint='/api/v2/spans', protocol='http', transport=<class 'opencensus.common.transports.sync.SyncTransport'>, ipv4=None, ipv6=None)[source]

Bases: opencensus.trace.base_exporter.Exporter

Export the spans to Zipkin.

See: http://zipkin.io/zipkin-api/#

Parameters
  • service_name (str) -- Service that logged an annotation in a trace. Classifier when query for spans.

  • host_name (str) -- (Optional) The host name of the Zipkin server.

  • port (int) -- (Optional) The port of the Zipkin server.

  • end_point (str) -- (Optional) The path for the span exporting endpoint.

  • protocol (str) -- (Optional) The protocol used for the request.

  • transport (type) -- Class for creating new transport objects. It should extend from the base_exporter Transport type and implement Transport.export(). Defaults to SyncTransport. The other option is AsyncTransport.

emit(span_datas)[source]

Send SpanData tuples to Zipkin server, default using the v2 API.

Parameters

of opencensus.trace.span_data.SpanData span_datas (list) -- SpanData tuples to emit

export(span_datas)[source]

Export the trace. Send trace to transport, and transport will call exporter.emit() to actually send the trace to the specified tracing backend.

Parameters

of opencensus.trace.span_data.SpanData span_datas (list) -- SpanData tuples to export

translate_to_zipkin(span_datas)[source]

Translate the opencensus spans to zipkin spans.

Parameters

span_datas (list of :class: ~opencensus.trace.span_data.SpanData) -- SpanData tuples to emit

Return type

list

Returns

List of zipkin format spans.