utils

package
v0.0.0-...-949823d Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StaticPaths = map[string]bool{
	"/dapr/config":    true,
	"/dapr/metrics":   true,
	"/dapr/subscribe": true,
	"/healthz":        true,
}
View Source
var ValidHTTPVerbs = map[string]bool{
	"GET":     true,
	"PUT":     true,
	"POST":    true,
	"PATCH":   true,
	"DELETE":  true,
	"HEAD":    true,
	"OPTIONS": true,
	"CONNECT": true,
	"TRACE":   true,
}

Functions

func AddNewTagKey

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

AddNewTagKey adds new tag keys to existing view.

func AddSpanToFasthttpContext

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

AddSpanToFasthttpContext adds the span to the fasthttp request context. TODO: Remove fasthttp compatibility when no HTTP API using contexts depend on fasthttp.

func AddSpanToRequest

func AddSpanToRequest(r *http.Request, span trace.Span)

AddSpanToRequest sets span into a request context.

func BinaryFromSpanContext

func BinaryFromSpanContext(sc trace.SpanContext) []byte

BinaryFromSpanContext returns the binary format representation of a SpanContext.

If sc is the zero value, Binary returns nil.

func CreateRulesMap

func CreateRulesMap(rules []config.MetricsRule) error

CreateRulesMap generates a fast lookup map for metrics regex.

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 SpanContextFromBinary

func SpanContextFromBinary(b []byte) (sc trace.SpanContext, ok bool)

SpanContextFromBinary returns the SpanContext represented by b.

If b has an unsupported version ID or contains no TraceID, SpanContextFromBinary returns with ok==false.

func SpanFromContext

func SpanFromContext(ctx context.Context) trace.Span

SpanFromContext returns the Span stored in a context, or nil or trace.noopSpan{} if there isn't one.

func WithTags

func WithTags(name string, 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 NullExporter

type NullExporter struct{}

NullExporter implements an open telemetry span exporter that discards all telemetry.

func NewNullExporter

func NewNullExporter() *NullExporter

NewNullExporter returns a NullExporter

func (*NullExporter) ExportSpans

func (e *NullExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error

ExportSpans implements the open telemetry span exporter interface.

func (*NullExporter) Shutdown

func (e *NullExporter) Shutdown(ctx context.Context) error

Shutdown implements the open telemetry span exporter interface.

type StdoutExporter

type StdoutExporter struct {
	// contains filtered or unexported fields
}

StdoutExporter implements an open telemetry span exporter that writes to stdout.

func NewStdOutExporter

func NewStdOutExporter() *StdoutExporter

NewStdOutExporter returns a StdOutExporter

func (*StdoutExporter) ExportSpans

func (e *StdoutExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error

ExportSpans implements the open telemetry span exporter interface.

func (*StdoutExporter) Shutdown

func (e *StdoutExporter) Shutdown(ctx context.Context) error

Shutdown implements the open telemetry span exporter interface.

Jump to

Keyboard shortcuts

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