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

feat(ourlogs): Preliminary breadcrumb to log conversion #4479

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

Conversation

k-fish
Copy link
Member

@k-fish k-fish commented Jan 30, 2025

Summary

This converts breadcrumbs in a fairly simplistic way into our log format, behind a sample-rate to mitigate load when rolling this out (and also the existing enable flag).

Screenshot 2025-01-30 at 1 05 19 AM

Other:

  • Deduplication is handled on the sdk side when sending in breadcrumbs, signaled by a bool in a context on the event. Breadcrumbs that exist outside an event will be handled in a separate PR.

Needs:

Related:

This converts breadcrumbs in a fairly simplistic way into our log
format, behind a sample-rate to mitigate load when rolling this out (and also the existing enable flag).
@k-fish k-fish self-assigned this Jan 30, 2025
@k-fish k-fish requested a review from a team as a code owner January 30, 2025 06:04
@k-fish k-fish force-pushed the feat/ourlogs/convert-breadcrumbs-to-logs branch from e07396f to b678b22 Compare January 30, 2025 06:11
relay-ourlogs/src/ourlog.rs Outdated Show resolved Hide resolved
Copy link
Member

@Dav1dde Dav1dde left a comment

Choose a reason for hiding this comment

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

This will generate an almost infinite amount of duplicate log entries.

Breadcrumbs are not cleared for event emissions, every event can and will contain the same log lines.

Worst case on every error you receive, you extract the same 100 log lines. That's a pretty bad amplification vector.

relay-server/src/services/processor/event.rs Outdated Show resolved Hide resolved
relay-server/src/services/processor/event.rs Outdated Show resolved Hide resolved
relay-ourlogs/src/ourlog.rs Outdated Show resolved Hide resolved
relay-ourlogs/src/ourlog.rs Outdated Show resolved Hide resolved
relay-ourlogs/src/ourlog.rs Outdated Show resolved Hide resolved
relay-server/src/envelope.rs Outdated Show resolved Hide resolved
relay-config/src/config.rs Outdated Show resolved Hide resolved
relay-ourlogs/src/ourlog.rs Outdated Show resolved Hide resolved
relay-ourlogs/src/ourlog.rs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
relay-ourlogs/src/ourlog.rs Outdated Show resolved Hide resolved
relay-server/src/services/processor/event.rs Outdated Show resolved Hide resolved
relay-server/src/envelope.rs Outdated Show resolved Hide resolved
relay-server/src/services/processor/event.rs Outdated Show resolved Hide resolved
relay-ourlogs/src/ourlog.rs Outdated Show resolved Hide resolved
@k-fish
Copy link
Member Author

k-fish commented Jan 30, 2025

This will generate an almost infinite amount of duplicate log entries.

Assuming this were to be enabled in prod, yes. Fortunately we're only enabling it for a specific project on s4s at this time. (project flag incoming). More generally, deduplication will be handled by an experimental sdk flag that send the events here.

Noted though, we don't want a flood in the off chance of a bad sdk setup, so we should guard against others sending here so I'll update it to block if a context value isn't found.

Comment on lines +96 to +97
#[metastructure(tag = "sentry_logs")]
OurLogs(Box<OurLogsContext>),
Copy link
Member Author

Choose a reason for hiding this comment

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

Are these hard to remove later or is the deprecation sticky? If they are I'm probably going to delay this a week until Abhi is back and we can make sure everyone is fine with the context on the sdk side.

Copy link
Member

Choose a reason for hiding this comment

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

Removing the variant from the code is not a problem. After removing it, relay will still forward the context as if it were a user-defined context.

Copy link
Member Author

Choose a reason for hiding this comment

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

Great

Comment on lines +96 to +97
#[metastructure(tag = "sentry_logs")]
OurLogs(Box<OurLogsContext>),
Copy link
Member

Choose a reason for hiding this comment

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

Removing the variant from the code is not a problem. After removing it, relay will still forward the context as if it were a user-defined context.

relay-server/src/services/processor.rs Outdated Show resolved Hide resolved
relay-server/src/services/processor.rs Outdated Show resolved Hide resolved
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.

3 participants