Transport
Interface for sending telemetry data to backends.
Transports handle the actual network communication to telemetry backends like OTLP collectors, Jaeger, or other observability platforms.
The signal type (traces, metrics, logs) is inferred from the payload type.
Example implementation:
final class HttpTransport implements Transport
{
public function sendSpans(array $spans): void
{
$json = $this->serializer->serializeSpans($spans);
$this->client->post($this->endpoint . '/v1/traces', $json);
}
}
Methods
- sendLogs() : void
- Send log entries to the backend.
- sendMetrics() : void
- Send metrics to the backend.
- sendSpans() : void
- Send spans to the backend.
- shutdown() : void
- Shutdown the transport, releasing any resources.
Methods
sendLogs()
Send log entries to the backend.
public
sendLogs(array<string|int, LogEntry> $entries) : void
Parameters
- $entries : array<string|int, LogEntry>
-
The log entries to export
Tags
sendMetrics()
Send metrics to the backend.
public
sendMetrics(array<string|int, Metric> $metrics) : void
Parameters
- $metrics : array<string|int, Metric>
-
The metrics to export
Tags
sendSpans()
Send spans to the backend.
public
sendSpans(array<string|int, Span> $spans) : void
Parameters
- $spans : array<string|int, Span>
-
The spans to export
Tags
shutdown()
Shutdown the transport, releasing any resources.
public
shutdown() : void
Should complete any pending sends before shutting down. This method is idempotent - calling it multiple times is safe.