---
title: Setup Data Streams Monitoring for PHP
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Data Streams Monitoring > Setup Data Streams Monitoring > Setup Data
  Streams Monitoring for PHP
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Setup Data Streams Monitoring for PHP

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

### Prerequisites{% #prerequisites %}

- [Datadog Agent v7.34.0 or later](https://docs.datadoghq.com/agent.md)

### Supported libraries{% #supported-libraries %}

| Technology | Library                                                   | Minimum library version | Minimal tracer version | Recommended tracer version |
| ---------- | --------------------------------------------------------- | ----------------------- | ---------------------- | -------------------------- |
| Kafka      | [php-rdkafka](https://github.com/arnaud-lb/php-rdkafka)   | 6.0.0                   | 1.27.1                 | 1.27.1 or later            |
| RabbitMQ   | [php-amqplib](https://github.com/php-amqplib/php-amqplib) | 2.6.2                   | 1.27.1                 | 1.27.1 or later            |

### Installation{% #installation %}

PHP uses auto-instrumentation to inject and extract the metadata that Data Streams Monitoring needs to measure end-to-end latencies and the relationship between queues and services. To enable Data Streams Monitoring, set the `DD_DATA_STREAMS_ENABLED` environment variable to `true` on services that send messages to or consume messages from Kafka or RabbitMQ. Datadog also recommends setting `DD_TRACE_STATS_COMPUTATION_ENABLED` to `true`.

{% tab title="Environment variables" %}

```yaml
environment:
  - DD_DATA_STREAMS_ENABLED: "true"
  - DD_TRACE_STATS_COMPUTATION_ENABLED: "true"
```

{% /tab %}

{% tab title="INI file" %}

```ini
datadog.data_streams_enabled = On
datadog.trace.stats_computation_enabled = On
```

{% /tab %}

As with other PHP SDK settings, set these at the server level so that they take effect before any of your code runs. To set them for your web server or the CLI, see [Configuring the PHP SDK](https://docs.datadoghq.com/tracing/trace_collection/library_config/php.md).

Data Streams Monitoring identifies your service by `DD_SERVICE`. If `DD_SERVICE` is not set, the SDK uses a default service name: `web.request` for web requests, and the script's filename for CLI scripts. Set `DD_SERVICE` on each service so that it appears under its own name in Data Streams Monitoring.

### Monitoring Kafka Pipelines{% #monitoring-kafka-pipelines %}

Data Streams Monitoring uses message headers to propagate context through Kafka streams. If `log.message.format.version` is set in the Kafka broker configuration, it must be set to `0.11.0.0` or higher. Data Streams Monitoring is not supported for versions lower than this.

### Monitoring RabbitMQ pipelines{% #monitoring-rabbitmq-pipelines %}

The [RabbitMQ integration](https://docs.datadoghq.com/integrations/rabbitmq.md?tab=host) can provide detailed monitoring and metrics of your RabbitMQ deployments. For full compatibility with Data Streams Monitoring, Datadog recommends configuring the integration as follows:

```yaml
instances:
  - prometheus_plugin:
      url: http://<HOST>:15692
      unaggregated_endpoint: detailed?family=queue_coarse_metrics&family=queue_consumer_count&family=channel_exchange_metrics&family=channel_queue_exchange_metrics&family=node_coarse_metrics
```

This ensures that all RabbitMQ graphs populate, and that you see detailed metrics for individual exchanges as well as queues.

### Monitoring connectors{% #monitoring-connectors %}

#### Confluent Cloud connectors{% #confluent-cloud-connectors %}

Data Streams Monitoring can automatically discover your [Confluent Cloud](https://docs.datadoghq.com/integrations/rabbitmq.md?tab=host) connectors and visualize them within the context of your end-to-end streaming data pipeline.

##### Setup{% #setup %}

1. Install and configure the [Datadog-Confluent Cloud integration](https://app.datadoghq.com/integrations/confluent-cloud).

1. In Datadog, open the [Confluent Cloud integration tile](https://app.datadoghq.com/integrations/confluent-cloud).

Under **Actions**, a list of resources populates with detected clusters and connectors. Datadog attempts to discover new connectors every time you view this integration tile.

1. Select the resources you want to add.

1. Click **Add Resources**.

1. Navigate to [Data Streams Monitoring](https://app.datadoghq.com/data-streams/) to visualize the connectors and track connector status and throughput.

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Kafka Integration](https://docs.datadoghq.com/integrations/kafka.md)
- [RabbitMQ Integration](https://docs.datadoghq.com/integrations/rabbitmq.md)
- [Catalog](https://docs.datadoghq.com/internal_developer_portal/catalog.md)
- [Autodiscover Confluent Cloud connectors and easily monitor performance in Data Streams Monitoring](https://www.datadoghq.com/blog/confluent-connector-dsm-autodiscovery/)
