Skip to content

Use Metrics implementation from the base JDK for container detection support #7246

@jerboaa

Description

@jerboaa

Feature request

GraalVM native-image historically included a fork of OpenJDK's system metrics classes. Since then, the Metrics implementation as part of the JDK as undergone many revisions and bug fixes. The GraalVM code clone, on the other hand, has had few updates. One approach would be to update the GraalVM code and keep it in sync with the JDK code. A better way, however, seems to be to use the Metrics classes from the JDK so as to get fixes in GraalVM by nature of the JDK code getting fixed.

Is your feature request related to a problem?

This move would avoid the following issues observed by GraalVM users in the wild:

Describe the solution you'd like.

First propose a minimal patch to OpenJDK so as to avoid the cyclic dependency of Metrics with ByteBuffers. Then, remove the metrics copy of substrate like this exemplary patch.

Describe who do you think will benefit the most.

GraalVM users who run GraalVM and/or produced native images on a wide variety of container orchestration frameworks (common case these days).

Describe alternatives you've considered.

The alternative is to keep the copy and update it regularly with JDK code changes, which is a maintenance headache.

Additional context.

This move also would avoid needing to write separate container testing framework in GraalVM as the JDK has tests covering such scenarios.

Express whether you'd like to help contributing this feature

I'm happy to contribute the minimal OpenJDK change upstream, produce relevant backports for it, and then remove the clone in GraalVM and replacing it by the JDK version instead.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions