Go from a prompt to a working metric.
See how OpenCode or Claude Code can use the Umlogger skill and MCP server together. In this example, AI adds checkout tracking to an online store. Later, it helps investigate a drop.
This is a made-up example, not a customer story. The MCP calls show how Umlogger works, but your AI tool may take different steps and write different code.
The skill guides. MCP connects.
- The skill tells AI how to choose a metric type, protect keys, and understand results.
- The MCP server lets AI create metrics and read data, depending on the access you allow.
- Your AI coding tool edits your project. You review its changes.
To follow this example, choose Read and write when you connect. Then tick Let this app get ingest keys for metrics you own. Both are off by default. Keys keep working after you disconnect the app, so read about the risks first. You can also leave the box unticked and copy the key yourself.
Part 1: Track completed checkouts
1. Create the metric
You ask
“Use Umlogger to track completed checkouts. Create the metric, save its key safely, and add the code and tests. Don’t send any test data.”
What the skill says
A checkout is an event, so use a count metric. Check that the metric doesn’t already exist before creating it.
MCP calls and results (shortened)
list_metrics({ "search": "checkout" }) → { "count": 0, "metrics": [] } create_metric({ "name": "Completed checkouts", "type": "count", "slug": "completed-checkouts" }) → { "slug": "completed-checkouts", "type": "count", "ingestUrl": null }Result
The metric is ready. Apps connected by signing in don’t see its key or ingest URL here.
2. Save the key
What the skill says
Make sure Git ignores the file and isn’t already tracking it. Then get the key and save it without showing it in a reply.
MCP calls and results (shortened)
get_ingest_key({ "metric": "completed-checkouts" }) → { "metric": "completed-checkouts", "type": "count", "ingestKey": "[hidden]", "endpoint": "https://data.umlogger.com/api/m" }Result
The key is saved locally as UMLOGGER_CHECKOUTS_KEY. This works only if you allowed the app to get ingest keys. We’ve hidden the key here, but your AI tool receives the real one.
3. Add the code
What the skill says
Record the checkout only after the order is saved. Use a short timeout, and don’t let a tracking error stop the checkout. Check for retries that could count an order twice.
The code it adds (simplified)
const order = await saveOrder(checkout) // Only runs after the order is saved. Errors are handled inside trackMetric. await trackMetric(process.env.UMLOGGER_CHECKOUTS_KEY, 1) return order
Result
You review the code and tests, add the key to your production secrets, and deploy. Your app now records checkouts, even when the AI isn’t running.
trackMetric is a small helper function that AI adds to your project. See how to send data.
Part 2: Investigate a drop
After tracking has been running for at least two weeks, you notice fewer checkouts. This part only needs read-only access.
4. Compare two weeks
You ask
“Use Umlogger to compare completed checkouts for November 15–21 and November 8–14, in UTC. Were there any deploys around the time they changed?”
What the skill says
Use exact dates, and compare totals because this is a count metric.
MCP calls and results (shortened)
query_metric({ "metric": "completed-checkouts", "from": "2026-11-15T00:00:00Z", "to": "2026-11-22T00:00:00Z", "resolution": "1d", "comparePrevious": true, "includeBuckets": false }) → { "summary": { "total": 63 }, "previous": { "total": 84 }, "change": { "totalPct": -25 } }Result
Checkouts fell from 84 to 63, a 25% drop.
5. Look for deploys
What the skill says
Look for notes in both weeks. Something that happened just before a drop is a clue, not proof that it caused it.
MCP calls and results (shortened)
list_annotations({ "metric": "completed-checkouts", "from": "2026-11-08T00:00:00Z", "to": "2026-11-22T00:00:00Z" }) → { "annotations": [ { "timestamp": "2026-11-15T09:00:00.000Z", "note": "Deployed v2.4" } ] }Result
Version 2.4 was deployed on the first day of the week with fewer checkouts. The annotation was added when it was deployed.
What a good answer looks like
“Completed checkouts fell 25%, from 84 on November 8–14 to 63 on November 15–21 (UTC). Version 2.4 was deployed on November 15 at 09:00 UTC. That timing is a clue, but it doesn't prove the deploy caused the drop. Next, check daily checkouts, checkout errors, traffic, and what changed in v2.4.”
Before you use it in your project
- Check every code change. The skill's instructions aren't security controls, and AI can make mistakes.
- Add the key to your production secrets. Saving it on your computer doesn't set up production.
- Your AI provider may receive your metric data and any keys your AI tool gets. Check its data policy.
- If you stop trusting an app that can get keys, disconnect it before replacing any keys it may have.