API Observability TelemetryEventListener - evansims/openfga-php GitHub Wiki

Event listener that forwards domain events to the telemetry provider. This decouples business logic from telemetry by using events to communicate what happened without the business logic needing to know about telemetry.

Table of Contents


Namespace

OpenFGA\Observability


Source

View source code


Implements


Related Classes


Methods

onHttpRequestSent

public function onHttpRequestSent(OpenFGA\Events\HttpRequestSentEvent $event): void

Handle HTTP request sent events. Records telemetry data when an HTTP request is sent, including request method, URL, body size, and OpenFGA-specific context like operation, store ID, and model ID.

View source


Parameters

Name Type Description
$event HttpRequestSentEvent The HTTP request sent event

Returns

void


onHttpResponseReceived

public function onHttpResponseReceived(OpenFGA\Events\HttpResponseReceivedEvent $event): void

Handle HTTP response received events. Records telemetry data when an HTTP response is received, including response status, body size, and any exception information if the request failed.

View source


Parameters

Name Type Description
$event HttpResponseReceivedEvent The HTTP response received event

Returns

void


onOperationCompleted

public function onOperationCompleted(OpenFGA\Events\OperationCompletedEvent $event): void

Handle operation completed events. Records telemetry data when an OpenFGA operation completes, including success status, operation context, and exception details if the operation failed.

View source


Parameters

Name Type Description
$event OperationCompletedEvent The operation completed event

Returns

void


onOperationStarted

public function onOperationStarted(OpenFGA\Events\OperationStartedEvent $event): void

Handle operation started events. Records telemetry data when an OpenFGA operation begins, including operation type, store context, and model information.

View source


Parameters

Name Type Description
$event OperationStartedEvent The operation started event

Returns

void

⚠️ **GitHub.com Fallback** ⚠️