telemetry

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 0 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package telemetry corresponds to pi's packages/telemetry/src.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeValue

type AttributeValue any

AttributeValue is a span attribute value: string, number, boolean, or a slice of one of those.

type SpanAttributes

type SpanAttributes map[string]AttributeValue

SpanAttributes are span attributes keyed by name; a nil value omits the key.

type SpanOptions

type SpanOptions struct {
	Name       string
	Attributes SpanAttributes
}

SpanOptions start one span.

type SpanStatus

type SpanStatus struct {
	Kind  SpanStatusKind   `json:"status"`
	Error *SpanStatusError `json:"error,omitempty"`
}

type SpanStatusError

type SpanStatusError struct {
	Name    string `json:"name"`
	Message string `json:"message"`
}

type SpanStatusKind

type SpanStatusKind string

SpanStatusKind discriminates how a span ended.

const (
	SpanStatusKindOK    SpanStatusKind = "ok"
	SpanStatusKindError SpanStatusKind = "error"
)

type TelemetryContext

type TelemetryContext interface {
	StartSpan(options SpanOptions, callback func(span TelemetrySpan) error) error
}

TelemetryContext is an explicit parent for spans produced by one logical request. pi's generic StartSpan result propagates through the callback's return value; in Go the callback reports an error and other values cross via the closure.

var NoopTelemetryContext TelemetryContext = noopSpan{}

NoopTelemetryContext is the NOOP_TELEMETRY_CONTEXT counterpart: spans are created and immediately discarded.

type TelemetrySpan

type TelemetrySpan interface {
	TelemetryContext
	AddEvent(name string, attributes SpanAttributes)
	SetAttributes(attributes SpanAttributes)
	SetStatus(status SpanStatus)
}

TelemetrySpan is a running span; it also starts child spans.

Jump to

Keyboard shortcuts

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