Add dumpinterval and json agent options#233
Open
debedb wants to merge 2 commits intojenkinsci:masterfrom
Open
Conversation
Add two new agent options: - dumpinterval=N: periodically dump open file descriptors every N seconds using a daemon Timer thread - json: output dumps in single-line JSON format suitable for log aggregation (CloudWatch, ELK, etc.) Also includes a LeakyApp example that demonstrates both options with a multi-threaded app that intentionally leaks file descriptors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Add two new agent options for the file-leak-detector Java agent:
dumpinterval=N— Periodically dump all open file descriptors every N seconds using a daemonTimerthread. This is useful for monitoring file descriptor leaks in long-running services where you want continuous visibility without waiting for shutdown.json— Output dumps in single-line JSON format instead of plain text. Each dump is a single JSON line containing a timestamp, descriptor count, and an array of open descriptors with type, resource, thread, open time, and stack trace. This format is suitable for log aggregation systems (CloudWatch Logs, ELK, Splunk, etc.) and enables structured querying of leak data.Example agent string:
Sample JSON output:
{"timestamp":"2025-01-15T10:30:00.000Z","openDescriptors":3,"descriptors":[{"index":1,"type":"file","resource":"/tmp/leaky.tmp","thread":"main","openedAt":"...","stackTrace":["com.example.App.main(App.java:10)",...]}]}The PR also includes a
LeakyAppexample underexamples/that demonstrates both options with a multi-threaded application that intentionally leaks file descriptors.Testing done
mvn -DskipTests packageLeakyAppexample with both plain text (run.sh) and JSON (run-json.sh) modesjqSubmitter checklist