open-telemetry/opentelemetry-propagation-cloudtrace

CloudTraceContext propagator extension for OpenTelemetry PHP.

0.1.0 2025-08-08 01:43 UTC

This package is auto-updated.

Last update: 2025-08-08 01:43:38 UTC


README

Releases Issues Source Mirror Latest Version Stable

This is a read-only subtree split of https://github.com/open-telemetry/opentelemetry-php-contrib.

OpenTelemetry CloudTrace Propagator

CloudTrace is a propagator that supports the specification for the header "x-cloud-trace-context" used for trace context propagation across service boundaries. (https://cloud.google.com/trace/docs/setup#force-trace). OpenTelemetry PHP CloudTrace Propagator Extension provides option to use it bi-directionally or one-way. One-way does not inject the header for downstream consumption, it only processes the incoming headers and returns the correct span context. It only attaches to existing X-Cloud-Trace-Context traces and does not create downstream ones.

Installation

composer require open-telemetry/opentelemetry-propagation-cloudtrace

Usage

For one-way CloudTrace:

$propagator = CloudTracePropagator::getOneWayInstance();

For bi-directional CloudTrace:

$propagator = CloudTracePropagator::getInstance();