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

Verify class compatibility before attempting cast #1427

Closed
wants to merge 8 commits into from

Conversation

breedx-splk
Copy link
Contributor

There was a case in the field on an IBM J9 JVM, where an instance returned from ManagementFactory.getThreadMXBean() could not be cast safely to the com.sun.management.ThreadMXBean, even thought that class can be found on the classpath.

It looks like other implementations have also encountered this, and so this fix is inspired by those other workarounds.

@breedx-splk breedx-splk requested review from a team as code owners September 7, 2023 21:52
@@ -19,6 +19,7 @@
import static com.splunk.opentelemetry.instrumentation.jvmmetrics.AllocatedMemoryMetrics.METRIC_NAME;

import com.splunk.opentelemetry.instrumentation.jvmmetrics.AllocatedMemoryMetrics;
import io.micrometer.common.lang.NonNull;
Copy link
Collaborator

Choose a reason for hiding this comment

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

wrong import?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, micrometer has their own. 🙄

Copy link
Collaborator

Choose a reason for hiding this comment

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

why on earth would you want to use the micrometer one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This class is an implementation of a micrometer interface. That interface uses the micrometer specific annotation. Using an annotation that doesn't match the actual interface declaration seems hacky.

dependabot bot and others added 6 commits September 8, 2023 14:35
Bumps [io.grpc:grpc-bom](https://github.com/grpc/grpc-java) from 1.57.2 to 1.58.0.
- [Release notes](https://github.com/grpc/grpc-java/releases)
- [Commits](grpc/grpc-java@v1.57.2...v1.58.0)

---
updated-dependencies:
- dependency-name: io.grpc:grpc-bom
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Truncate process.command_args

* address review comment

* improve comment
Bumps [actions/cache](https://github.com/actions/cache) from 3.3.1 to 3.3.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v3.3.1...v3.3.2)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4.1.1 to 4.2.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](docker/build-push-action@v4.1.1...v4.2.1)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#1429)

* Bump com.google.protobuf:protobuf-bom from 3.24.2 to 3.24.3

Bumps [com.google.protobuf:protobuf-bom](https://github.com/protocolbuffers/protobuf) from 3.24.2 to 3.24.3.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/protobuf_release.bzl)
- [Commits](protocolbuffers/protobuf@v3.24.2...v3.24.3)

---
updated-dependencies:
- dependency-name: com.google.protobuf:protobuf-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* update licenses

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
@breedx-splk breedx-splk requested a review from a team as a code owner September 8, 2023 21:35
@@ -43,7 +43,7 @@ jobs:
java-version: 17

- name: Cache Gradle Wrapper
uses: actions/cache@v3.3.1
uses: actions/cache@v3.3.2
Copy link
Contributor

Choose a reason for hiding this comment

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

It appears some unrelated changes have been merged into this branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

had to merge due to conflict I think.

@breedx-splk
Copy link
Contributor Author

Superseded by #1435

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