10000 Logging message is unrendered on a webhook call · Issue #3660 · getsentry/sentry-python · GitHub
[go: up one dir, main page]

Skip to content

Logging message is unrendered on a webhook call #3660

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

Closed
pohmelie opened this issue Oct 15, 2024 · 8 comments · Fixed by #4121
Closed

Logging message is unrendered on a webhook call #3660

pohmelie opened this issue Oct 15, 2024 · 8 comments · Fixed by #4121
Assignees

Comments

@pohmelie
Copy link

How do you use Sentry?

Self-hosted/on-premise

Version

2.9.0

Steps to Reproduce

We updated self hosted sentry to version 24.8.0 and after that logging integration do not render logging message. So we have a template in a sentry web-ui and webhook call instead of rendered message. For exampe:

logger.error("task for news source %s returned empty result %s", news_source, result)
logger.error(f"[debug] task for news source {news_source} returned empty result {result}")

This leads to 2 messages in sentry:

  • task for news source %s returned empty result %s
  • [debug] task for news source binance_api_changelog_spot returned empty result None

So, only force-rendered via f-string message is correct. Not sure if it is relative to sentry python sdk, or self-hosted sentry itself. Previous version 23.x.x was correct for this. More to say, some messages are rendered correctly. For example with %d. In the example above news_source is StrEnum and result is None.

Expected Result

Actual Result

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Oct 15, 2024
@sl0thentr0py
Copy link
Member

@pohmelie can you paste the output of this 'View Json' from one of those message events from your Sentry instance.

Image

I'm interested in what this logentry field looks like in your event payload.

Image

@pohmelie
Copy link
Author

@sl0thentr0py
This is all fields under logentry:
Image

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Oct 16, 2024
@szokeasaurusrex
Copy link
Member
szokeasaurusrex commented Oct 21, 2024

@pohmelie Would you be able to post the entire JSON? That would help me determine whether this problem originates in the SDK or the self-hosted backend.

FWIW, I was not able to reproduce this with the latest Sentry SDK version and SaaS Sentry.

@pohmelie
Copy link
Author

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Oct 23, 2024
@szokeasaurusrex
Copy link
Member

Thanks @pohmelie, the JSON would indeed suggest this is an SDK problem. Could you try upgrading to the latest version of Sentry SDK, and let me know whether that works?

@pohmelie
Copy link
Author

@szokeasaurusrex same with 2.17.0
sentry.json

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Oct 24, 2024
@szokeasaurusrex
Copy link
Member

Thanks for the info. I was able to reproduce the issue; seems like it only occurs when a non-str value is passed as one of the 2nd+ arguments to the logger call. For example:

# This is rendered correctly
logger.warning("%s", "None")

# This is not rendered
logger.warning("%s", None)

@szokeasaurusrex
Copy link
Member
szokeasaurusrex commented Oct 28, 2024

We will continue investigating; I am unsure whether this problem is occurring in the SDK or elsewhere in the pipeline

szokeasaurusrex added a commit that referenced this issue Apr 14, 2025
This reverts commit 4c9731b.

That commit caused a regression when `record.args` contains a dictionary. Because we iterate over `record.args`, that change caused us to only send the dictionary's keys, not the values.

A more robust fix for #3660 will be to send the formatted message in the [`formatted` field](https://develop.sentry.dev/sdk/data-model/event-payloads/message/) (which we have not been doing yet). I will open a follow-up PR to do this.

Fixes #4267
szokeasaurusrex added a commit that referenced this issue Apr 14, 2025
This reverts commit 4c9731b, adding tests to ensure the correct behavior going forward.

That commit caused a regression when `record.args` contains a dictionary. Because we iterate over `record.args`, that change caused us to only send the dictionary's keys, not the values.

A more robust fix for #3660 will be to send the formatted message in the [`formatted` field](https://develop.sentry.dev/sdk/data-model/event-payloads/message/) (which we have not been doing yet). I will open a follow-up PR to do this.

Fixes #4267
szokeasaurusrex added a commit that referenced this issue Apr 14, 2025
Send the formatted log event to Sentry in the [`formatted` field](https://develop.sentry.dev/sdk/data-model/event-payloads/message/).

This builds on #4291, providing a more robust fix for #3660.
szokeasaurusrex added a commit that referenced this issue Apr 15, 2025
Send the formatted log event to Sentry in the [`formatted` field](https://develop.sentry.dev/sdk/data-model/event-payloads/message/).

This builds on #4291, providing a more robust fix for #3660.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants
0