CtrlK
BlogDocsLog inGet started
Tessl Logo

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

Data model artifacts for Prometheus

Overall
score

93%

Evaluation93%

1.13x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-8/

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.

Install with Tessl CLI

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

tile.json