Note: This documentation uses v2 of the Go tracer, which Datadog recommends for all users. If you are using v1, see the migration guide to upgrade to v2.
Data Streams Monitoring has not been changed between v1 and v2 of the SDK.
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
The RabbitMQ integration can provide detailed monitoring and metrics of your RabbitMQ deployments. For full compatibility with Data Streams Monitoring, Datadog recommends configuring the integration as follows:
Set the DD_DATA_STREAMS_ENABLED=true environment variable
Manual instrumentation
Sarama Kafka client
To manually instrument the Sarama Kafka client with Data Streams Monitoring:
Import the ddsarama go library
import(ddsarama"github.com/DataDog/dd-trace-go/contrib/IBM/sarama/v2")2.Wraptheproducerwith`ddsarama.WrapAsyncProducer`...config:=sarama.NewConfig()producer,err:=sarama.NewAsyncProducer([]string{bootStrapServers},config)// ADD THIS LINEproducer=ddsarama.WrapAsyncProducer(config,producer,ddsarama.WithDataStreams())
Confluent Kafka client
To manually instrument Confluent Kafka with Data Streams Monitoring:
Wrap the producer creation with ddkafka.NewProducer and use the ddkafka.WithDataStreams() configuration
// CREATE PRODUCER WITH THIS WRAPPERproducer,err:=ddkafka.NewProducer(&kafka.ConfigMap{"bootstrap.servers":bootStrapServers,},ddkafka.WithDataStreams())
If a service consumes data from one point and produces to another point, propagate context between the two places using the Go context structure. The ctx returned by ExtractFromBase64Carrier carries the upstream DSM pathway. Pass it to SetDataStreamsCheckpointWithParams when you produce, then inject it into the outbound message with InjectToBase64Carrier. Passing context.Background() at the produce site creates a new pathway root and breaks end-to-end visibility. This happens, for example, in a worker goroutine that has lost the consume ctx.
Go channels and goroutines do not carry context.Context automatically. If your service fans consumed messages out to worker goroutines before producing, pass the consume ctx to the produce site by including it in the work item you send over the channel:
typejobstruct{ctxcontext.Contextpayload[]byte}// consume sidectx,_=tracer.SetDataStreamsCheckpointWithParams(datastreams.ExtractFromBase64Carrier(context.Background(),ddsarama.NewConsumerMessageCarrier(msg)),options.CheckpointParams{PayloadSize:int64(len(msg.Value))},"direction:in","type:kafka","topic:"+inTopic,"group:"+group,)// context.WithoutCancel preserves the pathway if the handler's ctx is canceled before the worker runs (Go 1.21+)jobs<-job{ctx:context.WithoutCancel(ctx),payload:msg.Value}// worker goroutineforj:=rangejobs{out:=&sarama.ProducerMessage{Topic:outTopic,Value:sarama.ByteEncoder(j.payload)}ctx,ok:=tracer.SetDataStreamsCheckpointWithParams(j.ctx,options.CheckpointParams{PayloadSize:int64(out.Value.Length())},"direction:out","type:kafka","topic:"+outTopic)ifok{datastreams.InjectToBase64Carrier(ctx,ddsarama.NewProducerMessageCarrier(out))}producer.SendMessage(out)}
Fan-out: When one consumed message fans out to multiple produce calls, pass the same consume ctx to each produce checkpoint. Each call creates its own child node in the pathway.
Fan-in: When many consumed messages merge into one produce call, combine the inbound contexts with datastreams.MergeContexts(ctxs...) before producing.
Other queuing technologies or protocols
You can also use manual instrumentation. For example, you can propagate context through Kinesis.
Data Streams Monitoring can automatically discover your Confluent Cloud connectors and visualize them within the context of your end-to-end streaming data pipeline.
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.
Select the resources you want to add.
Click Add Resources.
Navigate to Data Streams Monitoring to visualize the connectors and track connector status and throughput.
Further reading
Additional helpful documentation, links, and articles: