> ## Documentation Index
> Fetch the complete documentation index at: https://docs.siftstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started with streaming data to Sift using Rust

> Learn how to send live telemetry from a Rust application to Sift and view it in real time

## Overview

This tutorial shows how to stream telemetry from a Rust application to Sift using the [Sift Stream Rust library](https://crates.io/crates/sift_stream).
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](../../documentation/ingest/stream/organize-streamed-data-into-assets-and-runs), [Channels](../../documentation/reference/channels-reference), and [Runs](../../documentation/reference/runs-reference) relate to each other in Sift
* Working knowledge of Rust and familiarity with async programming
* A Sift [API key](../../documentation/manage/set-up-api-access) and your Sift [gRPC base URL](../../documentation/manage/set-up-api-access)

## 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:

```bash theme={null}
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:

```bash theme={null}
touch .env
```

```bash theme={null}
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:
   ```bash theme={null}
   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 <Icon icon="arrow-up-right-from-square" /> **Explore**.
5. Click <Icon icon="dot" /> **Live**.
6. In the <Icon icon="wave-pulse" /> **Channels** tab, select the following Channels:
   * <Icon icon="hashtag" /> **temperature**
   * <Icon icon="hashtag" /> **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.

<Steps>
  <Step title="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.
  </Step>

  <Step title="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`.
  </Step>

  <Step title="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.
  </Step>

  <Step title="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.
  </Step>
</Steps>

## 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.
