# Go, Rust & Elixir

> **For agents:** paste the DSN from `list_keys` into the snippet for the platform; create the project with the matching platform id (`create_project(org="acme", slug="web", name="Web", platform="go")`). Platforms on this page: `go`, `rust`, `phoenix`.

These SDKs send asynchronously and are unforgiving about process exit: flush (Go), keep the guard alive (Rust), or make sure the Logger handler is installed (Elixir) or short-lived processes drop their last events.

Replace `https://<public_key>@ingest.bugwatch.io/<project_number>` with the DSN from `list_keys` or the project's settings page.

## Go

- Platform id: `go` · Language: Go · Runs in: server
- Install: `go get github.com/getsentry/sentry-go`

```go
import sentry "github.com/getsentry/sentry-go"
import sentryhttp "github.com/getsentry/sentry-go/http"

func main() {
    if err := sentry.Init(sentry.ClientOptions{Dsn: "https://<public_key>@ingest.bugwatch.io/<project_number>", TracesSampleRate: 1.0, Release: version}); err != nil { log.Fatal(err) }
    defer sentry.Flush(2 * time.Second)

    handler := sentryhttp.New(sentryhttp.Options{Repanic: true}).Handle(mux)
    http.ListenAndServe(":8080", handler)
}
```

Lifecycle notes:

- Events are sent asynchronously — call sentry.Flush before exit or short-lived processes drop them.
- Panics in handlers are recovered by the sentryhttp middleware (Repanic: true re-throws so your own recovery still runs); goroutine panics need sentry.Recover() per goroutine.
- Gin, Echo, Fiber and gRPC have their own middleware packages.

## Rust

- Platform id: `rust` · Language: Rust · Runs in: server
- Install: `cargo add sentry`

```rust
fn main() {
    let _guard = sentry::init(("https://<public_key>@ingest.bugwatch.io/<project_number>", sentry::ClientOptions { release: sentry::release_name!(), traces_sample_rate: 1.0, ..Default::default() }));
    // keep _guard alive for the program's lifetime; it flushes on drop
}
```

Lifecycle notes:

- The guard must live until exit; dropping it flushes pending events.
- Panics are captured by the panic integration; for async runtimes use the tower/actix/tracing integrations for request scopes.

## Phoenix (Elixir)

- Platform id: `phoenix` · Language: Elixir · Runs in: server
- Install: `{:sentry, "~> 10.0"}`
- Files: config/prod.exs · lib/my_app/application.ex

```elixir
config :sentry, dsn: "https://<public_key>@ingest.bugwatch.io/<project_number>", environment_name: :prod, release: System.get_env("RELEASE")

# application.ex — capture Logger errors (crash reports, GenServer exits)
:logger.add_handler(:sentry_handler, Sentry.LoggerHandler, %{config: %{metadata: [:file, :line]}})

# endpoint.ex
use Sentry.PlugCapture
plug Sentry.PlugContext
```

Lifecycle notes:

- Plug errors are captured by Sentry.PlugCapture; process crashes reach you through the Logger handler, not the plug.
- Oban and other job runners report via the Logger handler with job metadata.

## Symbolication for this family

Frames are symbolic at build time; nothing to upload. Set `release` so deploys line up with issues.
