Add sanitization to metric names and labels#6277
Merged
Merged
Conversation
Signed-off-by: Kondaka <krishkdk@amazon.com>
dlvenable
requested changes
Nov 18, 2025
| awsCredentialsSupplier.getProvider(convertToCredentialOptions(config.getAwsConfig())) : | ||
| awsCredentialsSupplier.getProvider(AwsCredentialsOptions.builder().build()); | ||
|
|
||
| /* |
Member
There was a problem hiding this comment.
Please delete this code entirely.
| import org.junit.jupiter.api.Test; | ||
| import org.mockito.Mock; | ||
| import static org.mockito.ArgumentMatchers.any; | ||
|
|
Member
There was a problem hiding this comment.
Let's add the auto-test annotation to this test or to a new test. It automatically generates a couple of tests to ensure the plugin is correct. With more tests to come.
|
|
||
| private static String sanitizeMetricName(String name) { | ||
| return sanitizeName(name, true); // metric names allow colon | ||
| // See https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/translator/prometheus |
Member
There was a problem hiding this comment.
Turn this into a Javadoc comment.
/**
* @see https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/translator/prometheus
*/
graytaylor0
reviewed
Nov 18, 2025
| this.config = config; | ||
| this.credentialsProvider = awsCredentialsSupplier.getProvider(AwsCredentialsOptions.builder() | ||
| this.credentialsProvider = (config.getAwsConfig() != null) ? | ||
| awsCredentialsSupplier.getProvider(convertToCredentialOptions(config.getAwsConfig())) : |
Member
There was a problem hiding this comment.
Nit: Would be a little cleaner to just have the method convertToCredentialOptions do the logic to get if aws config is null
graytaylor0
previously approved these changes
Nov 18, 2025
Signed-off-by: Kondaka <krishkdk@amazon.com>
Signed-off-by: Kondaka <krishkdk@amazon.com>
dlvenable
previously approved these changes
Nov 19, 2025
Signed-off-by: Kondaka <krishkdk@amazon.com>
Signed-off-by: Kondaka <krishkdk@amazon.com>
dlvenable
approved these changes
Nov 19, 2025
graytaylor0
approved these changes
Nov 19, 2025
eatulban
pushed a commit
to eatulban/data-prepper
that referenced
this pull request
Dec 11, 2025
* Add sanitization to metric names and labels Signed-off-by: Kondaka <krishkdk@amazon.com> * Addressed review comments Signed-off-by: Kondaka <krishkdk@amazon.com> * Fixed build issues Signed-off-by: Kondaka <krishkdk@amazon.com> * Addressed comments Signed-off-by: Kondaka <krishkdk@amazon.com> * Removed unnecessary debug statement Signed-off-by: Kondaka <krishkdk@amazon.com> --------- Signed-off-by: Kondaka <krishkdk@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add sanitization to metric names and labels
Issues Resolved
Resolves #[Issue number to be closed when this PR is merged]
Check List
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.