Skip to content

Throughput bucket preview #27824

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

Open
wants to merge 17 commits into
base: Az.CosmosDB-preview
Choose a base branch
from

Conversation

Achint-Agrawal
Copy link

@Achint-Agrawal Achint-Agrawal commented May 22, 2025

Description

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Achint-Agrawal and others added 9 commits May 22, 2025 15:52
Modified maximum throughput percentages for two buckets in
`Test-SqlThroughputCmdlets`. Added assertions to verify
updated bucket properties. Removed the test for container
throughput buckets and the associated function
`Test-SqlThroughputBucketCmdlets`. Adjusted formatting in
`Test-ClientEncryptionKeyCmdletsUsingInputObject` for clarity.
Modified the help message for the `MaxThroughputPercentage` parameter in `NewAzCosmosDBThroughputBucketObject.cs` for clarity. Restored two help message constants in `Constants.cs` related to throughput buckets and added a new constant to improve usability in Cosmos DB resource management.
Updated `Test-SqlThroughputCmdlets` in `SqlOperationsTests.ps1` to add assertions for `ThroughputBuckets`. The test now verifies the count of buckets and checks the `Id` and `MaxThroughputPercentage` for each bucket to ensure expected values are set correctly.
Corrected the parameter name from `-Name $AccountName` to `-AccountName $AccountName` in the `Update-AzCosmosDBSqlContainerThroughput` function calls within `SqlOperationsTests.ps1`. This change ensures proper parameter usage and consistency across test cases, including instances with empty `-ThroughputBuckets`.
Refactor throughput handling in Azure Cosmos DB management library.
Introduce `PSThroughputBucket` class to replace `ThroughputBucketResource`.
Modify `CreateThroughputSettingsObject` to accept an array of
`PSThroughputBucket`. Update `ThroughputSettingsGetResults` to ensure
consistent usage of the new type, improving type safety and aligning
with the updated data model for throughput settings.
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

@msJinLei
Copy link
Contributor

/azp run

Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Introduced `New-AzCosmosDBThroughputBucketObject` cmdlet to create CosmosDB Throughput Bucket objects, complete with documentation updates for synopsis, syntax, and examples.

Enhanced existing CosmosDB cmdlets to support a new `-ThroughputBuckets` parameter, allowing users to specify multiple throughput buckets for better resource management. Updated documentation for all affected cmdlets to reflect these changes.
@msJinLei
Copy link
Contributor

/azp run

Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@Achint-Agrawal
Copy link
Author

Hey @msJinLei
Could you please help me with why the tests might be failing. I see failures where "New-AzCosmosDBLocationObject" is not found. This is not a cmdlet I have modified / removed and I still see it in the preview branch (Az.CosmosDB-preview). How can I debug this?

@pjohari-ms pjohari-ms requested a review from wyunchi-ms May 23, 2025 18:59
Enhanced the synopsis and description for the command by replacing placeholder text with a specific description. Added an example to illustrate usage, demonstrating how to create a new throughput bucket object with parameters. The parameters section remains unchanged.
@msJinLei
Copy link
Contributor

/azp run

Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

@msJinLei
Copy link
Contributor

msJinLei commented May 26, 2025

  There are failed tasks: UXMetadata CmdletDiff GenertedSdk
  Write-Error: Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
     at Tools.Common.Loaders.MetadataLoader.GetModuleMetadata(String moduleName) in D:\a\_work\1\s\tools\Tools.Common\Loaders\MetadataLoader.cs:line 39
     at StaticAnalysis.UXMetadataAnalyzer.UXMetadataAnalyzer.Analyze(IEnumerable`1 cmdletProbingDirs, Func`2 directoryFilter, Func`2 cmdletFilter, IEnumerable`1 modulesToAnalyze) in D:\a\_work\1\s\tools\StaticAnalysis\UXMetadataAnalyzer\UXMetadataAnalyzer.cs:line 117
     at StaticAnalysis.UXMetadataAnalyzer.UXMetadataAnalyzer.Analyze(IEnumerable`1 cmdletProbingDirs, IEnumerable`1 modulesToAnalyze) in D:\a\_work\1\s\tools\StaticAnalysis\UXMetadataAnalyzer\UXMetadataAnalyzer.cs:line 71
     at StaticAnalysis.Program.Main(String[] args) in D:\a\_work\1\s\tools\StaticAnalysis\Program.cs:line 189

