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

Added support for Java Flight Recorder features #106

Merged
merged 2 commits into from
Oct 7, 2021
Merged

Conversation

pivotal-david-osullivan
Copy link
Contributor

@pivotal-david-osullivan pivotal-david-osullivan commented Oct 6, 2021

Summary

This PR adds support for Java Flight Recorder features by adding flag -XX:StartFlightRecording=.

Support for configuring JFR via arguments is provided with optional environment variable BPL_JFR_ARGS. This accepts a comma separated list of any/all of the following arguments and their values, e.g. filename=/tmp/rec.jfr,dumponexit=true:

  • disk
  • dumponexit
  • filename
  • maxsize
  • maxage
  • settings
  • path-to-gc-roots
  • name
  • delay

Also adds missing license headers to other helpers

Use Cases

Enable Java Flight Recording for analysis via JMX or jcmd tool

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@pivotal-david-osullivan pivotal-david-osullivan requested a review from a team October 6, 2021 11:27
@pivotal-david-osullivan pivotal-david-osullivan added semver:minor A change requiring a minor version bump type:enhancement A general enhancement labels Oct 6, 2021
@pivotal-david-osullivan pivotal-david-osullivan force-pushed the flight_recorder branch 2 times, most recently from 759f0ea to db17ff0 Compare October 6, 2021 17:23
helper/jfr.go Outdated Show resolved Hide resolved
helper/jfr.go Outdated Show resolved Hide resolved
Copy link
Contributor

@dmikusa dmikusa left a comment

Choose a reason for hiding this comment

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

I think we're on the right path. A few comments for things I think we can improve.

I also got some test errors:

> richgo test ./...
PASS | github.com/paketo-buildpacks/libjvm
PASS | github.com/paketo-buildpacks/libjvm/calc
SKIP | github.com/paketo-buildpacks/libjvm/cmd/helper	[no test files]
PASS | github.com/paketo-buildpacks/libjvm/count
     | Suite: libjvm/helper
     | Total: 70 | Focused: 0 | Pending: 0
     | ...................................................................xx.
     | Passed: 68 | Failed: 2 | Skipped: 0
FAIL | Unit (0.04s)
FAIL |     Unit/libjvm/helper (0.03s)
FAIL |             Unit/libjvm/helper/JFR/$BPL_JAVA_FLIGHT_RECORDER_ENABLED/$BPL_JFR_ARGS_is_set/returns_an_error_if_a_JFR_argument_is_empty (0.00s)
     |             jfr_test.go:62:
     |                 Expected an error to have occurred.  Got:
     |                     <nil>: nil
FAIL |             Unit/libjvm/helper/JFR/$BPL_JAVA_FLIGHT_RECORDER_ENABLED/$BPL_JFR_ARGS_is_set/returns_an_error_if_JFR_arguments_are_not_parsable (0.00s)
     |             jfr_test.go:68:
     |                 Expected an error to have occurred.  Got:
     |                     <nil>: nil
FAIL | 	github.com/paketo-buildpacks/libjvm/helper	0.242s
SKIP | github.com/paketo-buildpacks/libjvm/internal	[no test files]

I think CI is failing similarly.

helper/jfr.go Outdated Show resolved Hide resolved
@pivotal-david-osullivan pivotal-david-osullivan force-pushed the flight_recorder branch 2 times, most recently from 2cdff16 to 6b36b98 Compare October 7, 2021 14:20
@dmikusa dmikusa merged commit 978c8ce into main Oct 7, 2021
@dmikusa dmikusa deleted the flight_recorder branch October 7, 2021 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor A change requiring a minor version bump type:enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants