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

Replace stringLeading method with Java 8 friendlty alternative #902

Merged
merged 3 commits into from
Oct 5, 2024

Conversation

harrryr
Copy link
Contributor

@harrryr harrryr commented Oct 3, 2024

Issue #, if available:
The stringLeading method is only available in Java 11+. This doesn't meet our requirement of ADOT Java being available for Java 8+. We need to find an alternative method.

Description of changes:
Refactor code to be Java 8 friendlty

Test run:
https://github.com/aws-observability/aws-otel-java-instrumentation/actions/runs/11158858146

Note
Previously, the test was failing Java 8 for EKS use case. With this new change, it is passing now.
This proves that:

  1. The function getDBStatementRemoteOperation, specfically stripLeading() is being tested by E2E test
  2. The new change does not affect Java 11+ and also fixes Java 8

Unit tests also show that combinations of different attributes all pass (Link)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@harrryr harrryr requested a review from a team as a code owner October 3, 2024 17:18
@harrryr harrryr merged commit 47ce3b1 into main Oct 5, 2024
4 checks passed
@harrryr harrryr deleted the fix-java-8-bug branch October 5, 2024 00:06
musa-asad pushed a commit to musa-asad/aws-otel-java-instrumentation that referenced this pull request Oct 8, 2024
…bservability#902)

*Issue #, if available:*
The stringLeading method is only available in Java 11+. This doesn't
meet our requirement of ADOT Java being available for Java 8+. We need
to find an alternative method.

*Description of changes:*
Refactor code to be Java 8 friendlty

*Test run:*

https://github.com/aws-observability/aws-otel-java-instrumentation/actions/runs/11158858146

*Note*
Previously, the test was failing Java 8 for EKS use case. With this new
change, it is passing now.
This proves that:
1. The function `getDBStatementRemoteOperation`, specfically
`stripLeading()` is being tested by E2E test
2. The new change does not affect Java 11+ and also fixes Java 8

Unit tests also show that combinations of different attributes all pass
([Link](https://github.com/aws-observability/aws-otel-java-instrumentation/blob/main/awsagentprovider/src/test/java/software/amazon/opentelemetry/javaagent/providers/AwsMetricAttributeGeneratorTest.java#L573))


By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
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.

3 participants