Open bensheldon opened 1 month ago
Hi @bensheldon !
What an incredible library. Thanks for bringing it over to the Rails world.
FWIW: I'm handling this over in my application by conditionally dialing back the amount of event information being reported. There are a lot of options here, but for starters:
# events_controller.rb
def index
@config_object = if current_user.watch_like_a_hawk?
{}
else
{
blockSelector: "html *",
sampling: {
mousemove: false,
mouseInteraction: false,
scroll: 10000,
media: 10000,
input: false
}
}
end
end
And then in my index.js.erb
:
if (!this.stopRrwebCallback) {
const functionObj = {
emit: this.events.add.bind(this.events)
}
const configObj = <%= @config_object.to_json.html_safe %>;
const combinedObj = {
...functionObj,
...configObj,
};
this.stopRrwebCallback = rrwebRecord(combinedObj);
}
And the typical event_data
payload goes down to:
{"data": {"x": 0, "y": 0, "id": 1, "source": 3}, "type": 3, "timestamp": 1729948909322}
Which is good by itself, but if you also conditionally increase POST_INTERVAL_SECONDS
as well: really cuts down on the data storage size.
I've been using Spectator Sport on one website. These are the numbers:
Which looks like this in the database: