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
OpenFGA\Observability
- TelemetryEventListenerInterface (interface)
public function onHttpRequestSent(OpenFGA\Events\HttpRequestSentEvent $event): voidHandle 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.
| Name | Type | Description |
|---|---|---|
$event |
HttpRequestSentEvent |
The HTTP request sent event |
void
public function onHttpResponseReceived(OpenFGA\Events\HttpResponseReceivedEvent $event): voidHandle 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.
| Name | Type | Description |
|---|---|---|
$event |
HttpResponseReceivedEvent |
The HTTP response received event |
void
public function onOperationCompleted(OpenFGA\Events\OperationCompletedEvent $event): voidHandle operation completed events. Records telemetry data when an OpenFGA operation completes, including success status, operation context, and exception details if the operation failed.
| Name | Type | Description |
|---|---|---|
$event |
OperationCompletedEvent |
The operation completed event |
void
public function onOperationStarted(OpenFGA\Events\OperationStartedEvent $event): voidHandle operation started events. Records telemetry data when an OpenFGA operation begins, including operation type, store context, and model information.
| Name | Type | Description |
|---|---|---|
$event |
OperationStartedEvent |
The operation started event |
void