Documentation ¶
Overview ¶
Package opencensus contains support code for writing adapters that use OpenCensus.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractParentContext ¶
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 ¶
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.
Types ¶
type Handler ¶
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 ¶
func NewTraceHandler(newExporter NewExporterFunc, sampler trace.Sampler) *Handler
NewTraceHandler returns a new tracespan adapter that sends spans to the provided exporter.
type NewExporterFunc ¶
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.