To get started, you’ll need a Better Stack account. If you don’t have one, you can sign up here.

Add a telemetry source in Better Stack

Click on the Sources section, then Connect Source.

Once you’ve chosen a name for your new telemetry source, click the OpenTelemetry option in the “platform” section:

Then, scroll all the way to the bottom of the page and hit the “connect source” button.

Configure a Shuttle project

Locate the source token and ingestion host on the Source configuration page (click on a field to copy the value).

Next, navigate to your Shuttle project you want to enable telemetry for in the Shuttle Console, then the “Telemetry” tab, then click to enable Better Stack. Paste your source token and ingestion host, then click “Apply”.

Reminder: If your project was already running when you clicked “Apply”, you’ll need to redeploy it before telemetry will start to flow. This is easiest to do by selecting the latest deployment and clicking “Redeploy”.

Configure the runtime telemetry exporter

The Shuttle runtime by default sets up a tracing_subscriber that prints logs to stdout. To enable exporting telemetry and metrics, add the setup-otel-exporter feature to shuttle-runtime. You can do this by running the following command:

cargo add shuttle-runtime -F setup-otel-exporter

When done, your dependency should look something like this:

Cargo.toml
shuttle-runtime = { version = "0.53.0", features = ["setup-otel-exporter"] }

Create dashboards from OTel data

When the exporter is working and Better Stack starts receiving data, we can create some dashboards. In the Dashboards section, a new dashboard will have been created for you automatically.

The dashboard will have some default widgets that will likely show “empty” (they’re generic and assume the metrics being visualized are actually the internal metrics of an OpenTelemetry collector instance, which your project is obviously not 😅).

Click the dots, then Configure, to edit a widget. The default view for configuring widgets is SQL, but Better Stack also offers:

To get started, we’re showing how to use the drag-and-drop interface to create a graph of CPU usage by adding in cpu_usage_vcpu against our project name. We’ve also set the Y axis to use “vCPU” as the unit.