telemetry

package
v0.0.0-...-ef901e4 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageLifecycle

type MessageLifecycle int

MessageLifecycle of the domain.Message (in tracing aspect).

const (
	// Send means sending message
	Send MessageLifecycle = iota
	// Fetch means client fetching
	Fetch
	// Acknowledge means client received span
	Acknowledge
)

type Telemetry

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

Telemetry represents tracing/metrics system

func InitTelemetry

func InitTelemetry(config *config.TelemetryConfig) (telemetry *Telemetry, err error)

InitTelemetry initialize telemetry facility

func NewEmptyTelemetry

func NewEmptyTelemetry(t *testing.T) *Telemetry

NewEmptyTelemetry creates no-op telemetry system

func (*Telemetry) RecordError

func (t *Telemetry) RecordError(ctx context.Context, err error)

RecordError add error event to current span.

func (*Telemetry) SetHTTPResponseAttributes

func (t *Telemetry) SetHTTPResponseAttributes(ctx context.Context, status int, contentLength int64)

SetHTTPResponseAttributes adds attributes of HTTP response

func (*Telemetry) SetHTTPServerAttributes

func (t *Telemetry) SetHTTPServerAttributes(ctx context.Context, r *http.Request, routePath string, clientIP string)

SetHTTPServerAttributes adds attributes for incoming HTTP request

func (*Telemetry) SetJTI

func (t *Telemetry) SetJTI(ctx context.Context, jti domain.JwtJti)

SetJTI adds attribute of JWT

func (*Telemetry) SetSubscriberAttributes

func (t *Telemetry) SetSubscriberAttributes(ctx context.Context, sl domain.SubscriberLocator)

SetSubscriberAttributes adds attributes of subscriber

func (*Telemetry) Shutdown

func (t *Telemetry) Shutdown(ctx context.Context)

Shutdown closes telemetry facility

func (*Telemetry) StartDaemonSpan

func (t *Telemetry) StartDaemonSpan(ctx context.Context, systemName, daemonName string) (context.Context, context.CancelFunc)

StartDaemonSpan starts background task span

func (*Telemetry) StartHTTPSpan

func (t *Telemetry) StartHTTPSpan(ctx context.Context, isServer bool, r *http.Request) (context.Context, context.CancelFunc)

StartHTTPSpan starts tracing span for incoming or outgoing HTTP call

func (*Telemetry) StartMessageSpan

func (t *Telemetry) StartMessageSpan(ctx context.Context, lifecycle MessageLifecycle, msg domain.Message) (context.Context, context.CancelFunc)

StartMessageSpan starts DSPS message processing span

func (*Telemetry) StartStorageSpan

func (t *Telemetry) StartStorageSpan(ctx context.Context, id domain.StorageID, operation string) (context.Context, context.CancelFunc)

StartStorageSpan starts storage operation span

type TraceResult

type TraceResult struct {
	OT *ottesting.StubExporter
}

TraceResult contains stub tracing result.

func WithStubTracing

func WithStubTracing(t *testing.T, f func(*Telemetry)) *TraceResult

WithStubTracing is testing utility to create stub Telemetry facility and returns captured spans.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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