Skip to content

Commit

Permalink
Clarify some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
tiedotguy committed Sep 7, 2021
1 parent aac4c1f commit 5ac61c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pb/remote_write.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ syntax = "proto3";

package pb;

// https://docs.google.com/document/d/1LPhVRSFkGNSuU1fBd81ulhsCPR4hkSZyyBj1SZ8fWOM/

message PromWriteRequest {
repeated PromTimeSeries timeseries = 1;
// Cortex uses this field to determine the source of the write request.
Expand Down
7 changes: 6 additions & 1 deletion pkg/backends/datadog/flush.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const (
rate metricType = "rate"
// counter is a datadog counter type.
counter metricType = "count"

// We want to ensure we don't go over any limits, in case they're
// hard limits so we flush when we get *near* the limit, with the
// goal of never going *over* the limit.
flushBuffer = 20
)

// flush represents a send operation.
Expand Down Expand Up @@ -77,7 +82,7 @@ func coerceToNumeric(v float64) float64 {
}

func (f *flush) maybeFlush() {
if uint(len(f.ts.Series))+20 >= f.metricsPerBatch { // flush before it reaches max size and grows the slice
if uint(len(f.ts.Series))+flushBuffer >= f.metricsPerBatch { // flush before it reaches max size and grows the slice
f.cb(f.ts)
f.ts = &timeSeries{
Series: make([]metric, 0, f.metricsPerBatch),
Expand Down

0 comments on commit 5ac61c8

Please sign in to comment.