Laravel Rust New

Don't panic. Flare already caught it.

A failed checkout, a job that gives up, an unexpected unwrap. When your Laravel Rust app breaks, Flare tells you exactly which line failed and why, before your users notice.

10-day trial  ·  No credit card required

Built for Laravel Rust

Running Laravel on Rust? Flare reports your failed requests, jobs, scheduled tasks and workflows, with their Laravel context.

Add one service provider

Add the laravel feature of the flareapp crate and register the Flare service provider. Your routes, jobs and commands stay as they are. That's it.

// src/main.rs
fn main() -> std::process::ExitCode {
    laravel::Application::configure()
        .with_providers(|providers| {
            providers.add(flareapp::laravel::provider(
                flareapp::config!(),
            ));
        })
        .run()
}

Your whole Laravel app, traced

Set a sample rate and Flare shows every request with its queries, cache calls, mails and outgoing HTTP calls. Jobs and commands get their own lists, next to your routes and queries.

# .env
FLARE_KEY=YOUR-PRIVATE-KEY

# Sends 10% of your traces
FLARE_TRACES_SAMPLE_RATE=0.1

# Sends your info, warning and error log lines
FLARE_SEND_LOGS=info

Find the query that slows you down

Every query shows up in Flare without extra code, with how long it takes. A passenger search that takes 2.4 seconds stands out right away.

The queries list of titanic.app in Flare, with a 2.4 second passenger search at the top

Plain Rust works too

Not using Laravel? The flareapp crate works in any Rust app, from an Axum or Actix Web service to a command line tool or a queue worker.

Add Flare to your app

Add one attribute to main, and the Flare layer to your subscriber and your router. From then on, every panic on every thread is reported.

// src/main.rs
#[flareapp::main(traces_sample_rate = 0.1)]
#[tokio::main]
async fn main() {
    tracing_subscriber::registry()
        .with(flareapp::tracing::layer())
        .init();

    let app = Router::new()
        .route("/api/bookings", post(bookings::create))
        .layer(flareapp::tower::layer());

    // Serve the app as usual.
}

Works with your existing tracing code

The Flare Rust client builds on tracing, the crate most Rust apps already use for logs and timings. Every span, log line and query in this example shows up in Flare's Logs and Performance monitoring, without changing a line.

// Timed as "bookings::find_cabin" in your traces
#[tracing::instrument(skip(pool))]
async fn find_cabin(
    pool: &PgPool,
    id: i64,
) -> sqlx::Result<Cabin> {
    // Shows up as a log line, next to the request
    tracing::info!(cabin_id = id, "looking up cabin");

    // Shows up as a query, with how long it took
    sqlx::query_as("SELECT * FROM cabins WHERE id = $1")
        .bind(id)
        .fetch_one(pool)
        .await
}

Keep your exporter

Does your app already send OTLP? You don't have to use the Flare Rust SDK. You can just point your existing OTLP setup at Flare with your project key, and your spans show up as routes, queries and jobs.

# .env
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingress.flareapp.io
OTEL_EXPORTER_OTLP_HEADERS=x-api-token=YOUR-PRIVATE-KEY
OTEL_SERVICE_NAME=titanic

Works today

Support for the crates you already use

  • axum
  • actix-web
  • sqlx
  • tracing
  • log
  • reqwest
  • anyhow
  • OpenTelemetry

Frequently asked questions

Included with every Flare plan

Your next panic is already covered

Add the Flare client, set your key and deploy.

10-day trial · No credit card required