Open denrase opened 3 months ago
@buenaflor I created this issue as we only talked in Discord about this. Is this still correct and something we want to do?
Yep, the most simplest way is to tell users to modify the abs path of the stackframes in beforeSend
to add the prefix themselves. or we can add an integration like javascript for rewriting frames which is syntactically nicer: https://docs.sentry.io/platforms/javascript/configuration/integrations/rewriteframes/
I think we're fine in just adding the guide to configure it like so :
beforeSendCallback: (event, hint) async {
final exceptions = event.exceptions?.map((exception) {
final stackTrace = exception.stackTrace;
if (stackTrace != null) {
final frames = stackTrace.frames.map((frame) {
const baseUrl = 'https://example.com/';
final modifiedAbsPath = frame.absPath?.replaceFirst(baseUrl, '${baseUrl}my_prefix/');
return frame.copyWith(absPath: modifiedAbsPath);
}).toList();
return exception.copyWith(stackTrace: SentryStackTrace(frames: frames));
}
return exception;
}).toList() ?? [];
return event.copyWith(exceptions: exceptions);
});
a specific rewrite frames integration is overkill for now
Added to docs: https://github.com/getsentry/sentry-docs/pull/10470
We could also add the sample in the sentry-dart-plugin
We could also add the sample in the sentry-dart-plugin
let's do that
We could add a rewrite frames integration similar to javascript that allows users to manipulate the frames in a specific way before sending them off.
Examples of what it would solve
Relates to https://github.com/getsentry/sentry-dart-plugin/pull/222
When users provide a
urlPrefix
withsentry-dart-plugin
andsentry-cli
, stack traces are not resolved correctly, as the path cant be found.the stack trace abs path is
"http://localhost: 8900/main.dart
. the uploaded file is~/foo/main.dart
-> doesn't matchso you would need to rewrite the abs_path to the uploaded file to include the prefix.
With a rewrite frame integration it would be easy to do that.
Alternatives
Use beforeSend code snippet
Demand
Please upvote if you are interested in such an integration