Skip to content

LogAnalyticsIndex

Upgrades resolution from “an id plus a date/hour hint” to a bare id with nothing else: queries the workspace for the pointer log line the recorder itself wrote, reads its cassette_key straight off that record, and fetches the object at that key.

Declines (returns null) when no workspace is configured, or the query legitimately returns no matching pointer — both are “nothing to find here”, not a broken index. A pointer that is found but whose object has since expired throws instead of declining: the pointer outliving the cassette is a designed property (a lifecycle rule can prune the blob long before log retention expires), and “the request failed * and a cassette existed for it, but it is gone now” is a materially different, more useful answer than a plain “not found” — worth surfacing, not swallowing into a decline.

final readonly class LogAnalyticsIndex implements CassetteIndexInterface

ImplementsCassetteIndexInterface
SourceIndex/LogAnalyticsIndex.php

public function __construct(AzureMonitorQueryClientInterface|null $queryClient, ObjectStoreClientInterface|null $objectClient = null, int $lookbackHours = 720, CassetteCodec $codec = new CassetteCodec(…)): mixed

Only ever used to fetch the object a pointer names, so it is not required when $queryClient is null — and building one for an index that will decline every call means constructing a blob client and its credential for nothing, on every resolution attempt.

ParameterTypeDescription
$queryClientAzureMonitorQueryClientInterface`“null`
$objectClientObjectStoreClientInterface`“null`
$lookbackHoursint
$codecCassetteCodec

Returns mixed

MethodDescription
resolve(CassetteId $id, IndexHints $hints): ?CassetteReturns null when this index has nothing to try for the given id/hints — not configured, no matching hint present, or a legitimate zero-result lookup.

public function resolve(CassetteId $id, IndexHints $hints): ?Cassette

Returns null when this index has nothing to try for the given id/hints — not configured, no matching hint present, or a legitimate zero-result lookup.

That is the designed “try the next index in the chain” signal, not an error. A genuine failure (a malformed hint, a broken query, an auth error, or a pointer whose payload has already expired) throws CassetteIndexException instead, so a misconfigured or broken index never masquerades as “not found here.”

ParameterTypeDescription
$idCassetteId
$hintsIndexHints

Returns ?Cassette