Documentation
¶
Index ¶
- func Timed(ctx context.Context, h Histogram, fn func()) time.Duration
- type Attribute
- type Counter
- type Gauge
- type Histogram
- type Meter
- type OTLPExporter
- type OTLPOption
- type Option
- type PrometheusExporter
- type Provider
- type SimpleMeter
- func (m *SimpleMeter) Counter(name string, attrs ...Attribute) Counter
- func (m *SimpleMeter) Gauge(name string, attrs ...Attribute) Gauge
- func (m *SimpleMeter) GetCounter(name string) int64
- func (m *SimpleMeter) GetGauge(name string) float64
- func (m *SimpleMeter) Histogram(name string, attrs ...Attribute) Histogram
- type SimpleTracer
- type Span
- type TelemetryMiddleware
- type TraceContext
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Meter ¶
type Meter interface {
Counter(name string, attrs ...Attribute) Counter
Histogram(name string, attrs ...Attribute) Histogram
Gauge(name string, attrs ...Attribute) Gauge
}
Meter creates and records metrics.
type OTLPExporter ¶
type OTLPExporter struct {
// contains filtered or unexported fields
}
OTLPExporter sends spans and metrics to an OTLP-compatible endpoint over HTTP/JSON.
func NewOTLPExporter ¶
func NewOTLPExporter(opts ...OTLPOption) *OTLPExporter
NewOTLPExporter creates a new OTLPExporter with the given options.
func (*OTLPExporter) Close ¶
func (e *OTLPExporter) Close()
func (*OTLPExporter) ExportMetric ¶
func (e *OTLPExporter) ExportMetric(m otlpMetric)
func (*OTLPExporter) ExportSpan ¶
func (e *OTLPExporter) ExportSpan(span otlpSpan)
type OTLPOption ¶
type OTLPOption func(*OTLPExporter)
OTLPOption configures an OTLPExporter.
func WithOTLPBatchSize ¶
func WithOTLPBatchSize(n int) OTLPOption
WithOTLPBatchSize sets the maximum batch size before flushing.
func WithOTLPEndpoint ¶
func WithOTLPEndpoint(url string) OTLPOption
WithOTLPEndpoint sets the OTLP receiver endpoint URL.
type PrometheusExporter ¶
type PrometheusExporter struct {
// contains filtered or unexported fields
}
func NewPrometheusExporter ¶
func NewPrometheusExporter() *PrometheusExporter
NewPrometheusExporter creates a new PrometheusExporter.
func (*PrometheusExporter) IncCounter ¶
func (p *PrometheusExporter) IncCounter(name string, delta int64)
func (*PrometheusExporter) ObserveHistogram ¶
func (p *PrometheusExporter) ObserveHistogram(name string, value float64, buckets []float64)
func (*PrometheusExporter) SetGauge ¶
func (p *PrometheusExporter) SetGauge(name string, value float64)
func (*PrometheusExporter) WriteText ¶
func (p *PrometheusExporter) WriteText(w io.Writer)
type Provider ¶
Provider is the central telemetry hub.
func NewProvider ¶
NewProvider creates a telemetry provider with noop defaults.
type SimpleMeter ¶
type SimpleMeter struct {
// contains filtered or unexported fields
}
SimpleMeter is a basic meter that stores counters in memory.
func (*SimpleMeter) Counter ¶
func (m *SimpleMeter) Counter(name string, attrs ...Attribute) Counter
func (*SimpleMeter) GetCounter ¶
func (m *SimpleMeter) GetCounter(name string) int64
GetCounter returns the current counter value by name.
func (*SimpleMeter) GetGauge ¶
func (m *SimpleMeter) GetGauge(name string) float64
GetGauge returns the current gauge value by name.
type SimpleTracer ¶
type SimpleTracer struct {
// contains filtered or unexported fields
}
SimpleTracer is a basic tracer that logs span starts and ends to stderr.
type Span ¶
type Span interface {
SetAttributes(attrs ...Attribute)
End()
}
Span represents an active span in a trace.
type TelemetryMiddleware ¶
type TelemetryMiddleware struct {
Provider *Provider
}
func NewTelemetryMiddleware ¶
func NewTelemetryMiddleware(provider *Provider) *TelemetryMiddleware
NewTelemetryMiddleware creates a new TelemetryMiddleware wrapping the given provider.
type TraceContext ¶
func ParseTraceparent ¶
func ParseTraceparent(header string) (*TraceContext, error)
ParseTraceparent parses a W3C traceparent header.
func (*TraceContext) Encode ¶
func (tc *TraceContext) Encode() string