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

Set billing project id as the quota project id in BigQuery #17796

Closed
wants to merge 1 commit into from

Conversation

regadas
Copy link
Contributor

@regadas regadas commented Jun 7, 2023

Description

Fixes #17795

Additional context and related issues

Release notes

( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Jun 7, 2023
@github-actions github-actions bot added the bigquery BigQuery connector label Jun 8, 2023
@regadas regadas force-pushed the 17795_quota_project branch from 5cb62c3 to b4056ef Compare June 9, 2023 18:14
@ebyhr ebyhr force-pushed the 17795_quota_project branch from b4056ef to feae76c Compare June 12, 2023 01:28
@ebyhr
Copy link
Member

ebyhr commented Jun 12, 2023

Relates to #17795

Please use reserved comment https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword to close the issue automatically.

Set billing project id as the quota project id in BigQuery

The commit title is obsolete.

@ebyhr ebyhr force-pushed the 17795_quota_project branch from feae76c to cb3ee7e Compare June 12, 2023 01:30
@ebyhr
Copy link
Member

ebyhr commented Jun 12, 2023

/test-with-secrets sha=cb3ee7ee0810d3a8f086b03a2cfa3800300859e7

@github-actions
Copy link

The CI workflow run with tests that require additional secrets finished as failure: https://github.com/trinodb/trino/actions/runs/5238574352

}

@Config("bigquery.quota-project-id")
@ConfigDescription("The Google Cloud Project ID to attribute quota usage")
Copy link
Member

@hashhar hashhar Jun 12, 2023

Choose a reason for hiding this comment

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

according to the javadocs both billing and quota happens against what is set via setQuotaProjectId.

The setParentProjectId is not clearly documented although it's what actually gets used for billing in absence of quota project id.

From all that I read so far it appears that:

  • By default the quota project id is taken from the service account credentials which means there's no need to explicitly set it unless user credentials are being used instead of service accounts

So is my understanding correct that this change is related to your other change at #17717?

This is useful context IMO and maybe it makes more sense to implement both changes in a single PR and explain this background in the commit message. This also needs to be clarified in docs why this config exists otherwise users won't know when or when not to configure this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So is my understanding correct that this change is related to your other change at #17717?

Actually, the need for this stems out of the need to correctly attribute quota usage when using the Streaming API for writes. Currently, everything is being attributed to the table underlying project id.

By default the quota project id is taken from the service account credentials which means there's no need to explicitly set it unless user credentials are being used instead of service accounts

Couldn't fully confirm this but given the above, it seems that could be implementation specific.

That said this is why I feel that this should be a separate PR. Though I feel, given a snd thought that I'm gonna revert my changes and keep quota project id set with the Trino's parent project id.

Copy link
Member

Choose a reason for hiding this comment

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

If the goal is to attribute quota and cost having a single config for that will be useful. Is there a case where you'd want different values for parent project id and quota project id?

Copy link
Contributor Author

@regadas regadas Jun 12, 2023

Choose a reason for hiding this comment

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

Is there a case where you'd want different values for parent project id and quota project id?

Yeah that's what I was reflecting about, and I think ideally they should be the same. The name "parent" is just an artifact of the storage api which in essence is sort of the same as the quota project id.

Copy link
Contributor Author

@regadas regadas Jun 12, 2023

Choose a reason for hiding this comment

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

If the goal is to attribute quota and cost having a single config for that will be useful.

+1 so I'm leaning in just keeping the bigquery.parent-project-id and probably augment a bit the docs to encompass the quota.

@regadas regadas force-pushed the 17795_quota_project branch from cb3ee7e to 8d0a94e Compare June 13, 2023 22:03
@github-actions github-actions bot added the docs label Jun 13, 2023
@regadas regadas requested review from hashhar and ebyhr June 14, 2023 00:16
@ebyhr ebyhr removed their request for review July 31, 2023 04:39
@regadas regadas closed this Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Set quota project id with the billing project id in BigQuery
3 participants