Skip to content

feat(profiling): Reference-count RecordingData lifecycle - #12869

Draft
jbachorik wants to merge 1 commit into
jb/otlp-profile-exporterfrom
jb/otlp-profile-recording-data
Draft

jbachorik wants to merge 1 commit into
jb/otlp-profile-exporterfrom
jb/otlp-profile-recording-data

Conversation

@jbachorik

@jbachorik jbachorik commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

Adds retain and release reference counting to RecordingData.

  • RecordingData gains retain() and release() next to close(). The recording stream stays open until the last consumer releases its reference.
  • The OpenJDK, OracleJDK, and ddprof controller backends implement the new contract.
  • RecordingDataRefCountingTest covers the behavior.

Motivation

The profiling controller hands a RecordingData to a listener, and close() ends the recording. One consumer model exists today. The OTLP profiles uploader needs a second consumer of the same recording. It must read the JFR data and send it as OTLP/P while the streaming path still reads it.

With the current API the two consumers conflict. The first close() can end the recording while the uploader still reads it. The upload then sends an incomplete profile. The uploader can also hold the recording open after both consumers finish. The recording then leaks, and its file grows.

Retain and release reference counting solves both cases. Each consumer holds a reference. The recording closes only after the last consumer releases its reference.

This PR changes only the RecordingData contract and its backend implementations. The uploader that uses it comes in a later PR of the stack.

Additional Notes

Part of a 5-PR stack. Each PR bases on the previous one.

  1. The payload and request body move (refactor: Move OtlpPayload and OTLP request bodies to communication/otlp-exporter #12880)
  2. The sender extraction and the canonical resource attributes (refactor: Extract OTLP sender infrastructure to communication/otlp-exporter #12868)
  3. this PR: RecordingData reference counting
  4. JFR to OTLP/P converter, profiling-otel, plus jafar 0.26.2 (feat(profiling): Add JFR to OTLP/P converter with CLI, benchmarks and validation #12870)
  5. OTLP profiles export wiring (feat(profiling): Integrate OTLP profiles export into the agent #12871)

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@jbachorik jbachorik added type: feature request comp: profiling Profiling tag: ai generated Largely based on code generated by an AI or LLM labels Oct 14, 2026
@jbachorik
jbachorik force-pushed the jb/otlp-profile-exporter branch from b0a1f0c to 7a58fb1 Compare October 14, 2026 15:34
@jbachorik
jbachorik force-pushed the jb/otlp-profile-recording-data branch from d4cc2e2 to 3279bdf Compare October 14, 2026 15:34
@jbachorik
jbachorik force-pushed the jb/otlp-profile-exporter branch from 7a58fb1 to 31cd858 Compare October 14, 2026 16:04
@jbachorik
jbachorik force-pushed the jb/otlp-profile-recording-data branch from 3279bdf to 318c6c6 Compare October 14, 2026 16:04
@jbachorik
jbachorik force-pushed the jb/otlp-profile-exporter branch from 31cd858 to 252a892 Compare October 14, 2026 21:47
@jbachorik
jbachorik force-pushed the jb/otlp-profile-recording-data branch from 318c6c6 to 5f9a4f9 Compare October 14, 2026 21:47
@jbachorik
jbachorik force-pushed the jb/otlp-profile-exporter branch from 252a892 to 7c38d31 Compare October 14, 2026 21:57
@jbachorik jbachorik closed this Oct 14, 2026
@jbachorik
jbachorik force-pushed the jb/otlp-profile-recording-data branch from 5f9a4f9 to 7c38d31 Compare October 14, 2026 21:57
@jbachorik jbachorik reopened this Oct 14, 2026
@jbachorik
jbachorik force-pushed the jb/otlp-profile-recording-data branch from 32bf8d2 to 07c532b Compare October 14, 2026 22:23
@jbachorik
jbachorik force-pushed the jb/otlp-profile-exporter branch from bfc7a00 to 86dfa6b Compare October 14, 2026 22:31
@jbachorik
jbachorik force-pushed the jb/otlp-profile-recording-data branch from 07c532b to ee2a515 Compare October 14, 2026 22:31
@jbachorik
jbachorik force-pushed the jb/otlp-profile-exporter branch from 86dfa6b to ca32ced Compare October 14, 2026 22:38
@jbachorik
jbachorik force-pushed the jb/otlp-profile-recording-data branch from ee2a515 to eb9c523 Compare October 14, 2026 22:38
@jbachorik
jbachorik force-pushed the jb/otlp-profile-exporter branch from ca32ced to d1c356d Compare October 14, 2026 22:44
@jbachorik
jbachorik force-pushed the jb/otlp-profile-recording-data branch from eb9c523 to 60154aa Compare October 14, 2026 22:44
@jbachorik
jbachorik force-pushed the jb/otlp-profile-exporter branch from d1c356d to f36694b Compare October 14, 2026 22:45
@jbachorik
jbachorik force-pushed the jb/otlp-profile-recording-data branch 3 times, most recently from 69f3438 to e366b70 Compare October 14, 2026 22:51
RecordingData gains explicit retain/release semantics so multiple
consumers (recording streaming and the OTLP uploader) can share a
recording without one side closing it prematurely. Implemented across
the OpenJDK, OracleJDK and ddprof controller backends.
@jbachorik
jbachorik force-pushed the jb/otlp-profile-recording-data branch from e366b70 to 2f76dd4 Compare October 14, 2026 22:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: profiling Profiling tag: ai generated Largely based on code generated by an AI or LLM type: feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant