struct Crometheus::Sample

Overview

An instantaneous datum from a metric. Metric types should yield one or more of these when Metric#sample is called. Registry interpolates their values into an appropriate exposition format.

Each Sample corresponds to one line item in the exposed metric data. Thus, counters and gauges always yield a single sample, while summaries and histograms yield more depending on how many buckets/quantiles are configured.

A Metric named :fruit that yields a Sample like this:

Sample.new(12.0, labels: {:species => "banana"}, suffix: "count")

will produce an exported metric line like this:

fruit_count{species="banana"} 12.0

Defined in:

crometheus/sample.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(value : Float64, labels : Hash(Symbol, String) = {} of Symbol => String, suffix : String = "") #

[View source]

Instance Method Detail

def labels : Hash(Symbol, String) #

[View source]
def labels=(labels : Hash(Symbol, String)) #

[View source]
def suffix : String #

[View source]
def suffix=(suffix : String) #

[View source]
def value : Float64 #

[View source]
def value=(value : Float64) #

[View source]