class EntryStore

Traits

Constants

protected SUPPRESS_SECONDS

Properties

static protected float|null $suppressedUntil

Deliberately static: a write failure suppresses recording for a short window. Each long-lived worker keeps its own breaker, and process-per-request setups reset it.

protected IncomingEntry|null $pending

Methods

array
redact(array $data, array $keys)

Redact the values of the given keys throughout the data.

array
redactSensitiveStoragePayload(array $payload)

Final storage pass for entry payloads. Earlier builders redact known request surfaces, but this keeps persisted entries private if a future collector path adds sensitive data before save.

array
redactRecursive(array $data, array $loweredKeys)

Redact the values of the given lowercase keys at every depth.

array
redactHeaders(array $headers)

Flatten the given headers, redacting the sensitive ones and the sensitive query parameters of URL headers.

array
normalizeSensitiveKeys(array $keys)

Normalize the configured sensitive keys to unique lowercase strings.

array
redactUrls(array $data, array $keys)

Redact sensitive query parameters from the URLs in the data.

string
redactUrl(string $url, array $keys)

Redact the values of sensitive query parameters. A parameter matches when its decoded name or any of its bracketed segments (e.g. filter[secret]) is a sensitive key. The query is not parsed and rebuilt, so every other byte of the URL is kept as recorded, and relative or malformed URLs are redacted the same way.

array
sanitizeForJsonEncoding(array $data)

Replace leaf values that cannot be stored as JSON with a marker.

bool
isJsonEncodable(mixed $value)

Determine if the value can be stored as JSON.

void
record(IncomingEntry $entry)

Record the entry to persist once the request has been handled.

current()

Get the pending entry.

void
reset()

Discard the pending entry.

void
flush(EntriesRepository $repo)

Persist the pending entry and prune expired entries.

static void
resetCircuitBreaker()

Reset the circuit breaker so recording resumes immediately.

static void
flushState()

Flush all static state.

Details

protected array redact(array $data, array $keys)

Redact the values of the given keys throughout the data.

Parameters

array $data
array $keys

Return Value

array

protected array redactSensitiveStoragePayload(array $payload)

Final storage pass for entry payloads. Earlier builders redact known request surfaces, but this keeps persisted entries private if a future collector path adds sensitive data before save.

Parameters

array $payload

Return Value

array

protected array redactRecursive(array $data, array $loweredKeys)

Redact the values of the given lowercase keys at every depth.

Parameters

array $data
array $loweredKeys

Return Value

array

in RedactsSensitiveData at line 101
protected array redactHeaders(array $headers)

Flatten the given headers, redacting the sensitive ones and the sensitive query parameters of URL headers.

Parameters

array $headers

Return Value

array

in RedactsSensitiveData at line 127
protected array normalizeSensitiveKeys(array $keys)

Normalize the configured sensitive keys to unique lowercase strings.

Parameters

array $keys

Return Value

array

in RedactsSensitiveData at line 149
protected array redactUrls(array $data, array $keys)

Redact sensitive query parameters from the URLs in the data.

Parameters

array $data
array $keys

Return Value

array

in RedactsSensitiveData at line 181
protected string redactUrl(string $url, array $keys)

Redact the values of sensitive query parameters. A parameter matches when its decoded name or any of its bracketed segments (e.g. filter[secret]) is a sensitive key. The query is not parsed and rebuilt, so every other byte of the URL is kept as recorded, and relative or malformed URLs are redacted the same way.

Parameters

string $url
array $keys

Return Value

string

in RedactsSensitiveData at line 210
protected array sanitizeForJsonEncoding(array $data)

Replace leaf values that cannot be stored as JSON with a marker.

Parameters

array $data

Return Value

array

in RedactsSensitiveData at line 226
protected bool isJsonEncodable(mixed $value)

Determine if the value can be stored as JSON.

Parameters

mixed $value

Return Value

bool

at line 30
void record(IncomingEntry $entry)

Record the entry to persist once the request has been handled.

Parameters

IncomingEntry $entry

Return Value

void

at line 38
IncomingEntry|null current()

Get the pending entry.

Return Value

IncomingEntry|null

at line 46
void reset()

Discard the pending entry.

Return Value

void

at line 54
void flush(EntriesRepository $repo)

Persist the pending entry and prune expired entries.

Parameters

EntriesRepository $repo

Return Value

void

at line 113
static void resetCircuitBreaker()

Reset the circuit breaker so recording resumes immediately.

The breaker is shared by every request in the worker, so a reset during a request resumes writes for all of them while storage may still be failing.

Return Value

void

at line 122
static void flushState()

Flush all static state.

Return Value

void