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

Adding new cloudprober surfacer for bigquery insertion. #274

Merged
merged 14 commits into from May 4, 2023

Conversation

Pulkit0110
Copy link
Contributor

@Pulkit0110 Pulkit0110 commented Feb 11, 2023

Adding a basic new bigquery surfacer which will insert metrics in the bigquery table. To make it more efficient, we're using batch insertion with a batch size of 1000 and a default interval of 10 seconds(it is configurable and can be changed while defining surfacer).

It can take arguments like project name, bigquery dataset, bigquery table name, table columns name and type, batch insertion interval and bigquery timeout. At this point, it only supports data type string, int/integer, float/double and timestamp. For timestamp, the user will have to pass epoch time (in milliseconds). In future, we can add support for more data types.

@kushal288
Copy link
Contributor

@manugarg This is a PR adding a BQ surfacer that we were mentioning earlier. Please have a look and let us know for any feedback.

@manugarg
Copy link
Contributor

@Pulkit0110 @kushal288 This PR has a lot of unrelated files. Can you please clean it up?

@Pulkit0110
Copy link
Contributor Author

@Pulkit0110 @kushal288 This PR has a lot of unrelated files. Can you please clean it up?

Its done.

@manugarg
Copy link
Contributor

@Pulkit0110 Thanks for fixing the PR. I just wanted to say that I've not forgotten about this PR. I'll review it soon.

Copy link
Contributor

@manugarg manugarg left a comment

Choose a reason for hiding this comment

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

Hey @Pulkit0110,

Thanks again for adding this surfacer. Please take a look at the inline comments.

surfacers/bigquery/proto/config.proto Outdated Show resolved Hide resolved
surfacers/bigquery/proto/config.proto Outdated Show resolved Hide resolved
surfacers/bigquery/proto/config.proto Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Show resolved Hide resolved
surfacers/bigquery/bigquery.go Show resolved Hide resolved
Copy link
Contributor

@manugarg manugarg left a comment

Choose a reason for hiding this comment

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

I think something is missing in this surfacer. I don't see you making use of the metrics values. Just to make sure we're on the same page, here is the EventMetrics code:
https://github.com/cloudprober/cloudprober/blob/master/metrics/eventmetrics.go

Also, this code may benefit from looking at the postgres surfacer:
https://github.com/cloudprober/cloudprober/tree/master/surfacers/postgres

surfacers/bigquery/bigquery.go Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/proto/config.proto Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/proto/config.proto Outdated Show resolved Hide resolved
surfacers/bigquery/proto/config.proto Outdated Show resolved Hide resolved
surfacers/bigquery/proto/config.proto Outdated Show resolved Hide resolved
surfacers/bigquery/proto/config.proto Outdated Show resolved Hide resolved
@manugarg
Copy link
Contributor

@Pulkit0110 I'll take a look at it over the weekend.

@Pulkit0110
Copy link
Contributor Author

@manugarg did you get a chance to look at the latest changes?

Copy link
Contributor

@manugarg manugarg left a comment

Choose a reason for hiding this comment

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

@Pulkit0110, Sorry for the delay. This code is a bit hard to follow, and quite unusual in many ways. I've tried my best to figure out what's going and added my comments. Let me know if they don't make sense to you.

surfacers/bigquery/proto/config.proto Show resolved Hide resolved
surfacers/bigquery/proto/config.proto Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
@Pulkit0110
Copy link
Contributor Author

@manugarg I've resolved all the comments. Can you have a look and let me know if more changes are required?

@Pulkit0110
Copy link
Contributor Author

@manugarg , did you get a chance to take a look at the latest changes?

@manugarg
Copy link
Contributor

Thanks for recent changes, @Pulkit0110! I've started reviewing it. Give me a couple of more days to finish.

Copy link
Contributor

@manugarg manugarg left a comment

Choose a reason for hiding this comment

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

Hi Pulkit,

It looks much better. Thank you for all the changes.

I added a few more comments, but most of them are suggestions except for the metric_col_type one. I am not sure if that's what you want there. Even if you do, looks like default should be numeric, not string.

surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/bigquery.go Show resolved Hide resolved
surfacers/bigquery/bigquery.go Show resolved Hide resolved
surfacers/bigquery/bigquery.go Outdated Show resolved Hide resolved
surfacers/bigquery/proto/config.proto Outdated Show resolved Hide resolved
Copy link
Contributor

@manugarg manugarg left a comment

Choose a reason for hiding this comment

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

@Pulkit0110,

LGTM. Found a missing import. Can you please try to build and run it once more after all these changes. Thanks!

surfacers/bigquery/bigquery.go Show resolved Hide resolved
@manugarg manugarg merged commit 7ac4614 into cloudprober:master May 4, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants