tessl install tessl/golang-github-com-prometheus--client-model@0.6.1Data model artifacts for Prometheus
Agent Success
Agent success rate when using this tile
93%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.13x
Baseline
Agent success rate without this tile
82%
Create a helper that produces a summary-style metric payload containing a sample count, sample sum, and quantile entries suitable for protobuf serialization.
[1.2, 0.8, 3.0], the aggregated sample count is 3 and the sample sum is 5.0 in the produced summary data. @testphi in [0, 1], compute position phi * (n - 1) and linearly interpolate between neighboring samples to populate quantile entries. With observations [1, 2, 3, 4] and requested quantiles [0.25, 0.5], the resulting quantiles are (0.25 → 1.75) and (0.5 → 2.5), ordered by ascending phi. @test[0.9, 0.5]), the output quantile entries are sorted by phi while preserving the interpolated values for each request. @test0, sample sum of 0, and no quantile entries. @test@generates
type QuantilePoint struct {
Phi float64
Value float64
}
type SummaryData struct {
SampleCount uint64
SampleSum float64
Quantiles []QuantilePoint
}
// BuildSummary aggregates count, sum, and quantile entries from observations, returning quantiles sorted by phi.
// Returns an error if observations contain NaN/Inf or quantiles fall outside [0, 1].
func BuildSummary(observations []float64, quantiles []float64) (*SummaryData, error)
// EncodeSummary converts the summary data into protobuf-ready bytes using the dependency's summary metric format.
func EncodeSummary(summary *SummaryData) ([]byte, error)Provides Prometheus metric protobuf types for summary payloads.