View Source Datadog.DataStreams.Payload (Data Streams Ex v1.2.2)

Encoding logic for a payload. This is the top level struct we send to Datadog. It wraps all other information. These are primarily sent via MessagePack, although uses Protobuf encoded binary for latency records.

Summary

Functions

Adds an aggregator bucket to the payload.

Adds a map of buckets. This is the format the the aggregator uses internally. We throw out the hash and just keep the buckets.

Encodes the payload via MessagePack.

Creates a new payload with the environment, service, and primary_tag filled in from the Datadog.DataStreams.Config module.

Returns how many stats are in the payload.

Types

@type t() :: %Datadog.DataStreams.Payload{
  env: String.t(),
  lang: String.t(),
  primary_tag: String.t(),
  service: String.t(),
  stats: [Datadog.DataStreams.Payload.Bucket.t()],
  tracer_version: String.t()
}

Functions

Link to this function

add_bucket(payload, bucket)

View Source

Adds an aggregator bucket to the payload.

Link to this function

add_bucket(payload, bucket, timestamp_type)

View Source
@spec add_bucket(
  t(),
  Datadog.DataStreams.Aggregator.Bucket.t(),
  Datadog.DataStreams.Payload.Point.timestamp_type()
) :: t()
Link to this function

add_buckets(payload, buckets, timestamp_type)

View Source
@spec add_buckets(
  t(),
  %{required(non_neg_integer()) => Datadog.DataStreams.Aggregator.Bucket.t()},
  Datadog.DataStreams.Payload.Point.timestamp_type()
) :: t()

Adds a map of buckets. This is the format the the aggregator uses internally. We throw out the hash and just keep the buckets.

@spec encode(t()) :: {:ok, binary()} | {:error, any()}

Encodes the payload via MessagePack.

@spec new() :: t()

Creates a new payload with the environment, service, and primary_tag filled in from the Datadog.DataStreams.Config module.

@spec stats_count(t()) :: non_neg_integer()

Returns how many stats are in the payload.