struct

Prometheus::Sample

Inherits Struct / Value / Object

Represents a single sample value at a point in time.

A Sample combines:

  • A metric name
  • A set of labels
  • A numeric value
  • An optional timestamp

Samples are used to represent the actual data points collected by metrics. The Sample format follows the Prometheus exposition format:

metric_name{label="value"} 42
# Or with timestamp:
metric_name{label="value"} 42 1234567890

Constructors

new(name : String, labels : Hash(String, String), value : Float64, timestamp : Int64 | Nil = nil)
Source
new(name : String, labels : LabelSet, value : Float64, timestamp : Int64 | Nil = nil)
Source

Instance methods

==(other : self)
collect(io : IO) : Nil
Source
hash(hasher)

See Object#hash(hasher)

labels
Source
name
Source
timestamp
Source
to_s(io : IO)

Same as #inspect(io).

Source
value
Source