Prerequisites
- PHP 8.1 or later
- Composer
- A running OTel Collector configured to forward logs to Bronto — see Connect Open Telemetry to Bronto
- OpenTelemetry PHP SDK documentation
Install dependencies
| Package | Purpose |
|---|---|
open-telemetry/api | Core OTel API |
open-telemetry/sdk | SDK — LoggerProvider, processors, resource |
open-telemetry/exporter-otlp | OTLP/HTTP exporter |
open-telemetry/opentelemetry-logger-monolog | Bridges Monolog into OTel |
php-http/guzzle7-adapter | HTTP client for the exporter |
Configure the log bridge
Set up aLoggerProvider with an OTLP exporter and attach the OtelHandler to your Monolog logger.
configure_logging.php
Configure the OTLP exporter
TheOtlpHttpTransportFactory in the snippet above connects to the OTel Collector on localhost:4318. If your Collector runs on a different host or port, update the URL accordingly.
Set resource attributes
Resource attributes are attached to every log record exported from this process. Two attributes drive how Bronto organises incoming logs:| OTel attribute | Bronto concept | Description |
|---|---|---|
service.name | Dataset | Groups logs from one service |
service.namespace | Collection | Groups related services or a team’s services |
ResourceInfo::create in the setup above.
Complete example
index.php
OtelHandler is added alongside any existing handlers (console, file, etc.) so both continue to work.
Verify log collection
After running your application, open the Search page in Bronto. Filter by the dataset name you set inservice.name — your log records should appear within a few seconds.
If no logs appear, check:
- The OTel Collector is running and reachable at the configured endpoint.
- The Collector’s pipeline includes a
logspipeline with anotlpreceiver and the Bronto exporter — see Connect Open Telemetry to Bronto. configureOtelLogging()is called before the first log statement.
Traces
Configure the tracer provider
No additional packages are needed —open-telemetry/sdk and open-telemetry/exporter-otlp already include tracing support.
configure_tracing.php
$resource used for logging so both signals share service.name and service.namespace.
Creating spans
Direct export to Bronto
If you are not using an OTel Collector, export directly to Bronto by replacing the transport configurations with the Bronto OTLP endpoints and your API key:| Region | Logs endpoint | Traces endpoint |
|---|---|---|
| EU | https://ingestion.eu.bronto.io/v1/logs | https://ingestion.eu.bronto.io/v1/traces |
| US | https://ingestion.us.bronto.io/v1/logs | https://ingestion.us.bronto.io/v1/traces |

