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

chore(replay): add a log sampling filter and sample replay ingest logs #79879

Closed
wants to merge 5 commits into from

Conversation

aliu39
Copy link
Member

@aliu39 aliu39 commented Oct 29, 2024

@aliu39 aliu39 requested a review from a team as a code owner October 29, 2024 00:31
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 29, 2024
@@ -24,7 +25,18 @@
from sentry.utils import json, metrics
from sentry.utils.outcomes import Outcome, track_outcome

MOBILE_EVENT_SAMPLE_RATE = 0.5
Copy link
Member Author

@aliu39 aliu39 Oct 29, 2024

Choose a reason for hiding this comment

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

Sample rates defined here, can make them options if we want. Values right now are placeholders

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #79879      +/-   ##
==========================================
- Coverage   78.45%   78.34%   -0.12%     
==========================================
  Files        7144     7144              
  Lines      316041   316057      +16     
  Branches    43546    43547       +1     
==========================================
- Hits       247951   247614     -337     
- Misses      61764    62100     +336     
- Partials     6326     6343      +17     


def __init__(self, prob_mapping: dict[str, float]):
super().__init__()
self.prob_mapping = prob_mapping
Copy link
Member

Choose a reason for hiding this comment

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

Don't abbreviate. probability_map or probability_mapping.

logger.addFilter(
SamplingFilter(
{
"mobile_event": MOBILE_EVENT_SAMPLE_RATE,
Copy link
Member

Choose a reason for hiding this comment

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

Why is this different from the other consumer?

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 you suggesting we add rrweb_event_count here too? It's not currently logged in this file

Copy link
Member

Choose a reason for hiding this comment

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

No just asking the question. If we're not logging it we don't need to include it.

Copy link
Member Author

Choose a reason for hiding this comment

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

We're only logging mobile_event in this one

Comment on lines +35 to +36
"mobile_event": MOBILE_EVENT_SAMPLE_RATE,
"rrweb_event_count": RRWEB_EVENT_COUNT_SAMPLE_RATE,
Copy link
Member

Choose a reason for hiding this comment

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

Are either of these log messages emitted in our consumer?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean a different file?

Copy link
Member

Choose a reason for hiding this comment

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

What does "mobile_event" represent? The log message?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just realized I was looking at the event_type in extras. The msg is sentry.replays.slow_click. I'll have to rethink this

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we want different rates for these, or could we sample all slow click logs at the same rate for now?

Copy link
Member

Choose a reason for hiding this comment

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

Same rate is fine.

Copy link
Member

Choose a reason for hiding this comment

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

Can you access the extra field within your sampler class?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can. The filter will become specific to our usecase though, so I'd move it into the init file

@@ -24,7 +25,18 @@
from sentry.utils import json, metrics
from sentry.utils.outcomes import Outcome, track_outcome

MOBILE_EVENT_SAMPLE_RATE = 0.5
Copy link
Member

Choose a reason for hiding this comment

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

Let's make this an option.

@getsantry
Copy link
Contributor

getsantry bot commented Nov 20, 2024

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label Nov 20, 2024
@JoshFerge
Copy link
Member

@cmanallen @aliu39 need any help w/ this? :D

@getsantry getsantry bot removed the Stale label Nov 21, 2024
@cmanallen
Copy link
Member

@JoshFerge Andrew and I are on PTO until next week. You're welcome to help out! I'll take a peak at this tomorrow or Wednesday and review it for you (if you make any changes)!

@aliu39
Copy link
Member Author

aliu39 commented Dec 2, 2024

IIRC here was a reason Colton blocked this that we forgot to document here. Last we talked we were thinking of trying a whole different approach

@JoshFerge
Copy link
Member

okay! i was thinking we could just sample 1% of logs. is there any reason that doesn't work?

@aliu39
Copy link
Member Author

aliu39 commented Dec 3, 2024

cc @cmanallen
Sorry - I completely forgot our discussion 😥.

i was thinking we could just sample 1% of logs. is there any reason that doesn't work?

@JoshFerge That seems fine to me but wanted to loop in Colton on this. FF is launching tomorrow, I'll follow up after and try to close this by the end of the week.

@getsantry
Copy link
Contributor

getsantry bot commented Dec 25, 2024

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added Stale and removed Stale labels Dec 25, 2024
@aliu39
Copy link
Member Author

aliu39 commented Dec 26, 2024

Sorry this got lost.. since this is tracked in the ticket, I'll close, and we can revisit after holidays

@aliu39 aliu39 closed this Dec 26, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants