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

CosmosDB: Add throughput configuration #6693

Merged
merged 4 commits into from
Oct 4, 2023

Conversation

N-o-Z
Copy link
Member

@N-o-Z N-o-Z commented Oct 3, 2023

Closes #6692

Change Description

Background

Add configuration to control CosmosDB container throughput RU/s and autoscaling mode

Testing Details

Tested manually

Breaking Change?

No

@N-o-Z N-o-Z added include-changelog PR description should be included in next release changelog azure Issues regarding azure block adapter and support labels Oct 3, 2023
@N-o-Z N-o-Z requested review from nopcoder and itaiad200 October 3, 2023 18:04
@N-o-Z N-o-Z self-assigned this Oct 3, 2023
@github-actions
Copy link

github-actions bot commented Oct 3, 2023

♻️ PR Preview b25e45f has been successfully destroyed since this PR has been closed.

🤖 By surge-preview

@@ -65,6 +65,8 @@ This reference uses `.` to denote the nesting of values.
+ `database.cosmosdb.endpoint` `(string : "")` - CosmosDB account endpoint, e.g. `https://<account>.documents.azure.com/`.
+ `database.cosmosdb.database` `(string : "")` - CosmosDB database name.
+ `database.cosmosdb.container` `(string : "")` - CosmosDB container name.
+ `database.cosmosdb.throughput` `(uint : 400)` - The container's RU/s.
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. how do we control if we lick to configure throughput?
  2. prefer to let the user configure the value if choose to use cosmos
  3. can we keep the type to int - I assume that invalid values will fail to configure the feature
  4. include "CosmosDB..." as part of the parameter description

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. Throughput is always configured whether autoscaling or manual mode
  2. This is anyway the default for cosmosDB if no configuration provided - using the default in our configuration makes this fact accessible to the user
  3. Done
  4. Going the other way and removing CosmosDB from all parameter description (redundant + aligning with DyanmoDB description)

docs/reference/configuration.md Outdated Show resolved Hide resolved
pkg/config/defaults.go Outdated Show resolved Hide resolved
pkg/kv/cosmosdb/store.go Outdated Show resolved Hide resolved
pkg/config/config.go Outdated Show resolved Hide resolved
@N-o-Z N-o-Z requested a review from nopcoder October 4, 2023 11:59
Endpoint string `mapstructure:"endpoint"`
Database string `mapstructure:"database"`
Container string `mapstructure:"container"`
Throughput *int32 `mapstructure:"throughput"`
Copy link
Contributor

Choose a reason for hiding this comment

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

can you use int without setting any default we can assume 0 as non value.

@N-o-Z N-o-Z requested a review from nopcoder October 4, 2023 13:35
Copy link
Contributor

@nopcoder nopcoder left a comment

Choose a reason for hiding this comment

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

LGTM! (minor comment)

var opts *azcosmos.CreateContainerOptions
if params.Throughput > 0 {
var throughputProperties azcosmos.ThroughputProperties
tp := params.Throughput
Copy link
Contributor

Choose a reason for hiding this comment

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

inline

@N-o-Z N-o-Z enabled auto-merge (squash) October 4, 2023 13:38
@N-o-Z N-o-Z merged commit 6e4a289 into master Oct 4, 2023
31 of 32 checks passed
@N-o-Z N-o-Z deleted the task/cosmosdb-throughput-config-6692 branch October 4, 2023 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure Issues regarding azure block adapter and support include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add throughput configuration for CosmosDB containers
2 participants