Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use different max payload sizes for metric series #11496

Merged
merged 2 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use different max payload sizes for metric series
  • Loading branch information
djmitche committed Mar 29, 2022
commit 769f73dc735faefffd3083bc4ea806812823ce17
4 changes: 3 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,12 @@ func InitConfig(config Config) {
config.BindEnvAndSetDefault("enable_sketch_stream_payload_serialization", true)
config.BindEnvAndSetDefault("enable_json_stream_shared_compressor_buffers", true)

// Warning: do not change the two following values. Your payloads will get dropped by Datadog's intake.
// Warning: do not change the following values. Your payloads will get dropped by Datadog's intake.
config.BindEnvAndSetDefault("serializer_max_payload_size", 2*megaByte+megaByte/2)
config.BindEnvAndSetDefault("serializer_max_uncompressed_payload_size", 4*megaByte)
config.BindEnvAndSetDefault("serializer_max_series_points_per_payload", 10000)
config.BindEnvAndSetDefault("serializer_max_series_payload_size", 512000)
config.BindEnvAndSetDefault("serializer_max_series_uncompressed_payload_size", 5242880)

config.BindEnvAndSetDefault("use_v2_api.series", false)
// Serializer: allow user to blacklist any kind of payload to be sent
Expand Down
11 changes: 6 additions & 5 deletions pkg/serializer/internal/metrics/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ func marshalSplitCompress(iterator serieIterator, bufferContext *marshaler.Buffe
var pointsThisPayload int
var seriesThisPayload int
var serie *metrics.Serie

// the backend accepts payloads up to specific compressed / uncompressed
// sizes, but prefers small uncompressed payloads. For series, there is
// also a maximum number of points.
maxPayloadSize := config.Datadog.GetInt("serializer_max_series_payload_size")
maxUncompressedSize := config.Datadog.GetInt("serializer_max_series_uncompressed_payload_size")
maxPointsPerPayload := config.Datadog.GetInt("serializer_max_series_points_per_payload")

// constants for the protobuf data we will be writing, taken from MetricPayload in
Expand All @@ -167,11 +173,6 @@ func marshalSplitCompress(iterator serieIterator, bufferContext *marshaler.Buffe
const pointValue = 1
const pointTimestamp = 2

// the backend accepts payloads up to specific compressed / uncompressed
// sizes, but prefers small uncompressed payloads.
maxPayloadSize := config.Datadog.GetInt("serializer_max_payload_size")
maxUncompressedSize := config.Datadog.GetInt("serializer_max_uncompressed_payload_size")

// Prepare to write the next payload
startPayload := func() error {
var err error
Expand Down