Giter VIP home page Giter VIP logo

Comments (11)

stayallive avatar stayallive commented on June 16, 2024 1

Regarding the dingo-api, I am uncertain about how Sentry captures events. If I extend the php artisan route:list command to make my routes appear, would this assist Sentry in capturing the correct routes without the need to set SENTRY_TRACE_MISSING_ROUTES_ENABLED?

No, that won't help. Sentry listens for the RouteMatched event fired by the Laravel router, dingo-api has a custom setup with their own router and do not fire that event nor set the route on the request ($request->route() always seems to be null) which is how we detect a route was matched and allow a parameterized transaction name (the {name} part of /hello/{name}), now you get the raw path from the URL which groups less nicely.

Additionally, does setting SENTRY_TRACE_MISSING_ROUTES_ENABLED=true increase performance quotas and application resource usage?

It increases performance quoatas of course but it won't have much impact unless you have a lot of calls to non-existent routes in your application since those will also be captured, normally we would only capture a transaction if a route exist for it to prevent search engines looking for URLs or hack script looking around consuming transactions. But the impact should be pretty low, but do keep an eye on it of course since its very specific to you and your application how large the impact is 😄

from sentry-laravel.

WinfredPeng2015 avatar WinfredPeng2015 commented on June 16, 2024 1

Thank you for the assistance. I will investigate the issue further and try to find a solution myself. Your information has been really helpful.

from sentry-laravel.

stayallive avatar stayallive commented on June 16, 2024

The logger option is not meant to be used in production and doesn't have any special handling to resolve it from the container or allow it to accept a callable. Maybe it's an idea to when you have the debug logger active not have config caching on? This way you can (temporarily) add the debug logger to your application and see what is going on?

However you have 2 issues here, the first is with the debug logger (which can be solved by using your own implementation of the logger interface for now, we will fix that to work in all PHP versions we support) but the other one is much more interesting.

You mention you are only showing 4 out of about 100 routes, does php artisan route:list also show that many routes (I am not a 100% certain Laravel 7 has that command but it's worth a try)?

In addition, how did you configure the sample rate for transactions? Is tracing_sample_rate set to 1.0? Can you maybe share a but more about how you configured those routes that are not showing up?

Did you end up using version 4.x of the Laravel SDK? I want to see if I can reproduce but knowing which version you are currently using will be very helpful and I would strongly recommend to always be using the most up-to-date Laravel SDK supporting your Laravel/PHP version combo (Laravel 7 and PHP 7.4 should be able to run the latest version no problem).

from sentry-laravel.

WinfredPeng2015 avatar WinfredPeng2015 commented on June 16, 2024

The logger option is not meant to be used in production and doesn't have any special handling to resolve it from the container or allow it to accept a callable.

I am currently using the logger option in my development environment, which is very similar to my production environment.

Maybe it's an idea to when you have the debug logger active not have config caching on?

Thank you for the suggestion, I will try this approach.

You mention you are only showing 4 out of about 100 routes, does php artisan route:list also show that many routes (I am not a 100% certain Laravel 7 has that command but it's worth a try)?
The original php artisan route:list showed exactly the number that sentry dashboard showed.

The original php artisan route:list command shows exactly the same number of routes as displayed on the Sentry dashboard.

I think you have pinpointed the real issue. We are using an API version control package called "dingo-api" (https://github.com/dingo/api). When using this package, routes only appear when using the php artisan api:routes command.

I am not sure how to deal with this issue, do you have any suggestions?

from sentry-laravel.

stayallive avatar stayallive commented on June 16, 2024

I have checked out that package a bit but I can't figure out a event or hook to get the custom router they are using. I'm guessing it's possible but they hi-jack the Laravel router and replace it with their own and do not fire any events and their middleware stack also runs before the route is matched... so I'm a bit at a loss, it also seems like the package is pretty inactive (even the fork) so I'm not sure if it's possible to correctly fix it at this point.

However what you can try is setting SENTRY_TRACE_MISSING_ROUTES_ENABLED=true in your .env assuming you are using 4.x of the Laravel SDK which might correctly record the routes but might also result in many duplicate routes because parameters are not considered because of the missing route data (so a /hello/{name} would normally be recorded but now it might be recorded as /hello/world and /hello/winfred etc.). Not a perfect solution but maybe good enough for now?

from sentry-laravel.

WinfredPeng2015 avatar WinfredPeng2015 commented on June 16, 2024

I tried the approach for missing routes, and it worked perfectly. Thank you for the tips.

Regarding the dingo-api, I am uncertain about how Sentry captures events. If I extend the php artisan route:list command to make my routes appear, would this assist Sentry in capturing the correct routes without the need to set SENTRY_TRACE_MISSING_ROUTES_ENABLED?

Additionally, does setting SENTRY_TRACE_MISSING_ROUTES_ENABLED=true increase performance quotas and application resource usage?

from sentry-laravel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.