Skip to content

Fix for 'data' key in logger's extra#337

Merged
untitaker merged 3 commits into
getsentry:masterfrom
gagan-chawla:data-logging-fix
Apr 15, 2019
Merged

Fix for 'data' key in logger's extra#337
untitaker merged 3 commits into
getsentry:masterfrom
gagan-chawla:data-logging-fix

Conversation

@gagan-chawla

Copy link
Copy Markdown
Contributor

Fixes #336

@untitaker

Copy link
Copy Markdown
Member

Can we preserve the current behavior in this SDK? I feel like Raven's old behavior added an unnecessary layer of complexity (accessing data first), but maybe I am missing something.

I would've expected that you just remove the data key from the const.

@gagan-chawla

Copy link
Copy Markdown
Contributor Author

Can we preserve the current behavior in this SDK? I feel like Raven's old behavior added an unnecessary layer of complexity (accessing data first), but maybe I am missing something.

I would've expected that you just remove the data key from the const.

I thought of just removing data from COMMON_RECORD_ATTRS before, but keeping Raven's old behaviour in mind, this way we'd unwrap data dict before showing it in sentry's Additional Data section.

If we still wanna preserve the current behaviour, I guess removing data from constant also resolves the issue.

@untitaker

Copy link
Copy Markdown
Member

So what I want to understand is why you prefer Raven's behavior over sentry-sdk's behavior. I am open to either one, but we have to keep in mind that changing this behavior is a breaking change within sentry-sdk's version timeline.

@gagan-chawla

Copy link
Copy Markdown
Contributor Author

As I migrated from raven to new sentry-sdk, my projects stopped logging info as I was following old Raven's way to log additional data. This change is what I did to kinda cope with it.

I guess Raven did unwrapping of data to make it easier to integrate logger's components-
Since Raven provided two main extended functionalities to logging - 'extra' = {data: {...}, stack: True}, so it was convenient to maintain a data dict (that also performed unwrapping similar to 'extra') and to explicitly mention stack True when required, rather than adding stack key along with other data in a dict and pass it to 'extra' directly.

But as you mentioned earlier, exc_info is used for callstack in sentry-sdk, I think unwrapping data doesn't serve any purpose now. I'm inclined towards removing data from constant as well.

@untitaker

Copy link
Copy Markdown
Member

Good point. I agree and would prefer to keep sentry-sdk's current behavior wrt data unwrapping.

@untitaker
untitaker merged commit aba45f4 into getsentry:master Apr 15, 2019
@untitaker

Copy link
Copy Markdown
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Unified sentry-sdk integration does not have support to add stack trace in python logger using 'stack': True in extra dict.

2 participants