KMP PHP API Reference

PlatformJobAlertService
in package

Builds diagnostics-safe alert findings from platform schedule/job metadata.

Table of Contents

Constants

TYPE_MISSING_SCHEDULE_SUCCESS  : mixed = 'missing_schedule_success'
TYPE_REPEATED_FAILURES  : mixed = 'repeated_failures'
TYPE_STALE_RUNNING_JOB  : mixed = 'stale_running_job'

Properties

$failureThreshold  : int
$failureWindowMinutes  : int
$missingSuccessMinutes  : int
$now  : DateTime|null
$staleRunningMinutes  : int

Methods

__construct()  : mixed
Constructor.
check()  : array{healthy: bool, checked_at: string, alerts: list>}
Check platform_jobs and platform_schedules for monitorable alert conditions.
scrub()  : string|null
Redact secrets and PII from alert output.
ageMinutes()  : int
Return the age of a timestamp in whole minutes.
clock()  : DateTime
Return the current time.
decodeOptions()  : array<string, mixed>
latestFailureError()  : string|null
Return the most recent failure error for a failed job group.
missingScheduleSuccessAlerts()  : array<int, array<string, mixed>>
platform()  : Connection
Return the platform metadata connection.
repeatedFailureAlerts()  : array<int, array<string, mixed>>
scheduleSuccessThresholdMinutes()  : int
staleRunningJobAlerts()  : array<int, array<string, mixed>>
timestamp()  : DateTime|null
Convert a database timestamp into a DateTime instance.

Constants

TYPE_MISSING_SCHEDULE_SUCCESS

public mixed TYPE_MISSING_SCHEDULE_SUCCESS = 'missing_schedule_success'

Properties

Methods

__construct()

Constructor.

public __construct([int $staleRunningMinutes = 60 ][, int $missingSuccessMinutes = 1440 ][, int $failureThreshold = 3 ][, int $failureWindowMinutes = 60 ][, DateTime|null $now = null ]) : mixed
Parameters
$staleRunningMinutes : int = 60

Minutes before a running job is stale

$missingSuccessMinutes : int = 1440

Default schedule success freshness threshold

$failureThreshold : int = 3

Failed jobs needed to alert

$failureWindowMinutes : int = 60

Failed job lookback window

$now : DateTime|null = null

Clock override for tests

check()

Check platform_jobs and platform_schedules for monitorable alert conditions.

public check() : array{healthy: bool, checked_at: string, alerts: list>}
Return values
array{healthy: bool, checked_at: string, alerts: list>}

scrub()

Redact secrets and PII from alert output.

public static scrub(string|null $message) : string|null
Parameters
$message : string|null

Raw diagnostic text

Return values
string|null

Safe diagnostic text

ageMinutes()

Return the age of a timestamp in whole minutes.

private ageMinutes(DateTime $timestamp) : int
Parameters
$timestamp : DateTime

Timestamp to compare

Return values
int

Age in minutes

clock()

Return the current time.

private clock() : DateTime
Return values
DateTime

Current time

decodeOptions()

private decodeOptions(mixed $options) : array<string, mixed>
Parameters
$options : mixed
Return values
array<string, mixed>

latestFailureError()

Return the most recent failure error for a failed job group.

private latestFailureError(mixed $tenantId, string $jobType) : string|null
Parameters
$tenantId : mixed

Tenant identifier, or null for platform jobs

$jobType : string

Platform job type

Return values
string|null

Last failure error

missingScheduleSuccessAlerts()

private missingScheduleSuccessAlerts() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

platform()

Return the platform metadata connection.

private platform() : Connection
Return values
Connection

Platform connection

repeatedFailureAlerts()

private repeatedFailureAlerts() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

scheduleSuccessThresholdMinutes()

private scheduleSuccessThresholdMinutes(array<string, mixed> $schedule) : int
Parameters
$schedule : array<string, mixed>

Schedule row

Return values
int

Threshold in minutes

staleRunningJobAlerts()

private staleRunningJobAlerts() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

timestamp()

Convert a database timestamp into a DateTime instance.

private timestamp(mixed $value) : DateTime|null
Parameters
$value : mixed

Raw timestamp value

Return values
DateTime|null

Parsed timestamp

On this page

Search results