Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sentry-tracing: Fields prefixed with tags. are not sent as tags within spans #653

Open
DoumanAsh opened this issue Apr 12, 2024 · 0 comments

Comments

@DoumanAsh
Copy link

Environment

What version are you running? Etc.

0.32.2

Steps to Reproduce

  1. Create tracing span:
tracing::span!(
    tracing::level::INFO
    "request",
    tags.http.url = field::Empty,
    tags.protocol = field::Empty,
    tags.request_id = field::Empty,
    user_agent = field::Empty,
    tags.http.method = field::Empty,
    tags.http.status_code = field::Empty,
)
  1. For the duration of requests, these fields will be filled with data
  2. Unfortunately when I open sentry to see event, it shows no tags and instead all fields are sent as Additional Data

I see in code how it checks for tags presence

fn tags_from_event(fields: &mut BTreeMap<String, Value>) -> BTreeMap<String, String> {
let mut tags = BTreeMap::new();
fields.retain(|key, value| {
let Some(key) = key.strip_prefix("tags.") else {
return true;
};
let string = match value {
Value::Bool(b) => b.to_string(),
Value::Number(n) => n.to_string(),
Value::String(s) => std::mem::take(s),
// remove null entries since empty tags are not allowed
Value::Null => return false,
// keep entries that cannot be represented as simple string
Value::Array(_) | Value::Object(_) => return true,
};
tags.insert(key.to_owned(), string);
false
});
tags
}

But it seems not to be applied to transactions?

Expected Result

See tags in sentry

Actual Result

Fields are sent as additional data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant