sdk

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeList added in v0.6.0

type AttributeList interface {
	GetValue(key string) interface{}

	// Iterate loops through the attributes list and applies the yield function on each attribute.
	// If the yield function returns false, we exit the loop.
	Iterate(yield func(key string, value interface{}) bool)

	Len() int
}

type Code added in v0.5.0

type Code uint32
const (
	// Unset is the default status code.
	StatusCodeUnset Code = 0
	// Error indicates the operation contains an error.
	StatusCodeError Code = 1
	// Ok indicates operation has been validated by an Application developers
	// or Operator to have completed successfully, or contain no error.
	StatusCodeOk Code = 2
)

type HttpOperationMetricsHandler added in v0.12.0

type HttpOperationMetricsHandler interface {
	AddToRequestCount(int64, *http.Request)
}

type Span

type Span interface {
	GetAttributes() AttributeList

	// SetAttribute sets an attribute for the span.
	SetAttribute(key string, value interface{})

	// SetError sets an error for the span.
	SetError(err error)

	// SetStatus sets the status of the Span in the form of a code and a
	// description.
	SetStatus(code Code, description string)

	// IsNoop tells whether the span is noop or not, useful for avoiding
	// expensive recording.
	IsNoop() bool

	// AddEvent adds an event to the Span with the provided name, timestamp and attributes.
	AddEvent(name string, ts time.Time, attributes map[string]interface{})
}

Span is an interface that accepts attributes and can be distinguished as noop

type SpanFromContext

type SpanFromContext func(ctx context.Context) Span

SpanFromContext retrieves the existing span from a context

type SpanKind

type SpanKind string

SpanKind represents the span kind, either Client, Server, Producer, Consumer or undertermine

const (
	SpanKindUndetermined SpanKind = ""
	SpanKindClient       SpanKind = "CLIENT"
	SpanKindServer       SpanKind = "SERVER"
	SpanKindProducer     SpanKind = "PRODUCER"
	SpanKindConsumer     SpanKind = "CONSUMER"
)

type SpanOptions

type SpanOptions struct {
	Kind      SpanKind
	Timestamp time.Time
}

SpanOptions describes the options for starting a span

type StartSpan

type StartSpan func(ctx context.Context, name string, opts *SpanOptions) (context.Context, Span, func())

StartSpan creates a span and injects into a context, returning a span ender function

Jump to

Keyboard shortcuts

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