Skip to content
dpsoftPublic

About

Java agent that acts as a proxy to the almighty Async Profiler

Topics

Resources

Contributing

Stars

38 stars

Watchers

4 watching

Forks

Latest commit

 

History

167 Commits

Folders and files

Repository files navigation

ap-agent

async-profiler over HTTP — one -javaagent, nothing to install. CPU, wall clock, allocations, locks and native memory as interactive flame graphs, heatmaps, JFR or Go-compatible pprof.

Maven Central CI Coverage Java 11+ async-profiler 4.6 License


A CPU profile requested with curl and explored in the browser

One curl against a running JVM: 30 seconds of CPU come back as an async-profiler 4.6 flame graph — zoom into a frame, search with a regex, switch to the tree view. Open it live.


What it does

  • Every async-profiler event over HTTP: cpu, wall, alloc, lock and nativemem (in bytes with params=total), one request per profile. Parameters and recipes →
  • Ready-to-share outputs: interactive flame graph and tree view, heatmap, JFR for JDK Mission Control, collapsed stacks and pprof.
  • Go pprof compatible: go tool pprof http://host:8080/debug/pprof/profile just works. Go mode →
  • Span filtering: tag your own units of work and keep only their samples, by tag regex or latency. How spans work →
  • Nothing to install: AP-Loader bundles the native profiler for Linux x64/arm64 and macOS; a profiler that cannot load is logged and never stops your application.
  • Self-contained: a 1.8 MB shaded jar whose dependencies cannot clash with yours, also usable as a library. Library usage →

Quickstart

curl -LO https://repo1.maven.org/maven2/io/github/dpsoft/ap-agent/0.2.0/ap-agent-0.2.0.jar
java -javaagent:ap-agent-0.2.0.jar -jar my-app.jar

# 30 seconds of CPU as a flame graph, or wall clock / allocations / locks / native memory
curl -o cpu.html "http://localhost:8080/profiler/profile?event=cpu&output=flame&duration=30"

# or straight into pprof
go tool pprof -http :8000 "http://localhost:8080/profiler/profile?event=cpu&output=pprof&duration=30"

The endpoint has no authentication and listens on all interfaces: bind it with -Dap-agent.server.host=127.0.0.1 or keep the port private. Configuration →

Documentation

Usage parameters, outputs, errors and recipes per event
Span filtering profiles of your own units of work
Go mode the /debug/pprof/* endpoints
Configuration settings, Docker and Kubernetes, requirements
Library usage serving profiles from your own HTTP endpoints
Upgrading from 0.1.x behaviour and API changes
Contributing building, the test suites and the benchmarks

Contributing · License (Apache-2.0) · built on async-profiler and AP-Loader

About

Java agent that acts as a proxy to the almighty Async Profiler

Topics

Resources

Contributing

Stars

38 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages