Skip to content

Actix route_match is not a good source for the transaction name. #540

@wuerges

Description

@wuerges

Environment

The bug shows up in master.
This PR is an atempt to fix the issue: #539

Steps to Reproduce

I created a server that has 2 routes with the same path, but one is a GET, and the other is a POST.
I've used sentry_actix::Sentry::with_transaction() to create the sentry transaction from the Actix requests.

#[get("/")]
async fn testing_traces_get(_req: HttpRequest) -> Result<String, Error> {
    generate_traces();
    Ok("GET".into())
}

#[post("/")]
async fn testing_traces_post(_req: HttpRequest) -> Result<String, Error> {
    generate_traces();
    Ok("POST".into())
}

async fn pure_sentry_solution() -> io::Result<()> {
    HttpServer::new(|| {
        App::new()
            .wrap(sentry_actix::Sentry::with_transaction())
            .service(testing_traces_get)
            .service(testing_traces_post)
    })
    .bind("127.0.0.1:3001")?
    .run()
    .await
}


#[tokio::main]

async fn main() -> io::Result<()> {
    let _guard = sentry_init();
    tracing_subscriber_init();

    pure_sentry_solution().await
}

Expected Result

Sentry would show two transactions, one for each endpoint: testing_traces_get and testing_traces_set.

Actual Result

Sentry shows two transactions, with the same name: testing_traces_get:

image

The PR mentioned above fixed the issue:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions