filter

package module
v0.0.0-...-dfc379f Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exporter

func Exporter(exporter sdktrace.SpanExporter, filters ...Filter) sdktrace.SpanExporter

Exporter wraps the provided exporter and applies the filters to the spans sent to the exporter's ExportSpans function.

func Spans

func Spans(spans []sdktrace.ReadOnlySpan, filters ...Filter) []sdktrace.ReadOnlySpan

Spans takes a list of ReadOnlySpans and applies the filter each span, returning a new list of spans.

Types

type Filter

type Filter func(span sdktrace.ReadOnlySpan) sdktrace.ReadOnlySpan

Filter is a filter function that will be applied to each span via Spans. If the span argument is nil then the Filter must return nil and this span will be removed from the list returned from Spans.

func ContextCancelNormal

func ContextCancelNormal() Filter

ContextCancelNormal will downgrade spans "errors" that were caused by context.Canceled

func ErrorNormal

func ErrorNormal(msg string, attrs ...attribute.KeyValue) Filter

ErrorNormal is for matching an error span and upgrading it to OK where the msg matches the Status.Description and all provides attrs are found on the span.

func HTTPStatusNormal

func HTTPStatusNormal(status int) Filter

HTTPStatusNormal will convert errors spans with provided status code into non-error "normal" spans. For example you might want to allow 404 status codes as valid response and now have those spans show up as errors.

Jump to

Keyboard shortcuts

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