Exemple
go.opentelemetry.io/proto/otlp v1.9.0: v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA
Échantillon vérifié pour golang go.opentelemetry.io/proto/otlp v1.9.0: v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA. Le contrat s'est exécuté sur…
sha256:489b06ad8c9cd28fadffca50f3cd13427c7c7bd0fddfbba76fb52551618a3ae8
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
linux 24 · ubuntu · glibc 2.39 x64 go
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-09-05 |
Cas
HOW- Objectif
- verify go.opentelemetry.io/proto/otlp/metrics/v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA in pkg:golang/go.opentelemetry.io/proto/otlp@v1.9.0
- Symboles
-
- go.opentelemetry.io/proto/otlp/metrics/v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA
- Créé
- 2026-09-05T21:52:46Z
Contrat
- AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA represents delta temporality with integer enum value 1 and string identifier AGGREGATION_TEMPORALITY_DELTA.
- AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA can be assigned to Sum, Histogram, and ExponentialHistogram metrics, and retrieved via typed getters.
- Protobuf wire serialization and deserialization preserves AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA across binary round-trip with proto.Equal verifying integrity.
- JSON serialization via protojson formats AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA as AGGREGATION_TEMPORALITY_DELTA and successfully unmarshals back to the enum.
- proto.Clone accurately replicates metric structures configured with AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA into independent deep copies.
- AggregationTemporality enum methods correctly reflect DELTA temporality metadata and value mapping.
Fichiers
- PROMPT.md
- csx.json
- go.mod
- go.sum
- spec.json
- test/main.go
Code source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify go.opentelemetry.io/proto/otlp/metrics/v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA in pkg:golang/go.opentelemetry.io/proto/otlp@v1.9.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/go.opentelemetry.io/proto/otlp@v1.9.0
Demonstrate these symbols/APIs:
- go.opentelemetry.io/proto/otlp/metrics/v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:5a36694ef140da450dc4478c0888a57df7ac03d58326d3e6b80a31e6f45f0308","contract":["AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA represents delta temporality with integer enum value 1 and string identifier AGGREGATION_TEMPORALITY_DELTA.","AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA can be assigned to Sum, Histogram, and ExponentialHistogram metrics, and retrieved via typed getters.","Protobuf wire serialization and deserialization preserves AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA across binary round-trip with proto.Equal verifying integrity.","JSON serialization via protojson formats AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA as AGGREGATION_TEMPORALITY_DELTA and successfully unmarshals back to the enum.","proto.Clone accurately replicates metric structures configured with AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA into independent deep copies.","AggregationTemporality enum methods correctly reflect DELTA temporality metadata and value mapping."],"goal":"verify go.opentelemetry.io/proto/otlp/metrics/v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA in pkg:golang/go.opentelemetry.io/proto/otlp@v1.9.0","kind":"HOW","packages":["pkg:golang/go.opentelemetry.io/proto/otlp@v1.9.0"],"schemaVersion":1,"symbols":["go.opentelemetry.io/proto/otlp/metrics/v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/go.opentelemetry.io/proto/otlp@v1.9.0"],"schemaVersion":1,"subject":"pkg:golang/go.opentelemetry.io/proto/otlp@v1.9.0","symbols":["go.opentelemetry.io/proto/otlp/metrics/v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA"],"verifierAdapter":"golang@1"}
module example.com/otlpdelta
go 1.26.6
require (
go.opentelemetry.io/proto/otlp v1.9.0
google.golang.org/protobuf v1.36.10
)
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A=
go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4=
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
{
"schemaVersion": 1,
"goal": "verify go.opentelemetry.io/proto/otlp/metrics/v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA in pkg:golang/go.opentelemetry.io/proto/otlp@v1.9.0",
"kind": "HOW",
"packages": [
"pkg:golang/go.opentelemetry.io/proto/otlp@v1.9.0"
],
"symbols": [
"go.opentelemetry.io/proto/otlp/metrics/v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA"
]
}
package main
import (
"bytes"
"fmt"
"os"
metricspb "go.opentelemetry.io/proto/otlp/metrics/v1"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
)
func assert(condition bool, message string) {
if !condition {
fmt.Fprintf(os.Stderr, "assertion failed: %s\n", message)
os.Exit(1)
}
}
func main() {
delta := metricspb.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA
// Assertion 1: AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA represents delta temporality with integer enum value 1 and string identifier AGGREGATION_TEMPORALITY_DELTA
{
assert(delta == 1, "expected enum value 1 for DELTA temporality")
assert(delta.String() == "AGGREGATION_TEMPORALITY_DELTA", "expected String() to return 'AGGREGATION_TEMPORALITY_DELTA'")
assert(int32(delta) == 1, "expected int32 cast to equal 1")
assert(metricspb.AggregationTemporality_name[int32(delta)] == "AGGREGATION_TEMPORALITY_DELTA", "expected name map lookup to match")
}
// Assertion 2: AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA can be assigned to Sum, Histogram, and ExponentialHistogram metrics, and retrieved via typed getters
{
sum := &metricspb.Sum{
AggregationTemporality: delta,
IsMonotonic: true,
}
assert(sum.GetAggregationTemporality() == delta, "expected Sum GetAggregationTemporality() to return DELTA")
hist := &metricspb.Histogram{
AggregationTemporality: delta,
}
assert(hist.GetAggregationTemporality() == delta, "expected Histogram GetAggregationTemporality() to return DELTA")
expHist := &metricspb.ExponentialHistogram{
AggregationTemporality: delta,
}
assert(expHist.GetAggregationTemporality() == delta, "expected ExponentialHistogram GetAggregationTemporality() to return DELTA")
}
// Assertion 3: Protobuf wire serialization and deserialization preserves AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA across binary round-trip with proto.Equal verifying integrity
{
metric := &metricspb.Metric{
Name: "http.server.request.duration",
Description: "Duration of HTTP server requests",
Unit: "ms",
Data: &metricspb.Metric_Sum{
Sum: &metricspb.Sum{
AggregationTemporality: delta,
IsMonotonic: true,
DataPoints: []*metricspb.NumberDataPoint{
{
Value: &metricspb.NumberDataPoint_AsInt{AsInt: 100},
},
},
},
},
}
wireBytes, err := proto.Marshal(metric)
assert(err == nil, "proto.Marshal failed")
assert(len(wireBytes) > 0, "expected non-empty wire bytes")
unmarshaled := &metricspb.Metric{}
err = proto.Unmarshal(wireBytes, unmarshaled)
assert(err == nil, "proto.Unmarshal failed")
assert(proto.Equal(metric, unmarshaled), "unmarshaled metric does not equal original")
assert(unmarshaled.GetSum().GetAggregationTemporality() == delta, "expected unmarshaled Sum to retain DELTA temporality")
}
// Assertion 4: JSON serialization via protojson formats AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA as AGGREGATION_TEMPORALITY_DELTA and successfully unmarshals back to the enum
{
sum := &metricspb.Sum{
AggregationTemporality: delta,
IsMonotonic: false,
}
jsonBytes, err := protojson.Marshal(sum)
assert(err == nil, "protojson.Marshal failed")
assert(bytes.Contains(jsonBytes, []byte(`"AGGREGATION_TEMPORALITY_DELTA"`)), "protojson output must contain AGGREGATION_TEMPORALITY_DELTA string")
unmarshaled := &metricspb.Sum{}
err = protojson.Unmarshal(jsonBytes, unmarshaled)
assert(err == nil, "protojson.Unmarshal failed")
assert(unmarshaled.GetAggregationTemporality() == delta, "expected protojson unmarshal to restore DELTA temporality")
assert(proto.Equal(sum, unmarshaled), "protojson unmarshaled Sum must match original")
}
// Assertion 5: proto.Clone accurately replicates metric structures configured with AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA into independent deep copies
{
orig := &metricspb.Metric{
Name: "system.cpu.utilization",
Data: &metricspb.Metric_Histogram{
Histogram: &metricspb.Histogram{
AggregationTemporality: delta,
DataPoints: []*metricspb.HistogramDataPoint{
{
Count: 5,
Sum: proto.Float64(42.5),
},
},
},
},
}
cloned := proto.Clone(orig).(*metricspb.Metric)
assert(proto.Equal(orig, cloned), "cloned metric must match original")
assert(cloned.GetHistogram().GetAggregationTemporality() == delta, "cloned histogram must have DELTA temporality")
// Modify clone to ensure independence
cloned.GetHistogram().AggregationTemporality = metricspb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE
assert(orig.GetHistogram().GetAggregationTemporality() == delta, "mutating clone must not mutate original")
}
// Assertion 6: AggregationTemporality enum methods correctly reflect DELTA temporality metadata and value mapping
{
enumPtr := delta.Enum()
assert(enumPtr != nil && *enumPtr == delta, "Enum() must return pointer to enum value")
assert(delta.Number() == 1, "Number() must return protoreflect.EnumNumber(1)")
desc := delta.Descriptor()
assert(desc != nil, "Descriptor() must not be nil")
assert(string(desc.Name()) == "AggregationTemporality", "Descriptor Name must be AggregationTemporality")
valueDesc := desc.Values().ByNumber(delta.Number())
assert(valueDesc != nil, "ValueDescriptor for DELTA must not be nil")
assert(string(valueDesc.Name()) == "AGGREGATION_TEMPORALITY_DELTA", "ValueDescriptor name must match")
}
fmt.Println("PASS: all go.opentelemetry.io/proto/otlp/metrics/v1.AggregationTemporality_AGGREGATION_TEMPORALITY_DELTA contract assertions verified")
}
Seeder d'origine
anonyme