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-10/

Metric Label Composer

Produces validated metric label slices from base and override inputs for Prometheus-style metrics.

Capabilities

Merge and normalize inputs

  • Combining base labels {"env":"prod","region":"us-east"} with overrides {"region":"eu-west","service":"edge"} returns three label messages ordered by name: env=prod, region=eu-west, service=edge. @test
  • Surrounding whitespace in names and values is trimmed before labels are emitted. @test

Reject invalid labels

  • A blank or whitespace-only label name results in an error and no labels are returned. @test
  • A value that becomes empty after trimming also results in an error. @test

Handle internal labels

  • Labels with names starting with "__" are dropped by default, leaving only public labels. @test
  • When AllowInternal is true, internal labels are preserved and listed after public labels while keeping name ordering inside each group. @test

Map round-trip

  • Converting the produced labels back into a string map returns the trimmed names and values without internal labels unless they were allowed. @test

Implementation

@generates

API

type LabelSet = map[string]string

type LabelOptions struct {
    AllowInternal bool
}

type LabelMessage interface {
    GetName() string
    GetValue() string
}

func BuildLabels(base LabelSet, overrides LabelSet, opts LabelOptions) ([]LabelMessage, error)
func LabelsToMap(labels []LabelMessage) map[string]string

LabelMessage refers to the dependency's native name/value label message type and must not be replaced with a custom struct.

Dependencies { .dependencies }

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

Provides proto-generated metric messages, including the label message type for name/value pairs.