Skip to content

Introduce Sentry.capture_log #2606

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Introduce Sentry.capture_log #2606

wants to merge 5 commits into from

Conversation

solnic
Copy link
Collaborator

@solnic solnic commented Apr 25, 2025

First step towards Structured Logging #2600

This adds Sentry.capture_log interface with a new underlying LogEvent event type.

Closes #2603

@solnic solnic linked an issue Apr 25, 2025 that may be closed by this pull request
@solnic solnic mentioned this pull request Apr 25, 2025
4 tasks
@solnic solnic force-pushed the 2603-introduce-logevent branch 3 times, most recently from 43abb90 to 6ae5bef Compare April 29, 2025 13:45
@solnic solnic force-pushed the 2603-introduce-logevent branch from ca4d04c to be910c4 Compare April 30, 2025 12:13
@solnic solnic marked this pull request as ready for review April 30, 2025 13:23
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid! Just one comment about the client method, and then we are good to ✅

Before we move on to the logger interface though (#2604), can we spec out a buffering implementation for logs? We can do it after this PR and create another issue to track it so that we contain the scope of this particular set of changes.

https://develop.sentry.dev/sdk/telemetry/logs/#implementation

It would be nice to get a lightweight logs buffer so that we don't overwhelm sentry with requests, logs were designed so you can send multiple log payloads in a single log envelope.

@@ -167,6 +168,20 @@ def event_from_check_in(
)
end

# Initializes a LogEvent object with the given message and options
def event_from_log(message, level:, **options)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to add processing to add default attributes to logs here? Like for environment, release, sdk name, sdk version, and parent span id?

We can grab environment, release, and sdk info from the client, but parent span id maybe we can only attach from the logger API calls (not super familiar with the tracing impl in the ruby sdk).

https://develop.sentry.dev/sdk/telemetry/logs/#default-attributes

@solnic solnic mentioned this pull request Apr 30, 2025
@solnic
Copy link
Collaborator Author

solnic commented Apr 30, 2025

Before we move on to the logger interface though (#2604), can we spec out a buffering implementation for logs?

@AbhiPrasad yes this makes sense, I reported #2613 :)

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.

Introduce LogEvent
2 participants