Skip to main content
Set the reporting interval on your iroh-services client to control how often your endpoint sends metrics. The default interval is 60 seconds. Start with the Iroh Services quickstart to create your preset and endpoint with a project API key.

Choose an interval

Import Duration in your Rust application:
Choose one of these values:

Configure the client

In your async application code, replace the quickstart’s client construction with the following. Use the preset and endpoint you already created:
Keep the client and async runtime alive for as long as you want to send metrics. Dropping the client stops its background tasks. The client sends an initial report at startup, then reports at the configured interval. Daily reporting repeats every 24 hours while the client runs. It does not align reports to midnight, and restarting the client starts a new schedule. This interval applies to the endpoint metrics and any custom metrics groups registered on the client. Choose a shorter interval when you need more frequent updates in the dashboard.

Send a report before the next interval

To send the current metrics immediately, await push_metrics():
This sends an extra report without changing the automatic interval. For API details, see ClientBuilder::metrics_interval and Client::push_metrics.