Skip to content

[QUERY] Is spring.cloud.azure.cosmos.content-response-on-write-enable a valid configurable property I have control over in Azure Spring Cosmos? #42590

Closed

Description

Query/Question
Is spring.cloud.azure.cosmos.content-response-on-write-enabled a valid autoconfiguration property? Should setting it to false result in the contentResponseOnWriteEnabled config option being disabled? Because I haven't gotten it to work.

I've tried it through my yaml configs like:

spring:
    cloud:
        azure:
            cosmos:
                endpoint: https://my-example-db-account.documents.azure.com:443
                key: my-secret-key
                database: my-db 
                populate-query-metrics: false
                client-telemetry-enabled: false
                content-response-on-write-enabled: false

And I've tried setting it while manually building up my client like what shows up in this example https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/azure-spring-data-cosmos/README.md#setup-configuration-class like this:

    ...

    @Bean
    public CosmosClientBuilder getCosmosClientBuilder() {
        this.azureKeyCredential = new AzureKeyCredential(key);
        DirectConnectionConfig directConnectionConfig = new DirectConnectionConfig();
        GatewayConnectionConfig gatewayConnectionConfig = new GatewayConnectionConfig();

        return new CosmosClientBuilder()
            .preferredRegions(preferredRegions)
            .contentResponseOnWriteEnabled(false)
            .endpoint(uri)
            .credential(azureKeyCredential)
            .directMode(directConnectionConfig, gatewayConnectionConfig)
            .clientTelemetryConfig(
                new CosmosClientTelemetryConfig()
                    .metricsOptions(
                        new CosmosMicrometerMetricsOptions()
                        .setEnabled(false)
                    )
                    .diagnosticsHandler(CosmosDiagnosticsHandler.DEFAULT_LOGGING_HANDLER));
    }

    ...

But neither seem to flip this option off according to the application output on startup once it builds the client:
Image


Disabling this option shows up in the recommended SDK best practices for performance, and it's listed as a valid configuration here: https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/configuration-properties-azure-cosmos-db

Any ideas?

Why is this not a Bug or a feature Request?
I'm trying to gather more information on if I'm doing something wrong or if this is just expected behavior.

Setup (please complete the following information if applicable):

  • OS: macOS, jdk21 (oracle open jdk 21.0.5)
  • Library/Libraries:
    • org.springframework.boot:spring-boot-starter-parent:3.3.3
    • com.azure.spring:spring-cloud-azure-dependencies:5.17.1
    • org.springframework.cloud:spring-cloud-dependencies:2023.0.3
    • com.azure.spring:spring-cloud-azure-starter-data-cosmos
    • com.azure.spring:spring-cloud-azure-starter-actuator

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Query Added
  • Setup information Added

Activity

  1. added
    customer-reportedIssues that are reported by GitHub users external to the Azure organization.
    needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.
    questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
    on Oct 25, 2024
  2. changed the title [-][QUERY] Is spring.cloud.azure.cosmos.content-response-on-write-enable a valid configurable property I have control over?[/-] [+][QUERY] Is spring.cloud.azure.cosmos.content-response-on-write-enable a valid configurable property I have control over in Azure Spring Cosmos?[/+] on Oct 25, 2024
  3. removed
    needs-triageWorkflow: This is a new issue that needs to be triaged to the appropriate team.
    on Oct 28, 2024
  4. joshfree commented on Oct 28, 2024

    @joshfree
    Member
  5. kushagraThapar commented on Oct 28, 2024

    @kushagraThapar
    Member

    Tony Murillo (@MapFilterMagic) you cannot set it to false in spring-data-cosmos. The reason behind this is because the contract with spring data framework is to return the entity that was saved when writing to the database. In order to follow the contract, we cannot set this to false.

  6. MapFilterMagic commented on Oct 28, 2024

    @MapFilterMagic
    Author

    @MapFilterMagic you cannot set it to false in spring-data-cosmos. The reason behind this is because the contract with spring data framework is to return the entity that was saved when writing to the database. In order to follow the contract, we cannot set this to false.

    Is this stated anywhere in the documentation? I feel like it showing up under the spring cloud properties is misleading? I could be wrong though.

  7. kushagraThapar commented on Oct 29, 2024

    @kushagraThapar
    Member

    It's not documented anywhere, since this is implementation detail. Regardless, I agree with you, it should not show up in the spring cloud properties since it gets overwritten anyway in spring data cosmos SDK.
    Rujun Chen (@rujche) / Xiaolu Dai (@saragluna) can we please fix this? The flag spring.cloud.azure.cosmos.content-response-on-write-enabled should not be exposed at all.

  8. saragluna commented on Oct 30, 2024

    @saragluna
    Member

    Got it, since it will be a breaking change, we will remove it in our next major release.

  9. removed this from the Backlog milestone on Nov 26, 2024
  10. locked and limited conversation to collaborators on Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Cosmosazure-spring-cosmosSpring cosmos related issues.customer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions