sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Logging message is unrendered on a webhook call

Open pohmelie opened this issue 1 year ago • 3 comments

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

pohmelie avatar Oct 15 '24 17:10 pohmelie

@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

sl0thentr0py avatar Oct 16 '24 13:10 sl0thentr0py

@sl0thentr0py This is all fields under logentry: Image

pohmelie avatar Oct 16 '24 16:10 pohmelie

@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.

szokeasaurusrex avatar Oct 21 '24 11:10 szokeasaurusrex

@szokeasaurusrex sentry.json

pohmelie avatar Oct 23 '24 14:10 pohmelie

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?

szokeasaurusrex avatar Oct 23 '24 14:10 szokeasaurusrex

@szokeasaurusrex same with 2.17.0 sentry.json

pohmelie avatar Oct 24 '24 14:10 pohmelie

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 avatar Oct 28 '24 10:10 szokeasaurusrex

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

szokeasaurusrex avatar Oct 28 '24 10:10 szokeasaurusrex