sentry-php icon indicating copy to clipboard operation
sentry-php copied to clipboard

Regex/glob support in prefixes configuration

Open indykoning opened this issue 2 months ago • 3 comments

Problem Statement

For our projects we use atomic/zero-downtime deployments, meaning the location of the code changes. E.g:

  • /path/to/project/releases/16
  • /path/to/project/releases/17
  • /path/to/project/releases/18

Right now this would require us to update the prefixes config every time

Solution Brainstorm

What would really help here would be to allow regexes in the prefix config, allowing us to go from

[
    'prefixes' => [
        '/path/to/project/releases/16'/,
        '/path/to/project/releases/17'/,
        '/path/to/project/releases/18/',
    ]
]

to

[
    'prefixes' => [
        '/path/to/project/releases/[0-9]+/', // regex
        '/path/to/project/releases/*/', // or Glob
    ]
]

(due to paths already starting and ending with /, implementing globs might be an easier solution)

indykoning avatar Oct 01 '25 08:10 indykoning

PHP-37

linear[bot] avatar Oct 01 '25 08:10 linear[bot]

Couldn't you fix this programmatically, by passing the current dir to Sentry when initializing it? Sentry-symfony does this by getting the project_dir parameter from the framework.

Jean85 avatar Oct 01 '25 09:10 Jean85

This should be able to be resolved at runtime, frameworks handle this by a project_dir helper or BASE_PATH constant or something similar. We'd rather not introduce advanced processing on this option that is uses quite a number of times during event processing.

stayallive avatar Nov 11 '25 08:11 stayallive