From 5f5bdd1ac1a5fa76366271f1589375e3724f2d14 Mon Sep 17 00:00:00 2001 From: Kemal Akkoyun Date: Fri, 25 Mar 2022 13:24:41 +0100 Subject: [PATCH] Add normalized to the batch client Signed-off-by: Kemal Akkoyun --- pkg/agent/write_client.go | 8 ++++++-- pkg/profiler/profiler.go | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/agent/write_client.go b/pkg/agent/write_client.go index db54e842cf..aab5f57e89 100644 --- a/pkg/agent/write_client.go +++ b/pkg/agent/write_client.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Parca Authors +// Copyright (c) 2022 The Parca Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -10,6 +10,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// package agent @@ -82,7 +83,10 @@ func (b *Batcher) batchLoop(ctx context.Context) error { expbackOff.InitialInterval = 500 * time.Millisecond // Let's not retry to aggressively to start with. err := backoff.Retry(func() error { - _, err := b.writeClient.WriteRaw(ctx, &profilestorepb.WriteRawRequest{Series: batch}) + _, err := b.writeClient.WriteRaw(ctx, &profilestorepb.WriteRawRequest{ + Series: batch, + Normalized: true, // Since everything generated by the agent is normalized, we can assume this to be true. + }) // Only log error if retrying, otherwise it will be logged outside the retry if err != nil && expbackOff.NextBackOff().Nanoseconds() > 0 { level.Debug(b.logger).Log( diff --git a/pkg/profiler/profiler.go b/pkg/profiler/profiler.go index 0a28027bef..707a562bfa 100644 --- a/pkg/profiler/profiler.go +++ b/pkg/profiler/profiler.go @@ -604,6 +604,8 @@ func (p *CgroupProfiler) sendProfile(ctx context.Context, prof *profile.Profile) }) } + // NOTICE: This is a batch client, so nothing will be sent immediately. + // Make sure that the batch write client has the correct behaviour if you change any parameters. _, err := p.writeClient.WriteRaw(ctx, &profilestorepb.WriteRawRequest{ Normalized: true, Series: []*profilestorepb.RawProfileSeries{{