squasher-go handler for
log/slog, or record them on spans with OpenTelemetry. This page is tested with squasher-go
v0.1.0 and OpenTelemetry Go 1.46 on Go 1.27.
Send logs with the slog handler
1
Install the module
2
Create the handler
main.go
slog.LevelError become issues, titled
with the log message. The attributes go to the event as tags and extra data, and an error value
becomes its message text. A service attribute sets the service name in Squasher.
Flush waits until the queued records are sent. Close sends the rest and stops the handler.
Call one of them before the process exits, or the last records are lost.
Handler options
When the ingest key or the project ID is empty, the handler sends nothing.
Handler limits
- The handler sends no environment. Automatic AI triage runs only on
productionissues, so it does not run on these issues. To triage one, select Run triage in the Squasher triage card on the issue page. For an environment, use OpenTelemetry. - The handler sends no stack traces.
- It sends one HTTP request for each record, without batches or retries. When the queue is full, or when a request fails, the record is lost.
Send errors with OpenTelemetry
1
Install the modules
2
Set the exporter variables
3
Start a tracer provider
main.go
provider.Shutdown sends the spans that are still queued.4
Record errors on spans
checkout.go
card declined. RecordError on a span without the error status also makes an issue, titled
with the error message.Send a test error
- slog handler: run
slog.Error("Squasher test error"), then callhandler.Flush. - OpenTelemetry: end a span with
span.SetStatus(codes.Error, "Squasher test error"), then callprovider.Shutdown.
Give the setup to a coding agent
Copy this prompt into your coding agent to set up Go the same way:Next steps
OpenTelemetry
See which OTLP data Squasher accepts.
HTTP API
Post events without a module.
Read AI triage
Learn what the triage summary tells you.
Troubleshooting
Find out why an event does not appear.