I’m using Sentry in JS application (web extension) to track the errors. Now i’d like to have some log of the events that happened before the error, so i’ve added scope.captureMessage()
calls every here and there.
I have a “beforeSend” callback can see not all the messages are sent. Is it because of sample rate applied to messages too?
Here is the initialization code:
const manifest = browser.runtime.getManifest();
// filter integrations that use the global variable
const integrations = getDefaultIntegrations({}).filter(
(defaultIntegration: { name: string }) => {
return ![
"BrowserApiErrors",
"TryCatch",
"Breadcrumbs",
"GlobalHandlers"
].includes(defaultIntegration.name);
}
);
const client = new BrowserClient({
dsn,
environment,
release: info.addonVersion,
transport: makeFetchTransport,
stackParser: defaultStackParser,
initialScope: {
tags: {
manifestVersion: manifest.manifest_version
}
},
integrations,
sampleRate: sampleRate ?? 0.01,
beforeSend(event) {
console.warn("Event", event);
lastEvent = event;
return event;
}
});
scope = new Scope();
scope.setClient(client);
client.init();
Here is how i send the messages:
scope.captureMessage(message);
Only few messages are actually sent:
How can one pass all the messages? Is it possible to set some “messages sample rate” to 1? Is it possible to send the messages only if specific error happens (to reduce the traffic)? Are Sentry messages limited with any quotas or cost per amount?