telemetry

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package telemetry holds the tracing and metric helpers the engine, the plugin registry and the admin service share.

Spans go to the global OpenTelemetry tracer provider, which forge.New installs. Metrics go to a go-utils metrics.Metrics, which in a Forge app is app.Metrics(); Forge scrapes a name like shield_scans_completed_total as forge_shield_scans_completed_total.

Index

Constants

View Source
const ScopeName = "github.com/xraph/shield"

ScopeName is the instrumentation scope on every span shield starts.

Variables

This section is empty.

Functions

func ErrorType

func ErrorType(err error) string

ErrorType returns the Go type of the innermost error in err's chain, the value for the exception.type attribute.

func Exception

func Exception(span trace.Span, err error)

Exception adds an exception event that carries only the error's Go type, for a failure that doesn't fail the span as a whole.

func Fail

func Fail(span trace.Span, class string, err error)

Fail marks span as failed. class is a short, fixed description such as "audit_failed". The exception event carries only the error's Go type: error messages from drivers and host adapters can quote the values they failed on, so they never go on a span.

func Tracer

func Tracer() trace.Tracer

Tracer returns shield's tracer from the global provider. It is looked up on each call, so a provider installed after shield was built still applies.

Types

type CounterVec

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

CounterVec is a counter with fixed label keys. A nil *CounterVec records nothing, which is what NewCounterVec returns for a nil sink.

func NewCounterVec

func NewCounterVec(m gometrics.Metrics, name, help string, keys ...string) *CounterVec

NewCounterVec declares a counter on m. A nil m returns nil.

func (*CounterVec) Inc

func (c *CounterVec) Inc(values ...string)

Inc adds one to the series for values, given in the declared key order. A call with the wrong number of values records nothing.

type HistogramVec

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

HistogramVec is a histogram with fixed label keys. A nil *HistogramVec records nothing, which is what NewHistogramVec returns for a nil sink.

func NewHistogramVec

func NewHistogramVec(m gometrics.Metrics, name, help, unit string, buckets []float64, keys ...string) *HistogramVec

NewHistogramVec declares a histogram on m with the given unit and buckets. A nil m returns nil.

func (*HistogramVec) Observe

func (h *HistogramVec) Observe(v float64, values ...string)

Observe records v in the series for values, given in the declared key order. A call with the wrong number of values records nothing.

Jump to

Keyboard shortcuts

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