Send errors with the Java agent
1
Download the agent
2
Set the exporter variables
3
Start your app with the agent
java.util.logging. Automatic AI triage runs only on issues from the
production environment, so set deployment.environment.name to production in production.
How errors become issues
- An unhandled exception in a request. The agent marks the server span as an error and records
the exception on it. Squasher makes an issue from the span, titled with the span name, for
example
GET /checkout. - A log record at error level. For example,
logger.error("checkout failed", e)in Logback, orLevel.SEVEREinjava.util.logging. Squasher makes an issue titled with the log message. The exception type, message, and stack trace become attributes of the record.
exception.stacktrace attribute.
Send errors with the HTTP API
This class posts one error to the ingest endpoint with the JDK HTTP client. It needs Java 17 or later, and no other dependencies.Squasher.java
Squasher.captureError(e) where you catch an exception. The request runs in the background,
so a process that exits at once can lose it. stack is shown as the stack trace on the issue page.
If your app already has a JSON library, use it to build the body. See the
HTTP API for all fields.
Sentry SDK for Java
If your app already uses the Sentry SDK for Java, set its DSN tohttps://<ingest key>@ingest.squasher.ai/1. The ingest key selects the project; the SDK needs a
number at the end. Squasher reads the gzip envelopes that the SDK sends and keeps its errors, traces,
logs, metrics, and sessions. See Sentry for a move from Sentry.
Send a test error
- Java agent: add a route that throws
new IllegalStateException("Squasher test error"), and open it once. - HTTP API: call
Squasher.captureError(new IllegalStateException("Squasher test error")).
Give the setup to a coding agent
Copy this prompt into your coding agent to set up Java the same way:Next steps
OpenTelemetry
See which OTLP data Squasher accepts.
HTTP API
See every field of the ingest endpoint.
Kubernetes
Send logs and metrics from a cluster.
Troubleshooting
Find out why an event does not appear.