OpenObserve Docs
IngestionProfiles

Java Profiling with async-profiler

async-profiler 4.2+ attaches to a JVM and can push OTLP Profiles (-o otlp).

Experimental OTLP output

async-profiler's -o otlp output is still experimental. Re-test after you upgrade async-profiler.

Send profiles

Run a Collector with the OTLP Profiles exporter, then point asprof at it:

asprof --loop 60s -e cpu -o otlp \
  -f http://127.0.0.1:4318/v1development/profiles \
  8983

Replace 8983 with the JVM PID. --loop 60s starts a new 60-second profile each window and POSTs it.

Start with the JVM instead of attaching later. -agentpath:lib=options is one argument — no space before =.

java -agentpath:/path/to/libasyncProfiler.so=start,event=cpu,loop=60s,otlp,file=http://127.0.0.1:4318/v1development/profiles \
  -jar app.jar

Events

GoalFlags
CPU-e cpu (default)
Allocations-e alloc
Lock contention-e lock

See async-profiler profiling modes for wall-clock, native memory, and other events (asprof list).

Do not use --all in production

--all turns on CPU, wall, allocation, lock, and native-memory profiling at the same time. Overhead is high. For continuous profiling, pick one event from the table above.

Verify in OpenObserve

Java profiles flame graph in OpenObserve

Next steps

Need some help?

Was this page helpful?

Last updated on

On this page