There is an error in build
image

@msJinLei
Copy link
Contributor

CI fails of build error

D:\a\_work\1\s\src\CosmosDB\CosmosDB\SQL\NewAzCosmosDBSqlVectorEmbedding.cs(25,62): error CS0117: 'Constants' does not contain a definition
 for 'VectorEmbeddingPathHelpMessage' [D:\a\_work\1\s\src\CosmosDB\CosmosDB\CosmosDB.csproj]
D:\a\_work\1\s\src\CosmosDB\CosmosDB\SQL\NewAzCosmosDBSqlVectorEmbedding.cs(29,62): error CS0117: 'Constants' does not contain a definition for 'VectorEmbeddingDataTypeHelpMessage' [D:\a\_work\1\s\src\CosmosDB\CosmosDB\CosmosDB.csproj]
D:\a\_work\1\s\src\CosmosDB\CosmosDB\SQL\NewAzCosmosDBSqlVectorEmbedding.cs(33,62): error CS0117: 'Constants' does not contain a definition for 'VectorEmbeddingDistanceFunctionHelpMessage' [D:\a\_work\1\s\src\CosmosDB\CosmosDB\CosmosDB.csproj]
D:\a\_work\1\s\src\CosmosDB\CosmosDB\SQL\NewAzCosmosDBSqlVectorEmbedding.cs(37,62): error CS0117: 'Constants' does not contain a definition for 'VectorEmbeddingDimensionsHelpMessage' [D:\a\_work\1\s\src\CosmosDB\CosmosDB\CosmosDB.csproj]
D:\a\_work\1\s\src\CosmosDB\CosmosDB\SQL\NewAzCosmosDBSqlVectorEmbeddingPolicy.cs(26,62): error CS0117: 'Constants' does not contain a definition for 'VectorEmbeddingPolicyVectorEmbeddingHelpMessage' [D:\a\_work\1\s\src\CosmosDB\CosmosDB\CosmosDB.csproj]
D:\a\_work\1\s\src\CosmosDB\CosmosDB\SQL\NewAzCosmosDBSqlIndexingPolicy.cs(49,63): error CS0117: 'Constants' does not contain a definition for 'IndexingPolicyVectorIndexHelpMessage' [D:\a\_work\1\s\src\CosmosDB\CosmosDB\CosmosDB.csproj]
    0 Warning(s)
    6 Error(s)

[Cmdlet(VerbsCommon.New, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "CosmosDBThroughputBucketObject"), OutputType(typeof(PSThroughputBucket))]
public class NewAzCosmosDBThroughputBucketObject : AzureCosmosDBCmdletBase
{
[Parameter(Mandatory = true, HelpMessage = Constants.ThroughputBucketIdHelpMessage)]
Copy link
Contributor

Choose a reason for hiding this comment

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

The compilation error says the definition of Constants is not able to be found.

Copy link

This PR was labeled "needs-revision" because it has unresolved review comments or CI failures.
Please resolve all open review comments and make sure all CI checks are green. Refer to our guide to troubleshoot common CI failures.

@msJinLei
Copy link
Contributor

/azp run

Copy link
Contributor

Azure Pipelines successfully started running 3 pipeline(s).

Updated the Azure Cosmos DB PowerShell module to replace
all instances of "ThroughputBuckets" with "ThroughputBucketsObject".
This change affects test scripts, helper classes, and model
definitions, ensuring consistency in the API. Help messages
related to these parameters have also been updated for clarity
on throughput bucket usage in Cosmos DB operations.
…mmands

Renamed `-ThroughputBuckets` to `-ThroughputBucketsObject`
across multiple Azure CosmosDB command documentation files.
This change clarifies the expected input type, indicating
that the parameter accepts an array of `PSThroughputBucket` objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants