tracing

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package tracing holds public tracing payload contracts plus a small set of compatibility helpers.

The core public surface is the payload model:

  • Trace
  • Span
  • SpanStatus
  • ResourceInfo

Transport-colored helpers such as HTTP status mapping may remain public for compatibility, but they are not the governing center of the package.

Index

Constants

View Source
const (
	StatusOK    = "OK"
	StatusError = "Error"
	StatusUnset = "Unset"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceInfo

type ResourceInfo struct {
	ServiceName    string `json:"service.name"`
	ServiceVersion string `json:"service.version"`
}

ResourceInfo is the reduced public trace resource payload.

type Span

type Span struct {
	SpanID       string            `json:"spanId"`
	ParentSpanID *string           `json:"parentSpanId,omitempty"`
	Name         string            `json:"name"`
	Kind         string            `json:"kind"`
	StartTime    time.Time         `json:"startTime"`
	EndTime      time.Time         `json:"endTime"`
	Attributes   map[string]string `json:"attributes"`
	Status       SpanStatus        `json:"status"`
}

Span is the reduced public tracing span payload contract.

func NewSpan

func NewSpan(name, kind string, parentID *string, startTime, endTime time.Time) Span

func (*Span) OnDone

func (s *Span) OnDone()

func (*Span) SetStatus

func (s *Span) SetStatus(err error)

func (*Span) SetStatusFromHTTPCode

func (s *Span) SetStatusFromHTTPCode(code int)

SetStatusFromHTTPCode is the compatibility helper for the current transport-colored HTTP status mapping. The core tracing contract is the Trace and Span payload model plus explicit SetStatus(err); HTTP-code interpretation is not the governing center of the package.

func (*Span) WithAttributes

func (s *Span) WithAttributes(attrs map[string]string) *Span

type SpanStatus

type SpanStatus struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

SpanStatus is the reduced public span status payload.

type Trace

type Trace struct {
	TraceID  string        `json:"traceId"`
	Spans    []*Span       `json:"spans"`
	Resource *ResourceInfo `json:"resource"`
}

Trace is the reduced public tracing payload contract.

func NewTrace

func NewTrace(serviceName, serviceVersion string) *Trace

func (*Trace) Append

func (t *Trace) Append(span ...*Span)

Jump to

Keyboard shortcuts

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