Add JMX MBean for getting tracer flare files #10310
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What Does This Do
Allow flare dumps and individual files from flares to be downloaded with JMX.
Motivation
This work was originally paired with adding a way to get the long-running traces queue in #10309. I initially started by adding JMX MBeans to retrieve just the pending and long running traces and counters. Once I added the long running traces to the flare report to parity with pending traces, I realized that a more generic mechanism to allow getting flare details over JMX might be useful. After adding a TracerFlare MBean, this seemed like a far more valuable route and I removed the code I had added for pending/long running trace MBeans.
Additional Notes
This was originally part of #9874, which is being broken out into a few individual PRs.
Commit notes:
add*methods as-is, but this could be simplified by refactoring theadd*methods intoReporterinstances (with a new signature that passes a few more parameters toaddReportToFlare). I think this refactoring would be a good change to make--let me know and I'll happily do that. I also considered not making the zip file an intermediary, and if you like, I could look at what that change might be, as well.The JMX telemetry feature is controlled by
dd.telemetry.jmx.enabledand is disabled by default. This option enables both JMXFetch telemetry (when JMXFetch is enabled, which it is by default) and the new tracer flare MBean atdatadog.flare:type=TracerFlare. This new MBean exposes three operations:java.lang.String listFlareFiles()java.lang.String getFlareFile(java.lang.String p1, java.lang.String p2)java.lang.String generateFullFlareZip()An easy way to enable this for testing is to add these arguments:
To test, you can use jmxterm (https://github.com/jiaqi/jmxterm) like this:
Contributor Checklist
type:and (comp:orinst:) labels in addition to any useful labelsclose,fixor any linking keywords when referencing an issue.Use
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]