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

Turn off CosmosDiagnostics when logging CosmosException #33589

Closed
fivetran-kevinzhao opened this issue Feb 17, 2023 · 2 comments · Fixed by #33209
Closed

Turn off CosmosDiagnostics when logging CosmosException #33589

fivetran-kevinzhao opened this issue Feb 17, 2023 · 2 comments · Fixed by #33209
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@fivetran-kevinzhao
Copy link

Query/Question
Currently, when our process encounters a CosmosException, massive amounts of useless message gets printed. See attached txt file.
openai-cosmosexception.txt

For example, I only want the contents of the innerErrorMessage

"innerErrorMessage":"PartitionKeyRange with id 333 in collection null doesn't exist","causeInfo":null,"responseHeaders":"{x-ms-substatus=1002}"

However, tons of CosmosDiagnostics messages get included in CosmosException.java#getMessage():

    public String getMessage() {
        try {
            ObjectNode messageNode = mapper.createObjectNode();
            messageNode.put("innerErrorMessage", this.innerErrorMessage());
            if (this.cosmosDiagnostics != null) {
                this.cosmosDiagnostics.fillCosmosDiagnostics(messageNode, (StringBuilder)null);
            }

            return mapper.writeValueAsString(messageNode);
        } catch (JsonProcessingException var2) {
            return this.cosmosDiagnostics == null ? this.innerErrorMessage() : this.innerErrorMessage() + ", " + this.cosmosDiagnostics.toString();
        }
    }

Is there a way to exclude fillCosmosDiagnostics() when logging the exception? It's causing problems in our logging system because it can't handle these massive logs.

Why is this not a Bug or a feature Request?
This is not a bug because it's an intentional design. It could be a feature request if turning off CosmosDiagnostics isn't already supported.

Setup (please complete the following information if applicable):

  • OS: MacOS
  • IDE: IntelliJ
  • Library/Libraries: com.azure:azure-cosmos:4.39.0

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

  • [ na] Query Added
  • [ x] Setup information Added
@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Feb 17, 2023
@joshfree joshfree added Cosmos Client This issue points to a problem in the data-plane of the library. labels Feb 22, 2023
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Feb 22, 2023
@ghost
Copy link

ghost commented Feb 22, 2023

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kushagraThapar, @TheovanKraay

@fivetran-kevinzhao
Copy link
Author

Hello any update here?

@FabianMeiswinkel FabianMeiswinkel self-assigned this Mar 28, 2023
@FabianMeiswinkel FabianMeiswinkel linked a pull request Mar 28, 2023 that will close this issue
6 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants