or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
golangpkg:golang/github.com/prometheus/client_model@v0.6.2
tile.json

tessl/golang-github-com-prometheus--client-model

tessl install tessl/golang-github-com-prometheus--client-model@0.6.1

Data 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%

task.mdevals/scenario-8/

Metric Kind Normalizer

Utility for normalizing metric type inputs into the metric-kind enumeration provided by the dependency and validating that downstream payload selections match the chosen kind. Outputs canonical kind strings for consistent wiring into metric families, with MetricKindValue representing the dependency's enum values rather than custom integers.

Capabilities

Parse metric kind text

  • Lowercase counter resolves to the corresponding metric-kind enum value. @test
  • Mixed-case Gauge-Histogram with a hyphen resolves to the gauge histogram enum value; underscores are treated the same as hyphens. @test
  • An unknown kind such as throughput returns an error describing the unsupported type. @test

Canonicalize metric kind output

  • Passing a supported metric-kind enum yields its canonical uppercase string form (e.g., histogram -> HISTOGRAM, gauge histogram -> GAUGE_HISTOGRAM). @test

Validate payload choice vs kind

  • Exactly one payload flag must be set; a counter kind paired with a counter payload passes validation, while pairing that kind with a gauge payload or multiple payload flags returns a mismatch error. @test

Supported kind check

  • Numeric values that are not part of the dependency's metric-kind enum map as unsupported. @test

Implementation

@generates

API

// MetricKindValue must align with the metric-kind enum provided by the dependency.
type MetricKindValue int32

type MetricPayloadChoice struct {
	Gauge     bool
	Counter   bool
	Summary   bool
	Untyped   bool
	Histogram bool
}

// ParseMetricKind converts user input (case-insensitive, underscores or hyphens allowed) into a supported metric-kind enum value.
func ParseMetricKind(text string) (MetricKindValue, error)

// CanonicalMetricKind returns the uppercase enum name for a supported metric-kind value.
func CanonicalMetricKind(kind MetricKindValue) (string, error)

// ValidateMetricPayload checks that exactly one payload flag is set and it matches the provided metric kind.
func ValidateMetricPayload(kind MetricKindValue, payload MetricPayloadChoice) error

// IsSupportedMetricKind reports whether the value maps to a known metric kind.
func IsSupportedMetricKind(kind MetricKindValue) bool

Dependencies { .dependencies }

github.com/prometheus/client_model/go { .dependency }

Provides the metric data model and metric-kind enumeration consumed by these helpers.