feat(clients): support project_slug and gitea_repo routing metadata
Extend official Node/PHP reporter clients to attach optional project routing metadata (`project_name`, `project_slug`, `gitea_repo`) via env/options so product repos can emit deterministic ERRSIG routing context at source.
This commit is contained in:
1 parent
6ea0dce549
commit
ba7a971bc1
3 files changed
+49
-3
No files matched your search
@@ -44,6 +44,22 @@ final class ErrorReporter
|
||||
return self::env('ERROR_REPORTING_TOKEN');
|
||||
}
|
||||
|
||||
|
||||
private static function projectName(): string
|
||||
{
|
||||
return self::env('ERROR_REPORTING_PROJECT_NAME');
|
||||
}
|
||||
|
||||
private static function projectSlug(): string
|
||||
{
|
||||
return self::env('ERROR_REPORTING_PROJECT_SLUG');
|
||||
}
|
||||
|
||||
private static function giteaRepo(): string
|
||||
{
|
||||
return self::env('ERROR_REPORTING_GITEA_REPO');
|
||||
}
|
||||
|
||||
private static function env(string $key): string
|
||||
{
|
||||
$v = getenv($key);
|
||||
@@ -130,6 +146,9 @@ final class ErrorReporter
|
||||
'request_uri' => $_SERVER['REQUEST_URI'] ?? null,
|
||||
'http_method' => $_SERVER['REQUEST_METHOD'] ?? null,
|
||||
'ip_address' => $_SERVER['REMOTE_ADDR'] ?? null,
|
||||
'project_name' => self::projectName() !== '' ? self::projectName() : null,
|
||||
'project_slug' => self::projectSlug() !== '' ? self::projectSlug() : null,
|
||||
'gitea_repo' => self::giteaRepo() !== '' ? self::giteaRepo() : null,
|
||||
], $context);
|
||||
|
||||
// Remove null values
|
||||
|
||||
Reference in new issue
Block a user