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

Expose span fields through FieldVisitor #544

Open
yuanluna opened this issue Feb 3, 2023 · 8 comments
Open

Expose span fields through FieldVisitor #544

yuanluna opened this issue Feb 3, 2023 · 8 comments
Assignees

Comments

@yuanluna
Copy link

yuanluna commented Feb 3, 2023

Hi,
in Sentry we define the FieldVisitor here in the extract_span_data, and used it here in the on_new_span for the sentry layer, the data of the tracing span is directly written into sentry Span, which does not expose these data at all. Can we make this customizable to be able to read certain data from span?

Thank you!

@yuanluna
Copy link
Author

yuanluna commented Feb 3, 2023

@loewenheim Hi, thanks for responding quickly! Do you think it is possible to simply bump extract_span_data to public? or to quickly add some getters for the inner data of sentry_span? Thanks!

@loewenheim
Copy link
Contributor

For your use case, is it sufficient to get access to the data individually by key or do you need to be able to see the whole map at once?

@loewenheim loewenheim self-assigned this Feb 6, 2023
@loewenheim
Copy link
Contributor

I have devised a solution, would this work for you? #548

@yuanluna
Copy link
Author

yuanluna commented Feb 6, 2023

Hi @loewenheim thank you so much for such a quick change!! Yes I would love to access the data through key. A quick dumb question: what's the best way of getting this span in the event_mapping filter on sentry layer? Thank you!

@yuanluna
Copy link
Author

yuanluna commented Feb 9, 2023

Hi @loewenheim following up my question above. I am trying to fetch the sentry span in eventMapper, where I can only get the SpanRef, I thought the sentry span should be inside extension, but it is not. Can you help to understand the correct way to do it? Thanks a lot!!

@loewenheim
Copy link
Contributor

I'll get back to you as soon as I can.

@loewenheim
Copy link
Contributor

I think I have to pass this on to one of my colleagues. @Swatinem or @jan-auer, can you weigh in?

@Swatinem
Copy link
Member

So you are trying to access the current span from within the configured event_mapper? https://docs.rs/sentry/latest/sentry/integrations/tracing/struct.SentryLayer.html#method.event_mapper

I don’t think there is a straight forward way right now. You can maybe use a configure_scope call to get the current span/transaction:

if let Some(span) = sentry::configure_scope(|scope| scope.get_span()) {
  // ...
}

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

No branches or pull requests

3 participants