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

output/cloudv2: Binary-based payload #2963

Merged
merged 6 commits into from
May 26, 2023
Merged

Conversation

codebien
Copy link
Contributor

@codebien codebien commented Mar 8, 2023

It adds the HTTP client for flushing the metric to the remote cloud service and the new Protobuf-based required payload.

Updates #2954

@codebien codebien self-assigned this Mar 8, 2023
@codecov-commenter
Copy link

codecov-commenter commented Mar 8, 2023

Codecov Report

Merging #2963 (92c6694) into master (ddecdfc) will decrease coverage by 1.70%.
The diff coverage is 13.00%.

❗ Current head 92c6694 differs from pull request most recent head b368bd5. Consider uploading reports for the commit b368bd5 to get more accurate results

@@            Coverage Diff             @@
##           master    #2963      +/-   ##
==========================================
- Coverage   75.21%   73.51%   -1.70%     
==========================================
  Files         236      238       +2     
  Lines       17722    18220     +498     
==========================================
+ Hits        13330    13395      +65     
- Misses       3533     3955     +422     
- Partials      859      870      +11     
Flag Coverage Δ
ubuntu 73.51% <13.00%> (-1.70%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
output/cloud/expv2/pbcloud/metric.pb.go 7.58% <7.58%> (ø)
output/cloud/expv2/metrics_client.go 58.00% <58.00%> (ø)
cloudapi/client.go 72.91% <100.00%> (ø)
cmd/run.go 72.76% <100.00%> (ø)

... and 1 file with indirect coverage changes

@codebien codebien requested a review from na-- March 8, 2023 11:48
cloudapi/config.go Outdated Show resolved Hide resolved
output/cloud/output.go Outdated Show resolved Hide resolved
@codebien codebien force-pushed the ingestion/binary-proto branch 3 times, most recently from 60d4393 to fdc5307 Compare April 5, 2023 15:10
@codebien codebien marked this pull request as ready for review April 5, 2023 15:38
@codebien
Copy link
Contributor Author

codebien commented Apr 5, 2023

@na-- @olegbespalov I added the aggregation proposal also, it shouldn't be optimal but it should be a good first step to achieve a reasonable rate. We can iterate on it after we will get some benchmarks (I don't plan them for this PR).

I would get the reviews for it before I do the refactor asked in #2963 (comment) so I can address it all at once.

Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done a first round, will do the other one a bit later

output/cloud/expv2/metrics_client.go Outdated Show resolved Hide resolved
output/cloud/expv2/metrics_client.go Outdated Show resolved Hide resolved
output/cloud/expv2/metrics_client.go Outdated Show resolved Hide resolved
output/cloud/expv2/metrics_client.go Outdated Show resolved Hide resolved
output/cloud/expv2/output.go Outdated Show resolved Hide resolved
output/cloud/expv2/output.go Outdated Show resolved Hide resolved
output/cloud/expv2/pbcloud/metric.pb.go Outdated Show resolved Hide resolved
output/cloud/expv2/output.go Outdated Show resolved Hide resolved
output/cloud/expv2/metrics_client_test.go Outdated Show resolved Hide resolved
output/cloud/expv2/metrics_client_test.go Show resolved Hide resolved
output/cloud/expv2/pbcloud/metric.proto Outdated Show resolved Hide resolved
@codebien codebien added this to the v0.45.0 milestone Apr 21, 2023
@codebien codebien force-pushed the ingestion/binary-proto branch 3 times, most recently from d7df637 to 34d36f7 Compare April 24, 2023 15:02
output/cloud/expv2/metrics_client_test.go Outdated Show resolved Hide resolved
output/cloud/output.go Outdated Show resolved Hide resolved
output/cloud/expv2/output.go Outdated Show resolved Hide resolved
@codebien codebien changed the title output/cloud: Binary-based PoC output/cloudv2: Binary-based payload May 12, 2023
@codebien codebien changed the base branch from master to cloud/refactor/versioning May 12, 2023 14:38
@codebien codebien force-pushed the cloud/refactor/versioning branch 2 times, most recently from ae23d28 to 8405799 Compare May 16, 2023 08:46
olegbespalov
olegbespalov previously approved these changes May 25, 2023
na--
na-- previously approved these changes May 26, 2023
Base automatically changed from cloud-v2-aggregation to master May 26, 2023 08:14
@codebien
Copy link
Contributor Author

Rebased after the aggregation merge

olegbespalov
olegbespalov previously approved these changes May 26, 2023
go.mod Outdated Show resolved Hide resolved
output/cloud/expv2/metrics_client.go Outdated Show resolved Hide resolved
return nil
}

const payloadSizeLimit = 100 * 1024 // 100 KiB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we just break them in parts then? 100kb doesn't soudn that big. Especially before compression.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you do that? Here the limit is related to the protobuf, how do you chunk it without breaking the metric set message? I'm not aware of Protobuf supporting a streaming/chunked version. Did I miss it?

This should be an extreme check, if we need to chunk, then I think we should do that before calling the metric's client, so in its caller. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use https://pkg.go.dev/google.golang.org/protobuf/proto#Size to find out how big it will be before serializing and then splitting if necessary.

And I guess a method like Push can know that protobuf will be used and cut it in pieces when necessary.

We can probably leave that for after we merge everything. But I would like to know how many metrics are 100kb before we actually make this the default. As dropping your metrics because they were 101kb sounds like terrible experience.

output/cloud/expv2/metrics_client.go Outdated Show resolved Hide resolved
output/cloud/expv2/metrics_client.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@codebien codebien requested a review from mstoykov May 26, 2023 10:16
Copy link
Contributor

@mstoykov mstoykov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! But we should test how big is 100kb encoded metrics before we actually make this the default way to push metrics to the cloud.

@codebien
Copy link
Contributor Author

But we should test how big is 100kb encoded metrics

Yes, I already have it on my list. I add it also to the worklog in #2954 as a reminder.

@codebien codebien merged commit df6cbce into master May 26, 2023
@codebien codebien deleted the ingestion/binary-proto branch May 26, 2023 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants