Skip to content

tracing::span "message" field should NOT be empty during span creation #880

@georgeboot

Description

@georgeboot

This issue (strongly) relates to #879

How do you use Sentry?

Sentry SaaS (sentry.io)

SDK version

0.42.0

Steps to reproduce

#[tracing::instrument(name = "http.client", skip_all, fields(
    message = tracing::field::Empty,
    http.response.status_code = tracing::field::Empty,
))]
async fn do_expensive_operation(webhook_request: Request) {
    let url = webhook_request.url();
    let http_endpoint = &url[..url::Position::AfterPath];
    let method = request.method().as_str();
    let message = format!("{method} {http_endpoint}");
    
    let current_span = Span::current();
    
    // set the message
    current_span.record("message", &message);
    
    let response = my_http_client.execute(request).await;
   
    // record status_code
    current_span.record("http.response.status_code", response.status().as_u16());
}

Expected result

A sentry span gets created with these fields:

{
  "op": "http.client",
  "description": "GET https://google.com",
  "data": {
    "http.response.status_code": 200
  }
}

Actual result

A span was created with these fields:

{
  "op": "http.client",
  "description": "my_module::path::http.client", // this is unexpected!
  "data": {
    "message": "GET https://google.com",
    "http.response.status_code": 200
  }
}

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingRustSDK

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions