Skip to content

[Idea] Possibility to exclude url path, not only views #64

@Patataman

Description

@Patataman

I wanted to use TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS = 'exclude' to track every view except the admin view, however it tracked too the requests for static files (which I don't want to track), creating a lot of entries in the database.

I tried to exclude it with

tracker.exclude("/static")

But when requesting static files, TrackUsage.before_request -> self.app.view_functions.get(ctx.request.endpoint)

view_func = self.app.view_functions.get(ctx.request.endpoint)
returns a lambda, which makes impossible (or at least I could find how to replicate) exclude those routes.

This could be very handy for semi-large/large applications where is faster just exclude 1 view than include all the other views.

I have seen that ctx.request.path returns the path (/, /static, /admin, etc), maybe checking both possibilities, views and routes could be a solution for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions