struct

Prometheus::LabelSet

Inherits Enumerable / Struct / Value / Object

LabelSet represents a collection of labels that uniquely identify a metric.

A LabelSet is used to attach multiple labels to a metric, enabling Prometheus's dimensional data model.

labels = LabelSet.new({
  "method" => "GET",
  "path"   => "/api/users",
})

LabelSets can be merged to combine labels from different sources:

base_labels = LabelSet.new({"service" => "web"})
request_labels = LabelSet.new({"method" => "GET"})
combined = base_labels.merge(request_labels)

Constructors

new(labels : Hash(String, String) = Hash(String, String).new)
Source

Instance methods

==(other : self)
[]?(label : String)
Source
add(name : String, value : String)
Source
each(*args, **options)
Source
each(*args, **options, &)
Source
hash(hasher)

See Object#hash(hasher)

labels
Source
merge(other : LabelSet)
Source
merge(other : Hash(String, String))
Source
to_s(io : IO)

Same as #inspect(io).

Source