TIMEOUT
TIMEOUT = 5
Seconds to wait for the collector.
Short on purpose. The export runs at the end of a request or a cron run, and a collector that takes longer than this is one nothing should be waiting on.
Posts spans and metrics to an OTLP endpoint.
A failed export is a warning, never an error, and is never retried. Telemetry describes what already happened; a collector that is down does not make the flush that just succeeded a failure, and a retry queue for observability data would mean an unreachable collector slowly filling the site's own queue table with duplicate readings of a moment that has passed.
The endpoint is the collector's base URL and the signal paths are appended, which is what the
OTEL_EXPORTER_OTLP_ENDPOINT convention specifies. A site that configured the full traces URL
instead gets it used as-is, since appending a second /v1/traces would silently 404.
$payload : \Drupal\strata\Telemetry\OtlpPayload
__construct(\GuzzleHttp\ClientInterface $http, \Drupal\strata\Telemetry\OtlpPayload $payload, \Psr\Log\LoggerInterface $logger, string $endpoint = '', array$headers = []) : mixed
Constructs an exporter.
| \GuzzleHttp\ClientInterface | $http | The HTTP client. |
| \Drupal\strata\Telemetry\OtlpPayload | $payload | Renders the wire shape. |
| \Psr\Log\LoggerInterface | $logger | Records an export that did not land. |
| string | $endpoint | The collector's base URL, or an empty string to export nothing. |
| array |
$headers | Headers every export carries, which is where an API key goes. |
exportMetrics(\Drupal\strata\Telemetry\MetricSet $metrics, int|null $nanos = null) : bool
Exports metrics.
| \Drupal\strata\Telemetry\MetricSet | $metrics | The metrics. |
| int|null | $nanos | Unix nanoseconds to stamp them with, or NULL for now. |
TRUE when the collector accepted them, or there was nothing to send.