otelwrap

package module
v0.0.0-...-2d738ed Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 7 Imported by: 0

README

otelwrap

Wrapper for the otel package. I found the otel package awkward to use. So I created a thin wrapper to simplify usage.

Design Points

  • Standard span names using runtime info.
  • File path and line number attribute automatically created.

Documentation

Overview

Package trace is used for tracing.

Background:
This package is a wrapper for the otel package for doing tracing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Export

func Export(ctx context.Context) map[string]string

Export is used to send a trace ID to another process.

func Import

func Import(ctx context.Context, index map[string]string) context.Context

Import is used to receive a trace ID from another process.

Types

type Span

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

Span of a trace.

func SpanFromContext

func SpanFromContext(ctx context.Context) *Span

SpanFromContext returns a span from the context. If there is no span in the context in the no-op span is returned.

func StartClient

func StartClient(ctx context.Context, params ...string) (context.Context, *Span)

StartClient trace when calling another process. Params show in the span name.

func StartConsumer

func StartConsumer(ctx context.Context, params ...string) (context.Context, *Span)

StartConsumer trace when consuming from a pub/sub system. Params show in the span name.

func StartInternal

func StartInternal(ctx context.Context, params ...string) (context.Context, *Span)

StartInternal trace within a process. Params show in the span name.

func StartProducer

func StartProducer(ctx context.Context, params ...string) (context.Context, *Span)

StartProducer trace when sending to a pub/sub system. Params show in the span name.

func StartServer

func StartServer(ctx context.Context, params ...string) (context.Context, *Span)

StartServer trace when another process is calling us. Params show in the span name.

func (*Span) AddEvent

func (s *Span) AddEvent(name string)

AddEvent records an event.

func (*Span) End

func (s *Span) End()

End the span.

func (*Span) RecordError

func (s *Span) RecordError(err error)

RecordError records an error in the span.

Jump to

Keyboard shortcuts

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