trc

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package trc is used for working with tracing spans. It contains the options to use in Connector.StartSpan

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option trace.SpanStartOption

Option is an alias for trace.SpanStartOption which are options used to create tracing spans.

func Bool

func Bool(k string, v bool) Option

Bool tags the span during its creation.

func Client

func Client() Option

Client indicates that the span represents the operation of client making a request to a server.

func ClientIP

func ClientIP(ip string) Option

ClientIP tags the span during its creation with the IP address and port number of the client.

func Consumer

func Consumer() Option

Consumer represents the operation of a consumer receiving a message from a message broker.

func Float

func Float(k string, v float64) Option

Float tags the span during its creation.

func Int

func Int(k string, v int) Option

Int tags the span during its creation.

func Internal

func Internal() Option

Internal indicates that the span represents an internal operation within an application.

func Producer

func Producer() Option

Producer represents the operation of a producer sending a message to a message broker.

func Request

func Request(r *http.Request) Option

Request tags the span during its creation with the request data.

func Server

func Server() Option

Server indicates that the span represents the operation of handling a request from a client.

func String

func String(k string, v string) Option

String tags the span during its creation.

func Strings

func Strings(k string, v []string) Option

Strings tags the span during its creation.

type Span

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

Span implements the span interface.

func NewSpan

func NewSpan(ts trace.Span) Span

NewSpan creates a new span.

func (Span) Attributes added in v1.3.0

func (s Span) Attributes() map[string]string

Attributes returns the attributes set on the span.

func (Span) End

func (s Span) End()

End completes the span. Updates to the span are not allowed after this method has been called.

func (Span) IsEmpty

func (s Span) IsEmpty() bool

IsEmpty indicates if the span is not initialized.

func (Span) Log

func (s Span) Log(severity string, msg string, args ...any)

Log records a log event on the span.

func (Span) SetBool

func (s Span) SetBool(k string, v bool)

SetBool tags the span during its creation.

func (Span) SetClientIP

func (s Span) SetClientIP(ip string)

SetClientIP tags the span during its creation with the IP address and port number of the client.

func (Span) SetError

func (s Span) SetError(err error)

SetError sets the status of the span to error.

func (Span) SetFloat

func (s Span) SetFloat(k string, v float64)

SetFloat tags the span during its creation.

func (Span) SetInt

func (s Span) SetInt(k string, v int)

SetInt tags the span during its creation.

func (Span) SetOK

func (s Span) SetOK(statusCode int)

SetOK sets the status of the span to OK, with the indicated response status code.

func (Span) SetRequest

func (s Span) SetRequest(r *http.Request)

SetRequest tags the span with the request data. Warning: this has a large memory footprint.

func (Span) SetString

func (s Span) SetString(k string, v string)

SetString tags the span during its creation.

func (Span) SetStrings

func (s Span) SetStrings(k string, v []string)

SetStrings tags the span during its creation.

func (Span) Status added in v1.3.0

func (s Span) Status() int

Status returns the status of the span: 0=unset; 1=error; 2=OK.

func (Span) TraceID

func (s Span) TraceID() string

TraceID is an identifier that groups related spans together.

Jump to

Keyboard shortcuts

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