Documentation
¶
Index ¶
- Constants
- Variables
- func BoolAttr(key string, value bool) attribute.KeyValue
- func FloatAttr(key string, value float64) attribute.KeyValue
- func Initialize(ctx context.Context, cfg Config) error
- func Int64Attr(key string, value int64) attribute.KeyValue
- func IntAttr(key string, value int) attribute.KeyValue
- func RecordServerInfo(ctx context.Context, serverType string, extraAttrs ...attribute.KeyValue)
- func Shutdown(ctx context.Context) error
- func StringAttr(key, value string) attribute.KeyValue
- type Config
- type Counter
- type CounterConfig
- type FloatCounter
- type FloatCounterConfig
- type FloatGauge
- type FloatGaugeConfig
- type Gauge
- type GaugeConfig
- type Histogram
- type HistogramConfig
- type Info
- type InfoConfig
- type Provider
- type Telemetry
- func (t *Telemetry) Meter() metric.Meter
- func (t *Telemetry) NewCounter(cfg CounterConfig) (*Counter, error)
- func (t *Telemetry) NewFloatCounter(cfg FloatCounterConfig) (*FloatCounter, error)
- func (t *Telemetry) NewFloatGauge(cfg FloatGaugeConfig) (*FloatGauge, error)
- func (t *Telemetry) NewGauge(cfg GaugeConfig) (*Gauge, error)
- func (t *Telemetry) NewHistogram(cfg HistogramConfig) (*Histogram, error)
- func (t *Telemetry) NewInfo(cfg InfoConfig) (*Info, error)
- func (t *Telemetry) NewTimer(cfg TimerConfig) (*Timer, error)
- func (t *Telemetry) Shutdown(ctx context.Context) error
- type TimedContext
- type Timer
- func (t *Timer) Record(ctx context.Context, duration time.Duration, attrs ...attribute.KeyValue)
- func (t *Timer) RecordFloat(ctx context.Context, value float64, attrs ...attribute.KeyValue)
- func (t *Timer) Start(ctx context.Context, attrs ...attribute.KeyValue) *TimedContext
- func (t *Timer) WithAttributes(attrs ...attribute.KeyValue) *Timer
- type TimerConfig
Constants ¶
const ( KiB float64 = 1024 MiB = KiB * 1024 GiB = MiB * 1024 )
Variables ¶
var ( HTTPServerRequestDurationInstrument = semconvhttp.ServerRequestDuration{}.Name() HTTPServerRequestSizeInstrument = semconvhttp.ServerRequestBodySize{}.Name() HTTPServerResponseSizeInstrument = semconvhttp.ServerResponseBodySize{}.Name() )
var HTTPServerDurationBounds = []float64{
0.005, 0.01, 0.025, 0.05, 0.075, 0.1,
0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10,
30, 60, 120, 300, 600,
}
HTTPServerDurationBounds extends the default middleware buckets (0.005–10s from go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho/internal/semconv) to capture long uploads/downloads up to 10 minutes.
Functions ¶
func Initialize ¶
Initialize sets up the global telemetry instance. This should be called once at application startup.
func RecordServerInfo ¶
RecordServerInfo records server metadata as an info metric this metric is best effort, if it fails, a warning is log and the process continues
func StringAttr ¶
Types ¶
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
func NewCounter ¶
func NewCounter(meter metric.Meter, cfg CounterConfig) (*Counter, error)
type CounterConfig ¶
type FloatCounter ¶
type FloatCounter struct {
// contains filtered or unexported fields
}
func NewFloatCounter ¶
func NewFloatCounter(meter metric.Meter, cfg FloatCounterConfig) (*FloatCounter, error)
func (*FloatCounter) WithAttributes ¶
func (c *FloatCounter) WithAttributes(attrs ...attribute.KeyValue) *FloatCounter
type FloatCounterConfig ¶
type FloatGauge ¶
type FloatGauge struct {
// contains filtered or unexported fields
}
func NewFloatGauge ¶
func NewFloatGauge(meter metric.Meter, cfg FloatGaugeConfig) (*FloatGauge, error)
func (*FloatGauge) WithAttributes ¶
func (g *FloatGauge) WithAttributes(attrs ...attribute.KeyValue) *FloatGauge
type FloatGaugeConfig ¶
type GaugeConfig ¶
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
func NewHistogram ¶
func NewHistogram(meter metric.Meter, cfg HistogramConfig) (*Histogram, error)
type HistogramConfig ¶
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
Info represents an info metric - a gauge that always has value 1 Info metrics are used to expose textual information as labels.
type InfoConfig ¶
InfoConfig configures an info metric
type Telemetry ¶
type Telemetry struct {
// contains filtered or unexported fields
}
func Global ¶
func Global() *Telemetry
Global returns the global telemetry instance. If Initialize hasn't been called, it returns a no-op telemetry instance.
func NewWithMeter ¶
NewWithMeter creates a new Telemetry instance with a custom meter. This is useful for testing with in-memory exporters or manual readers.
func (*Telemetry) NewCounter ¶
func (t *Telemetry) NewCounter(cfg CounterConfig) (*Counter, error)
func (*Telemetry) NewFloatCounter ¶
func (t *Telemetry) NewFloatCounter(cfg FloatCounterConfig) (*FloatCounter, error)
func (*Telemetry) NewFloatGauge ¶
func (t *Telemetry) NewFloatGauge(cfg FloatGaugeConfig) (*FloatGauge, error)
func (*Telemetry) NewHistogram ¶
func (t *Telemetry) NewHistogram(cfg HistogramConfig) (*Histogram, error)
type TimedContext ¶
type TimedContext struct {
// contains filtered or unexported fields
}
func (*TimedContext) End ¶
func (tc *TimedContext) End(attrs ...attribute.KeyValue)