Documentation
¶
Index ¶
- func Attrs(attrs ...attribute.KeyValue) metric.MeasurementOption
- func Init[T any](attrs ...attribute.KeyValue) (*T, error)
- func Micros[T n64](start time.Time) T
- func Millis[T n64](start time.Time) T
- func MustInit[T any](attrs ...attribute.KeyValue) *T
- func MustSetup(name string, attrs ...attribute.KeyValue)
- func Seconds[T n64](start time.Time) T
- func Setup(name string, attrs ...attribute.KeyValue) error
- func SetupWithMeter(meter metric.Meter)
- type AddTFn
- type Counter
- type Gauge
- type Histogram
- func (h *Histogram[T]) Measure(sub timeSub[T], opts ...metric.RecordOption) func(opts ...metric.RecordOption)
- func (h *Histogram[T]) MeasureCtx(ctx context.Context, sub timeSub[T], opts ...metric.RecordOption) func(opts ...metric.RecordOption)
- func (h *Histogram[T]) Record(n T, opts ...metric.RecordOption)
- func (h *Histogram[T]) RecordCtx(ctx context.Context, n T, opts ...metric.RecordOption)
- type RecordFn
- type UpDownCounter
- func (u *UpDownCounter[T]) Add(n T, opts ...metric.AddOption)
- func (u *UpDownCounter[T]) AddCtx(ctx context.Context, n T, opts ...metric.AddOption)
- func (u *UpDownCounter[T]) Dec(opts ...metric.AddOption)
- func (u *UpDownCounter[T]) DecCtx(ctx context.Context, opts ...metric.AddOption)
- func (u *UpDownCounter[T]) Inc(opts ...metric.AddOption)
- func (u *UpDownCounter[T]) IncCtx(ctx context.Context, opts ...metric.AddOption)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Micros ¶ added in v0.1.0
Micros returns the time elapsed since a given start point in microseconds.
func Millis ¶ added in v0.1.0
Millis returns the time elapsed since a given start point in milliseconds.
func Seconds ¶ added in v0.1.0
Seconds returns the time elapsed since a given start point in seconds.
func SetupWithMeter ¶
Types ¶
type Counter ¶ added in v0.1.0
type Counter[T n64] struct {
// contains filtered or unexported fields
}
Counter is a synchronous Instrument which supports non-negative increments. Complete docs: https://opentelemetry.io/docs/specs/otel/metrics/api/#counter
type Gauge ¶ added in v0.1.0
type Gauge[T n64] struct {
// contains filtered or unexported fields
}
Gauge is a synchronous Instrument which can be used to record non-additive value(s). Complete docs: https://opentelemetry.io/docs/specs/otel/metrics/api/#gauge
func (*Gauge[T]) Record ¶ added in v0.1.0
func (g *Gauge[T]) Record(n T, opts ...metric.RecordOption)
Record records the value of n to the gauge.
type Histogram ¶ added in v0.1.0
type Histogram[T n64] struct {
// contains filtered or unexported fields
}
Histogram is a synchronous Instrument which can be used to report arbitrary values that are likely to be statistically meaningful. It is intended for statistics such as histograms, summaries, and percentile. Complete docs: https://opentelemetry.io/docs/specs/otel/metrics/api/#histogram
func (*Histogram[T]) Measure ¶ added in v0.1.0
func (h *Histogram[T]) Measure(sub timeSub[T], opts ...metric.RecordOption) func(opts ...metric.RecordOption)
Measure creates a starting point using time.Now and returns a function that records the time elapsed since the starting point. The returned function may also receive record options to further support information that may vary along a given procedure.
func (*Histogram[T]) MeasureCtx ¶ added in v0.1.0
func (h *Histogram[T]) MeasureCtx(ctx context.Context, sub timeSub[T], opts ...metric.RecordOption) func(opts ...metric.RecordOption)
MeasureCtx creates a starting point using time.Now and returns a function that records the time elapsed since the starting point. The returned function may also receive record options to further support information that may vary along a given procedure.
func (*Histogram[T]) Record ¶ added in v0.1.0
func (h *Histogram[T]) Record(n T, opts ...metric.RecordOption)
Record adds a value to the distribution.
type RecordFn ¶ added in v0.1.2
type RecordFn[T n64] func(ctx context.Context, value T, opts ...metric.RecordOption)
type UpDownCounter ¶ added in v0.1.0
type UpDownCounter[T n64] struct {
// contains filtered or unexported fields
}
UpDownCounter is a synchronous Instrument which supports increments and decrements. Complete docs: https://opentelemetry.io/docs/specs/otel/metrics/api/#updowncounter
func (*UpDownCounter[T]) Add ¶ added in v0.1.0
func (u *UpDownCounter[T]) Add(n T, opts ...metric.AddOption)
Add records a change of n to the counter.
func (*UpDownCounter[T]) AddCtx ¶ added in v0.1.0
func (u *UpDownCounter[T]) AddCtx(ctx context.Context, n T, opts ...metric.AddOption)
AddCtx records a change of n to the counter.
func (*UpDownCounter[T]) Dec ¶ added in v0.1.0
func (u *UpDownCounter[T]) Dec(opts ...metric.AddOption)
Dec records a change of -1 to the counter.
func (*UpDownCounter[T]) DecCtx ¶ added in v0.1.0
func (u *UpDownCounter[T]) DecCtx(ctx context.Context, opts ...metric.AddOption)
DecCtx records a change of -1 to the counter.
func (*UpDownCounter[T]) Inc ¶ added in v0.1.0
func (u *UpDownCounter[T]) Inc(opts ...metric.AddOption)
Inc records a change of 1 to the counter.