Skip to content

Commit

Permalink
Add normalized to the batch client
Browse files Browse the repository at this point in the history
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
  • Loading branch information
kakkoyun committed Mar 25, 2022
1 parent 7123cd2 commit 5f5bdd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions 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
Expand All @@ -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

Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions pkg/profiler/profiler.go
Expand Up @@ -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{{
Expand Down

0 comments on commit 5f5bdd1

Please sign in to comment.