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

Support global distribution configuration with Cosmos KV SDK #3021

Open
kate-goldenring opened this issue Feb 24, 2025 · 1 comment
Open

Comments

@kate-goldenring
Copy link
Contributor

kate-goldenring commented Feb 24, 2025

Cosmos DB supports configuring global replication of data; however, it is up to the client to specify which region to query data from by specifying preferredRegion in requests. When many language SDKs support this (Go, Java, Python, C#), the Rust SDK does not appear to support it. We will potentially need to add support there first in order to pull it into Spin

@kate-goldenring kate-goldenring self-assigned this Feb 24, 2025
@kate-goldenring
Copy link
Contributor Author

Breaking this down, we essentially want to determine or enable configuring the region specific URL. For example, if your database is named foo and exists in westus and eastus, the URLs are as follows:

We should at least enable configuring the region in the runtime config and then suffix that on the URL. A more comprehensive API would query the base URL in order to get the account properties. The following is an example response from the Azure docs:

{
    "_dbs": "//dbs/",
    "media": "//media/",
    "writableLocations": [
        {
            "Name": "West US",
            "DatabaseAccountEndpoint": "https://globaldbexample-westus.documents.azure.com:443/"
        }
    ],
    "readableLocations": [
        {
            "Name": "East US",
            "DatabaseAccountEndpoint": "https://globaldbexample-eastus.documents.azure.com:443/"
        }
    ],
    "MaxMediaStorageUsageInMB": 2048,
    "MediaStorageUsageInMB": 0,
    "ConsistencyPolicy": {
        "defaultConsistencyLevel": "Session",
        "maxStalenessPrefix": 100,
        "maxIntervalInSeconds": 5
    },
    "addresses": "//addresses/",
    "id": "globaldbexample",
    "_rid": "globaldbexample.documents.azure.com",
    "_self": "",
    "_ts": 0,
    "_etag": null
}

This could be used to confirm that the region is in fact available

@kate-goldenring kate-goldenring removed their assignment Feb 24, 2025
@kate-goldenring kate-goldenring moved this to Triage Needed in Spin Triage Mar 3, 2025
@kate-goldenring kate-goldenring moved this from Triage Needed to Backlog in Spin Triage Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

1 participant