KMP PHP API Reference

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

Properties

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
int

record()

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
string

normalizeRouteName()

Reduce a route to a bounded, non-parameterized identifier.

private normalizeRouteName(string $routeName) : string
Parameters
$routeName : string
Return values
string
On this page

Search results