otel-attribution

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Command otel-attribution is a small OpenTelemetry-instrumented program.

It exists for one beat of the `why` demo scenario (docs/demo-runbook.md), and it is deliberately not part of behalf: it imports no behalf package, reads no behalf state, and knows nothing about receipts. It builds a real span tree with the upstream OpenTelemetry Go SDK (go.opentelemetry.io/otel/sdk), exports it through a real span exporter, and prints the resource attributes those spans carry.

Why this is in the repo

The `why` scenario makes a claim about attribution, and the claim has to be demonstrated rather than asserted. OTEL_RESOURCE_ATTRIBUTES is a documented OpenTelemetry SDK configuration mechanism: the value is a comma-separated list of key=value pairs, percent-encoded where a key or value contains `,` or `=`, and the SDK's environment detector turns it into resource attributes that ride on every span the process emits (OpenTelemetry SDK configuration spec, "Specifying resource information via an environment variable"). Nothing signs those attributes and nothing checks them — they are configuration, which is what they are specified to be.

So the demonstration is: set the variable, watch the attribute appear on every span, and observe that the output is identical whether the value is true or invented. That is a real, documented property of a real SDK, shown by running it. It is not a claim about any vendor's product and this program neither imitates nor names one — the reading is done by resource.WithFromEnv() from the upstream SDK, not by a parser written here, precisely so that nothing about the behaviour is ours to shade.

The comparison the scenario draws is against behalf's own receipt for the same action, printed by `behalf why rec_c71e:31`, where a hop that carries no signature is rendered UNVERIFIED and the actor string is named as caller-asserted rather than promoted.

Determinism

Trace and span ids come from a fixed-seed generator so that two runs print the same bytes; the demo is re-run repeatedly and a diff of two runs should be empty. Nothing else about the SDK path is stubbed.

Usage

otel-attribution
OTEL_RESOURCE_ATTRIBUTES=user.email=ceo@corp.com otel-attribution

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL