istio: Index | Files

package opencensus

import ""

Package opencensus contains support code for writing adapters that use OpenCensus.


Package Files

trace.go traceutil.go

func ExtractParentContext Uses

func ExtractParentContext(traceID, parentSpanID string) (trace.SpanContext, bool)

ExtractParentContext returns an OpenCensus SpanContext that corresponds to the parent of the given trace and parent span id that are in the hex encoded string that comes from tracespan instances. The second return value will be false if the trace id is invalid.

func ExtractSpanContext Uses

func ExtractSpanContext(spanID string, parent trace.SpanContext) (trace.SpanContext, bool)

ExtractSpanContext returns an OpenCensus SpanContext that corresponds to the the given span id and parent span context. The second return value will be false if the span id is invalid.

type Handler Uses

type Handler struct {

    // NewExporter creates OpenCensus exporters where generated spans will be exported.
    NewExporter NewExporterFunc
    // Sampler to be applied to each span.
    Sampler trace.Sampler
    // CloseFunc will be called when this handler is closed. Optional.
    CloseFunc func() error
    // contains filtered or unexported fields

Handler implements tracespan.Handler using an OpenCensus TraceExporter.

func NewTraceHandler Uses

func NewTraceHandler(newExporter NewExporterFunc, sampler trace.Sampler) *Handler

NewTraceHandler returns a new tracespan adapter that sends spans to the provided exporter.

func (*Handler) Close Uses

func (h *Handler) Close() error

Close calls the CloseFunc (if any) that was provided when this Handler was created.

func (*Handler) HandleTraceSpan Uses

func (h *Handler) HandleTraceSpan(_ context.Context, values []*tracespan.Instance) (retErr error)

HandleTraceSpan transforms tracespan template instances into OpenCensus spans and sends them to the configured OpenCensus exporter.

type NewExporterFunc Uses

type NewExporterFunc func(name string, endpoint string) trace.Exporter

NewExporterFunc is a callback to create new OpenCensus exporters for a given workload name and endpoint.

The format of endpoint will be IP_ADDRESS:PORT. name and endpoint refer to the logical owning workload of this span. For server spans, the values are the destinationName and destinationIp, for clients the sourceName and sourceIp.

Package opencensus imports 7 packages (graph) and is imported by 4 packages. Updated 2020-07-03. Refresh now. Tools for package owners.