utils

package
v1.0.1-0...-f351835 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNewTagKey

func AddNewTagKey(views []*view.View, key *tag.Key) []*view.View

AddNewTagKey adds new tag keys to existing view

func AddTagKeyToCtx

func AddTagKeyToCtx(ctx context.Context, key tag.Key, value string) context.Context

AddTagKeyToCtx assigns opencensus tag key value to context

func GetTraceSamplingRate

func GetTraceSamplingRate(rate string) float64

GetTraceSamplingRate parses the given rate and returns the parsed rate

func IsTracingEnabled

func IsTracingEnabled(rate string) bool

IsTracingEnabled parses the given rate and returns false if sampling rate is explicitly set 0

func NewMeasureView

func NewMeasureView(measure stats.Measure, keys []tag.Key, aggregation *view.Aggregation) *view.View

NewMeasureView creates opencensus View instance using stats.Measure

func SpanFromContext

func SpanFromContext(ctx context.Context) *trace.Span

SpanFromContext returns the SpanContext stored in a context, or nil if there isn't one.

func SpanToFastHTTPContext

func SpanToFastHTTPContext(ctx *fasthttp.RequestCtx, span *trace.Span)

SpanToFastHTTPContext sets span into fasthttp.RequestCtx.

func TraceSampler

func TraceSampler(samplingRate string) trace.StartOption

TraceSampler returns Probability Sampler option.

func WithTags

func WithTags(opts ...interface{}) []tag.Mutator

WithTags converts tag key and value pairs to tag.Mutator array. WithTags(key1, value1, key2, value2) returns []tag.Mutator{tag.Upsert(key1, value1), tag.Upsert(key2, value2)}

Types

type StdoutExporter

type StdoutExporter struct{}

StdoutExporter is an open census exporter that writes to stdout.

func (*StdoutExporter) ExportSpan

func (e *StdoutExporter) ExportSpan(sd *trace.SpanData)

ExportSpan implements the open census exporter interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL