Setup Data Streams Monitoring for Node.js

Prerequisites

Supported libraries

TechnologyLibraryMinimal tracer versionRecommended tracer version
Kafkakafkajs2.39.0 or 3.26.0 or 4.5.05.25.0 or later
RabbitMQamqplib3.48.0 or 4.27.0 or 5.3.05.3.0 or later
Amazon SQSclient-sqs3.47.0 or 4.26.0 or 5.2.05.18.0 or later
Amazon Kinesisclient-kinesis3.47.0 or 4.26.0 or 5.2.05.18.0 or later
Amazon SNSclient-sns3.47.0 or 4.26.0 or 5.2.05.18.0 or later
Google Pub/Subgoogle-cloud/pubsub5.25.0 or 4.49.05.25.0 or later

Installation

Node.js uses auto-instrumentation to inject and extract additional metadata required by Data Streams Monitoring for measuring 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 sending messages to (or consuming messages from) Kafka.

For example:

environment:
  - DD_DATA_STREAMS_ENABLED: "true"

Monitoring SQS pipelines

Data Streams Monitoring uses one message attribute to track a message’s path through an SQS queue. As Amazon SQS has a maximum limit of 10 message attributes allowed per message, all messages streamed through the data pipelines must have 9 or fewer message attributes set, allowing the remaining attribute for Data Streams Monitoring.

Monitoring SNS-to-SQS pipelines

To monitor a data pipeline where Amazon SNS talks directly to Amazon SQS, you must enable Amazon SNS raw message delivery.

Monitoring Kinesis pipelines

There are no message attributes in Kinesis to propagate context and track a message’s full path through a Kinesis stream. As a result, Data Streams Monitoring’s end-to-end latency metrics are approximated based on summing latency on segments of a message’s path, from the producing service through a Kinesis Stream, to a consumer service. Throughput metrics are based on segments from the producing service through a Kinesis Stream, to the consumer service. The full topology of data streams can still be visualized through instrumenting services.

Manual instrumentation

Data Streams Monitoring propagates context through message headers. If you are using a message queue technology that is not supported by DSM, a technology without headers (such as Kinesis), or Lambdas, use manual instrumentation to set up DSM.

Further Reading

Additional helpful documentation, links, and articles: