Skip to content

Commit

Permalink
fixup! Added http metrics client
Browse files Browse the repository at this point in the history
  • Loading branch information
codebien committed May 25, 2023
1 parent 95e5eda commit 3d401fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions output/cloud/expv2/metrics_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ func (mc *MetricsClient) Push(ctx context.Context, referenceID string, samples *
return nil
}

const b100KiB = 100 * 1024
const payloadSizeLimit = 100 * 1024 // 100 KiB

func newRequestBody(data *pbcloud.MetricSet) ([]byte, error) {
b, err := proto.Marshal(data)
if err != nil {
return nil, fmt.Errorf("encoding metrics as Protobuf write request failed: %w", err)
}
if len(b) > b100KiB {
if len(b) > payloadSizeLimit {
return nil, fmt.Errorf("the Protobuf message is too large to be handled from the Cloud processor; "+
"size: %d, limit: 100 KB", len(b))
}
Expand Down

0 comments on commit 3d401fe

Please sign in to comment.