TenantOperationalMetricsService
in package
FinalYes
Stores bounded, privacy-safe hourly tenant request aggregates.
Table of Contents
Constants
- DEFAULT_RETENTION_DAYS : mixed = 90
- DEFAULT_SLOW_REQUEST_MS : mixed = 1000
Properties
- $platform : Connection
- $slowRequestMs : int
Methods
- __construct() : mixed
- Constructor.
- prune() : int
- Remove aggregates older than the retention window.
- record() : void
- Add a request to its privacy-safe hourly aggregate.
- metricHour() : string
- Normalize a timestamp to its UTC hour bucket.
- normalizeRouteName() : string
- Reduce a route to a bounded, non-parameterized identifier.
Constants
DEFAULT_RETENTION_DAYS
public
mixed
DEFAULT_RETENTION_DAYS
= 90
DEFAULT_SLOW_REQUEST_MS
public
mixed
DEFAULT_SLOW_REQUEST_MS
= 1000
Properties
$platform read-only
private
Connection
$platform
$slowRequestMs read-only
private
int
$slowRequestMs
= self::DEFAULT_SLOW_REQUEST_MS
Methods
__construct()
Constructor.
public
__construct(Connection $platform[, int $slowRequestMs = self::DEFAULT_SLOW_REQUEST_MS ]) : mixed
Parameters
- $platform : Connection
- $slowRequestMs : int = self::DEFAULT_SLOW_REQUEST_MS
prune()
Remove aggregates older than the retention window.
public
prune([int $retentionDays = self::DEFAULT_RETENTION_DAYS ]) : int
Parameters
- $retentionDays : int = self::DEFAULT_RETENTION_DAYS
Return values
intrecord()
Add a request to its privacy-safe hourly aggregate.
public
record(string $tenantId, string $routeName, int $statusCode, int $durationMs[, DateTimeInterface|string|null $recordedAt = null ]) : void
Parameters
- $tenantId : string
- $routeName : string
- $statusCode : int
- $durationMs : int
- $recordedAt : DateTimeInterface|string|null = null
-
Request timestamp override
metricHour()
Normalize a timestamp to its UTC hour bucket.
private
metricHour(DateTimeInterface|string|null $value) : string
Parameters
- $value : DateTimeInterface|string|null
Return values
stringnormalizeRouteName()
Reduce a route to a bounded, non-parameterized identifier.
private
normalizeRouteName(string $routeName) : string
Parameters
- $routeName : string