Send telemetry from your code
Monitor already reads every canister’s health, cycles and memory. To see what your app is doing, such as queue depth, failed payments or slow requests, send your own telemetry. It lands next to Monitor’s data, in the same charts, dashboards and alerts.
Pick what to send
Section titled “Pick what to send”| You want | Send | Guide |
|---|---|---|
| Numbers over time: counts, sizes, durations | Metrics | Motoko · Rust |
| Searchable, structured lines | Logs | Logs from your code |
| One request followed across canisters | Traces | Traces from your code |
| Metrics from an app that already uses OpenTelemetry | Metrics | OpenTelemetry metrics |
How it works
Section titled “How it works”-
Add your canister as a sender of the right data connection: Telemetry › Data connections, then Senders › Add a sender. You need to be an Admin.
-
Add the client library to your canister. The sender’s guide in icLens shows the exact setup for that canister.
-
Check it arrives. The sender shows Receiving, and your metric appears in Telemetry › Metrics.
The client libraries ship with icLens’s source. They aren’t on Mops or crates.io yet, so vendor them into your project.
Choose good metrics
Section titled “Choose good metrics”Start with three or four that answer a real question:
| Question | Metric |
|---|---|
| Is work piling up? | A gauge of queue depth |
| Is work finishing? | A counter of completed jobs, split by outcome |
| How long does it take? | A histogram of durations |
Keep labels to small, fixed sets, such as operation or outcome. Never put user IDs, request IDs or secrets in labels.
Good to know
Section titled “Good to know”- Your metrics can’t pose as Monitor’s: the Agent marks where every value came from.
- If a send times out, the client keeps the batch and checks before sending again. Data is never sent twice or silently dropped.
- The exact methods and types are in the SDK APIs reference.