Skip to main content

Overview

This tutorial shows how to stream telemetry from a Rust application to Sift using the Sift Stream Rust library. You will install the library, configure authentication, define telemetry signals, and send time-series data to Sift from a Rust application.

Prerequisites

  • Basic understanding of how Assets, Channels, and Runs relate to each other in Sift
  • Working knowledge of Rust and familiarity with async programming
  • A Sift API key and your Sift gRPC base URL

Scenario

Imagine a robotic vehicle that continuously reports telemetry during operation. The vehicle produces two signals: its current velocity and its internal temperature. In this tutorial, a Rust application simulates this system by generating measurements every 0.5 seconds and streaming them to Sift.

Step 1: Obtain the Rust example project

Clone the Sift repository and navigate to the sift_stream crate directory, which contains the Cargo.toml file for the streaming client library and the Rust example used in this tutorial:
git clone https://github.com/sift-stack/sift.git
cd sift/rust/crates/sift_stream

Step 2: Configure authentication

Create a .env file so the Rust example can authenticate with your Sift environment. Add your Sift API key and gRPC URL as environment variables:
touch .env
SIFT_API_KEY=your_api_key_here
SIFT_GRPC_URL=https://your-grpc-url

Step 3: Run the application and view streamed data in Sift

Run the Rust example to start streaming telemetry to Sift. The example runs for about 10 minutes before stopping automatically.
  1. From the sift_stream directory (the folder containing Cargo.toml), run the example:
    cargo run --example ingestion-tutorial
    
  2. Check the terminal for the generated Run name (for example, robot_vehicle_…_run). Then, in Sift, locate the Run name or description field and enter that name.
  3. In the Runs table, click the Run name.
  4. Click Explore.
  5. Click Live.
  6. In the Channels tab, select the following Channels:
    • temperature
    • velocity

Step 4: Understand the ingestion workflow

The ingestion process follows a sequence that defines the telemetry structure, establishes an ingestion session, and streams timestamped data to Sift.
1

Authentication and streaming client initialization

  • The application begins by loading authentication credentials from the .env file using dotenvy. These values are used to create a Credentials configuration that allows the client to authenticate with your Sift environment.
  • A streaming client is then initialized using SiftStreamBuilder, which establishes the ingestion connection and prepares the client to send telemetry.
2

Telemetry schema definition

  • Telemetry sent to Sift must follow a defined schema. In this example, a FlowConfig defines the telemetry structure, and each ChannelConfig represents an individual signal.
  • Two Channels are defined: velocity and temperature. These Channels are grouped together within a Flow named vehicle_metrics.
3

Ingestion context setup

  • An IngestionConfigForm associates the telemetry schema with an Asset and a unique client key. A RunForm then defines the session that groups incoming telemetry.
  • The Run is created as part of the same streaming ingestion session initialized by SiftStreamBuilder. This means the Run is established on the same connection used to send telemetry data.
4

Timestamped telemetry streaming

  • Once the ingestion context is established, the application begins generating mock telemetry values and sending them to Sift using sift_stream.send(). Each message is sent as a Flow containing:
    • a timestamp
    • the Flow name
    • values for each Channel
  • After the loop completes, the program calls finish() to ensure any queued telemetry is transmitted before the streaming session closes.

Conclusion

In this tutorial, you streamed telemetry from a Rust application to Sift using the Sift Stream Rust library. You configured authentication, defined telemetry signals, and sent timestamped data to Sift in real time. You also viewed the live telemetry in Sift to understand how streamed data appears during ingestion.