Skip to content

Integration for shelf #3586

@shaakunuigurumi

Description

@shaakunuigurumi

@buenaflor: if you are interested please upvote the issue 👍

Problem Statement

Dart started as a web-first language, while not the top backend or frontend language, it still has an ecosystem of packages allowing to use Dart as a backend for SSR or similar. Without any integration, every error occurring would be caught by the Router from shelf, not even reaching the default Sentry Dart SDK (except if createMiddleware was used to manually forward the errors to Sentry).

Solution Brainstorm

I already wrote a single sentry_shelf.dart file but it definitely is not of the quality standard like the other maintained integrations. (I tried my best researching existing SDKs but it is not entirely clear what the best practices are and what data can be sent in which format -- one pain point is the inability to set SentryRequest on a span, requiring me to use an EventTransformer on a scope).

The end result would be a addMiddleware(sentryMiddleware()).

Benefits of a proper shelf integration would be: tracing spans, parsing and sending back Sentry baggage headers, user IPs, etc. pp.

It would be a great question whether further integration with other shelf-ecosystem packages would be warranted.

I toyed around with integrating shelf_router, but they do not natively support extending or hooking-in, requiring me to shadow the class with an identical API (typedef for Router would be beneficial for shelf_router_generator). If we pull off router integration, we perhaps can also associate requests to their correct routes -- removing ID/parameter placeholders when submitting to Sentry.

Are you willing to submit a PR?

Yes

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions