Skip to content

Add logging for when secret is unable to be retrieved#6014

Merged
graytaylor0 merged 1 commit into
opensearch-project:mainfrom
graytaylor0:AddLogging
Aug 26, 2025
Merged

Add logging for when secret is unable to be retrieved#6014
graytaylor0 merged 1 commit into
opensearch-project:mainfrom
graytaylor0:AddLogging

Conversation

@graytaylor0

@graytaylor0 graytaylor0 commented Aug 25, 2025

Copy link
Copy Markdown
Member

Description

Adds error log that is swallowed for when secret can't be retrieved.

Issues Resolved

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

try {
getSecretValueResponse = secretsManagerClient.getSecretValue(getSecretValueRequest);
} catch (Exception e) {
LOG.error("Unable to retrieve secret {}", getSecretValueRequest.secretId(), e);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we shutdown the pipeline in this case?
In the case of SAAS based pipelines, either won't even come up in this case or even if it comes up, it will be retrying forever which will be no use anyway!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's split this exception in two so that we can avoid walls of exceptions for expected errors.

catch(AwsException ex) {
             LOG.error("Unable to retrieve secret {}", getSecretValueRequest.secretId(), e.getMessage());
} catch(Exception ex) {
             LOG.error("Unable to retrieve secret {} due to unexpected error.", getSecretValueRequest.secretId(), e);
}

try {
getSecretValueResponse = secretsManagerClient.getSecretValue(getSecretValueRequest);
} catch (Exception e) {
LOG.error("Unable to retrieve secret {}", getSecretValueRequest.secretId(), e);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's split this exception in two so that we can avoid walls of exceptions for expected errors.

catch(AwsException ex) {
             LOG.error("Unable to retrieve secret {}", getSecretValueRequest.secretId(), e.getMessage());
} catch(Exception ex) {
             LOG.error("Unable to retrieve secret {} due to unexpected error.", getSecretValueRequest.secretId(), e);
}

@dlvenable

Copy link
Copy Markdown
Member

Also, the tests are failing. Maybe something with the PR?

@graytaylor0

Copy link
Copy Markdown
Member Author

Also, the tests are failing. Maybe something with the PR?

I don't think it's failing due to PR

Signed-off-by: Taylor Gray <tylgry@amazon.com>
@dlvenable

Copy link
Copy Markdown
Member

The failing tests are not caused by this and should be fixed in #6017.

@graytaylor0 graytaylor0 merged commit 161d880 into opensearch-project:main Aug 26, 2025
42 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants