What the agent does
The agent reads PlaceOrder in src/checkout/main.go and the existing main_test.go first. The span already carries demo.order.amount and demo.order.items.count, so it adds app.order.amount and app.order.items.count beside them from the same totalPriceFloat and len(prep.orderItems), leaving the old keys for whatever already reads them.
The repository has no fixtures for checkout's gRPC clients, so TestPlaceOrderSetsOrderSpanAttributes brings small stubs for cart, catalog, currency and payment, a fake HTTP transport for shipping and email, and a tracetest.SpanRecorder. It expects an amount of 35 and a count of 2. The agent also declares both keys in telemetry-schema/attributes/order.yaml and telemetry-schema/services/checkout.yaml.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "A Linear issue labeled agent says: \"Add Custom Span Attributes with OpenTelemetry. In the checkout service, add app.order.amount and app.order.items.count attributes to the PlaceOrder span and a test that asserts they are set.\" Do the work in this repository, add tests for it, run docker compose build for the touched services, and open a pull request that links back to the issue.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
Tried on open-telemetry/opentelemetry-demo at 33bd8231: 4 files changed, 117 insertions(+): src/checkout/main.go (+2), src/checkout/main_test.go (+101) and the two schema files (+12, +2). The issue text was written for the trial and had no ID. go test ./... passed before and after, ending ok github.com/open-telemetry/opentelemetry-demo/src/checkout 0.012s. With the two new lines removed the test failed with app.order.amount = -1, want 35; restored, it printed --- PASS: TestPlaceOrderSetsOrderSpanAttributes (0.00s).
Not verified: docker compose build checkout exited 127 with docker: command not found, and no schema validation was run on the YAML. For the reviewer: whether the issue meant a rename, in which case the demo.* lines and their schema entries go.
Run it on every Linear issue labeled agent
An automation with a linear trigger on linear.issue.labeled and the label agent runs the linear-label-to-pr recipe's prompt when someone in your Rush org labels an observability request. An issue that says whether the demo.order.* keys should be renamed rather than joined by app.* ones settles the decision this run left to a reviewer.
The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.
Why run it on Rush?
A span attribute test is easy to write so it passes either way. This run proved the test bites by deleting the two attributes and watching it fail with both missing, and it noticed the span already had demo.* equivalents, which a reviewer has to rule on before dashboards split across two names.
Frequently asked questions
Why not just rename the demo.order attributes?
Other services and dashboards may already query demo.order.amount. The agent added the app.* keys alongside and named the rename as a reviewer's choice rather than breaking existing consumers.
Was the Docker image built?
No. The sandbox had no docker, so docker compose build checkout could not run before or after. Only Go source and YAML changed, and the Go module's own tests passed, but CI or a reviewer still needs to build the image.
More OpenTelemetry jobs
More jobs like this: Turn a Linear label into a PR
- Add a Customer Lifetime Value Model to a dbt Project from a Linear Issue (dbt)
- Add D1 Migrations to a Cloudflare Worker (Cloudflare Workers)
- Add Dark Mode to a Reflex App (Reflex)