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

Counter Exemplars with Context

Build a protobuf payload for a single counter metric that carries exemplar context (labels, value, timestamp) without leaking exemplar labels into the metric's base label set.

Capabilities

Counter exemplar payload

  • Serializes a counter metric named "request_duration_seconds_total" with base labels method=GET and status=200, attaches an exemplar containing trace_id=abc-123, exemplar value 0.42, and timestamp 2023-11-20T10:00:00Z, and returns bytes that decode back to those exact values. @test
  • If the provided exemplar timestamp is the zero value, returns an error instead of emitting a payload. @test
  • Ensures metric labels remain service=checkout and region=us-east-1, while exemplar labels remain trace_id=xyz-789 and span_id=def-456, with no cross-contamination between the two label sets. @test

Implementation

@generates

API

package exemplar

import "time"

// MarshalCounterWithExemplar builds a single-sample counter metric payload with an exemplar and returns the protobuf bytes.
func MarshalCounterWithExemplar(
    metricName string,
    metricLabels map[string]string,
    exemplarLabels map[string]string,
    counterValue float64,
    exemplarValue float64,
    exemplarTime time.Time,
) ([]byte, error)

Dependencies { .dependencies }

Prometheus client model { .dependency }

Provides protobuf data model types for metrics and exemplars.

@satisfied-by