open-telemetry / opentelemetry-java-contrib

https://opentelemetry.io
Apache License 2.0
158 stars 125 forks source link

Sending JFR RecordingOptions with a diagnostic command may fail on Java 8 #1338

Closed dsgrieve closed 2 months ago

dsgrieve commented 3 months ago

Component(s)

jfr-connection

What happened?

Description

Time based recording options (time and age) are sent with a space between the value and units, e.g. "6000 ms", which may cause an issue with Java 8/Diagnostic Command.

Steps to Reproduce

Create an application with FlightRecorderDiagnosticCommandConnection which sets the 'time' or 'age' option for a recording. This causes an issue with Oracle Java 8.

Expected Result

No exception returned from the diagnostic command mbean.

Actual Result

Component version

1.36.0

Log output

com.microsoft.jfr.JfrStreamingException: Java 8 currently only supports predefined configurations (default/profile)       at com.microsoft.jfr.dcmd.FlightRecorderDiagnosticCommandConnection.formOptions(FlightRecorderDiagnosticCommandConnection.java:135)       at com.microsoft.jfr.dcmd.FlightRecorderDiagnosticCommandConnection.startRecording(FlightRecorderDiagnosticCommandConnection.java:109)       at com.microsoft.jfr.Recording.start(Recording.java:116)

Additional context

This is an issue that was reported by a third party using the com.microsoft:jfr-streaming classes, which is where jfr-connection comes from. So this issue is present in jfr-connection as well. This issue won't be fixed in com.microsoft:jfr-streaming since that code is no longer maintained.

dsgrieve commented 3 months ago

PR https://github.com/open-telemetry/opentelemetry-java-contrib/pull/1352