# getsentry/sentry-elixir architecture

> Architecture diagram of the GitHub repository getsentry/sentry-elixir, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/getsentry/sentry-elixir
- Repository: https://github.com/getsentry/sentry-elixir

## Overview

Sentry is the official Elixir SDK for reporting errors, logs, traces, metrics, and check-ins to Sentry. The principal workflow is an application invoking the SDK (or an attached handler/integration capturing activity), the client preparing and filtering telemetry, and the transport sending it. The README documents the major capture capabilities; sampled source confirms client dispatch and application startup wiring. Other subsystem links reflect module responsibilities and documented integrations, but their internal call chains were not sampled.

Main entry points: [`lib/sentry/telemetry_processor.ex`](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/telemetry_processor.ex) (Telemetry processor), [`lib/sentry/client.ex`](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/client.ex) (Event client), [`lib/sentry.ex`](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry.ex) (Sentry API), [`lib/sentry/opentelemetry/span_processor.ex`](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/opentelemetry/span_processor.ex) (Span processor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and context"]
  node_sentry_api["Sentry API<br/>[sentry.ex]"]
  node_client["Event client<br/>[client.ex]"]
  node_event["Event model<br/>[event.ex]"]
  node_config["Configuration<br/>[config.ex]"]
  node_plug_capture["Plug capture<br/>[plug_capture.ex]"]
  node_plug_context["Plug context<br/>[plug_context.ex]"]
  node_logger_handler["Logger handler<br/>[logger_handler.ex]"]
end

subgraph group_telemetry["Telemetry features"]
  node_logs_backend["Structured logs<br/>[logs_backend.ex]"]
  node_error_backend["Log error capture<br/>[error_backend.ex]"]
  node_transaction["Transactions<br/>[transaction.ex]"]
  node_otel_processor["Span processor<br/>[span_processor.ex]"]
  node_span_storage[("Span storage<br/>[span_storage.ex]")]
  node_metrics["Metrics API<br/>[metrics.ex]"]
  node_metric_batch["Metric batches<br/>[metric_batch.ex]"]
  node_checkin["Monitor check-ins<br/>[check_in.ex]"]
end

subgraph group_runtime["Runtime and integrations"]
  node_integrations["Framework integrations"]
  node_application["SDK supervision<br/>[application.ex]"]
end

subgraph group_delivery["Processing and delivery"]
  node_telemetry_processor["Telemetry processor"]
  node_transport_sender["Transport sender<br/>[sender.ex]"]
  node_http_client["HTTP client<br/>[http_client.ex]"]
end

node_app(("Elixir application"))
node_sentry_service(("Sentry service"))
node_plug(("Plug/Phoenix app"))
node_elixir_logger(("Elixir Logger"))
node_otel(("OpenTelemetry"))
node_oban_quantum(("Oban / Quantum"))

node_app -->|"reports through"| node_sentry_api
node_sentry_api -->|"submits events"| node_client
node_client -->|"processes event"| node_event
node_client -->|"reads options"| node_config
node_client -->|"dispatches telemetry"| node_telemetry_processor
node_client -->|"sends directly"| node_transport_sender
node_plug -->|"captures exceptions"| node_plug_capture
node_plug_capture -->|"reports exception"| node_sentry_api
node_plug -->|"provides request context"| node_plug_context
node_logger_handler -->|"captures errors"| node_error_backend
node_logger_handler -->|"forwards logs"| node_logs_backend
node_error_backend -->|"reports events"| node_sentry_api
node_logs_backend -->|"submits logs"| node_telemetry_processor
node_otel -.->|"processes spans"| node_otel_processor
node_otel_processor -->|"stores spans"| node_span_storage
node_otel_processor -->|"submits transactions"| node_telemetry_processor
node_app -->|"records metrics"| node_metrics
node_metrics -->|"batches metrics"| node_metric_batch
node_metric_batch -->|"submits metrics"| node_telemetry_processor
node_app -->|"reports check-ins"| node_checkin
node_checkin -->|"submits check-ins"| node_telemetry_processor
node_application -->|"attaches handler"| node_logger_handler
node_application -->|"starts integrations"| node_integrations
node_oban_quantum -.->|"emits job signals"| node_integrations
node_integrations -.->|"reports activity"| node_sentry_api
node_telemetry_processor -->|"dispatches batches"| node_transport_sender
node_transport_sender -->|"sends requests"| node_http_client
node_http_client -->|"posts telemetry"| node_sentry_service

click node_sentry_api "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry.ex"
click node_client "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/client.ex"
click node_event "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/event.ex"
click node_config "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/config.ex"
click node_plug_capture "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/plug_capture.ex"
click node_plug_context "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/plug_context.ex"
click node_logger_handler "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/logger_handler.ex"
click node_logs_backend "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/logger_handler/logs_backend.ex"
click node_error_backend "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/logger_handler/error_backend.ex"
click node_transaction "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/transaction.ex"
click node_otel_processor "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/opentelemetry/span_processor.ex"
click node_span_storage "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/opentelemetry/span_storage.ex"
click node_metrics "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/metrics.ex"
click node_metric_batch "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/metric_batch.ex"
click node_checkin "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/check_in.ex"
click node_integrations "https://github.com/getsentry/sentry-elixir/tree/master/lib/sentry/integrations"
click node_application "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/application.ex"
click node_telemetry_processor "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/telemetry_processor.ex"
click node_transport_sender "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/transport/sender.ex"
click node_http_client "https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/http_client.ex"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sentry_api,node_client,node_event,node_config,node_plug_capture,node_plug_context,node_logger_handler toneBlue
class node_logs_backend,node_error_backend,node_transaction,node_otel_processor,node_span_storage,node_metrics,node_metric_batch,node_checkin toneAmber
class node_integrations,node_application toneMint
class node_telemetry_processor,node_transport_sender,node_http_client toneRose
class node_app,node_sentry_service,node_plug,node_elixir_logger,node_otel,node_oban_quantum toneIndigo
```

## Components

### Capture and context

- [Sentry API](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry.ex): `lib/sentry.ex`
- [Event client](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/client.ex): `lib/sentry/client.ex`
- [Event model](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/event.ex): `lib/sentry/event.ex`
- [Configuration](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/config.ex): `lib/sentry/config.ex`
- [Plug capture](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/plug_capture.ex): `lib/sentry/plug_capture.ex`
- [Plug context](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/plug_context.ex): `lib/sentry/plug_context.ex`
- [Logger handler](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/logger_handler.ex): `lib/sentry/logger_handler.ex`

### Telemetry features

- [Structured logs](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/logger_handler/logs_backend.ex): `lib/sentry/logger_handler/logs_backend.ex`
- [Log error capture](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/logger_handler/error_backend.ex): `lib/sentry/logger_handler/error_backend.ex`
- [Transactions](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/transaction.ex): `lib/sentry/transaction.ex`
- [Span processor](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/opentelemetry/span_processor.ex): `lib/sentry/opentelemetry/span_processor.ex`
- [Span storage](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/opentelemetry/span_storage.ex): `lib/sentry/opentelemetry/span_storage.ex`
- [Metrics API](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/metrics.ex): `lib/sentry/metrics.ex`
- [Metric batches](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/metric_batch.ex): `lib/sentry/metric_batch.ex`
- [Monitor check-ins](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/check_in.ex): `lib/sentry/check_in.ex`

### Runtime and integrations

- [Framework integrations](https://github.com/getsentry/sentry-elixir/tree/master/lib/sentry/integrations): `lib/sentry/integrations`
- [SDK supervision](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/application.ex): `lib/sentry/application.ex`

### Processing and delivery

- [Telemetry processor](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/telemetry_processor.ex): `lib/sentry/telemetry_processor.ex`
- [Transport sender](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/transport/sender.ex): `lib/sentry/transport/sender.ex`
- [HTTP client](https://github.com/getsentry/sentry-elixir/blob/master/lib/sentry/http_client.ex): `lib/sentry/http_client.ex`

### Other components

- **Elixir application**
- **Sentry service**
- **Plug/Phoenix app**
- **Elixir Logger**
- **OpenTelemetry**
- **Oban / Quantum**

## Connections

- Elixir application → Sentry API: reports through
- Sentry API → Event client: submits events
- Event client → Event model: processes event
- Event client → Configuration: reads options
- Event client → Telemetry processor: dispatches telemetry
- Event client → Transport sender: sends directly
- Plug/Phoenix app → Plug capture: captures exceptions
- Plug capture → Sentry API: reports exception
- Plug/Phoenix app → Plug context: provides request context
- Logger handler → Log error capture: captures errors
- Logger handler → Structured logs: forwards logs
- Log error capture → Sentry API: reports events
- Structured logs → Telemetry processor: submits logs
- OpenTelemetry → Span processor: processes spans
- Span processor → Span storage: stores spans
- Span processor → Telemetry processor: submits transactions
- Elixir application → Metrics API: records metrics
- Metrics API → Metric batches: batches metrics
- Metric batches → Telemetry processor: submits metrics
- Elixir application → Monitor check-ins: reports check-ins
- Monitor check-ins → Telemetry processor: submits check-ins
- SDK supervision → Logger handler: attaches handler
- SDK supervision → Framework integrations: starts integrations
- Oban / Quantum → Framework integrations: emits job signals
- Framework integrations → Sentry API: reports activity
- Telemetry processor → Transport sender: dispatches batches
- Transport sender → HTTP client: sends requests
- HTTP client → Sentry service: posts telemetry
