Skip to content
Back to search

airbroke

🔥 Lightweight, Airbrake/Sentry-compatible, PostgreSQL-based Open Source Error Catcher

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/icoretech/airbroke with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/icoretech/airbroke'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/icoretech--airbroke/badge.svg)](/listings/icoretech--airbroke)

HTML

<a href="/listings/icoretech--airbroke"><img src="/api/listings/icoretech--airbroke/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Please view all the available configuration variables in the [`.env.dist`](https://github.com/icoretech/airbroke/blob/main/.env.dist) file.

Airbroke requires `DATABASE_URL` at runtime. `DIRECT_URL` is required when you need a *direct* database connection for migrations (for example, when `DATABASE_URL` goes through PgBouncer or a data proxy). Some examples:

# Example Connection to Prisma Data Proxy
DATABASE_URL="prisma://__HOST__/?api_key=__KEY__"
# Example Connection to PostgreSQL
DATABASE_URL="postgresql://__USER__:__PASSWORD__@__HOST__:__PORT__/__DATABASE__?connection_limit=20&pool_timeout=10&application_name=airbroke"
# Direct connection to the database, used for migrations
DIRECT_URL="postgresql://__USER__:__PASSWORD__@__HOST__:__PORT__/__DATABASE__"

The optimal connection pool size without pgBouncer (`connection_limit`) can be calculated using the following formula:

connection_limit = (num_physical_cpus * 2 + 1) ÷ number_of_application_instances

For a system with 8 CPU cores and 3 application instances, the calculation would proceed as follows:

connection_limit = (8 * 2 + 1) ÷ 3
connection_limit = (16 + 1) ÷ 3
connection_limit = 17 ÷ 3
connection_limit ≈ 5.67

Since `connection_limit` must be an integer, it should be rounded down to the nearest whole number. In this scenario, each of the 3 application instances should have a `connection_limit` of `5`.

This limit can be set in your connection strings.

After deployment, you should be able to access your ingress (preferably secured with HTTPS) and start adding projects. This process will generate an API key that you can use with your Airbrake-compatible clients. This key, along with other essential information, will be provided to you.

About PgBouncer

To optimize your experience with Airbroke, as well as with Postgres overall, we advise integrating PgBouncer 1.24.0+ into your tech stack in transaction mode. For more comprehensive information, we recommend reviewing [Prisma's Connection Management documentation](https://www.prisma.io/docs/guides/performance-and-optimization/connection-management#external-connection-poolers), which provides insights on external connection poolers. We recommend not setting `pgbouncer=true` in the database connection string if you're using **PgBouncer 1.21.0 or later** ([source](https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer)).

About DIRECT_URL

The `DIRECT_URL` environment variable should be configured to establish a direct connection to the database. This is particularly crucial when using PgBouncer, as it enables migrations that cannot be executed through a data proxy. You can find more detailed information about this subject in the [Prisma's guide on configuring pgBouncer](https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer).

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 398 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <p align="center">
  2. <picture>
  3. <source media="(prefers-color-scheme: dark)" srcset="public/logo-full-dark.svg">
  4. <img src="public/logo-full.svg" height="400" alt="Airbroke">
  5. </picture>
  6. <h1 align="center">Open Source Error Catcher</h1>
  7. </p>
  8. <p align="center">
  9. <a aria-label="Build Status" href="https://github.com/icoretech/airbroke/actions/workflows/build.yml">
  10. <img alt="" src="https://img.shields.io/github/actions/workflow/status/icoretech/airbroke/build.yml?style=for-the-badge">
  11. </a>
  12. <a href="https://github.com/icoretech/airbroke/blob/main/LICENSE">
  13. <img alt="License" src="https://img.shields.io/github/license/icoretech/airbroke?style=for-the-badge" />
  14. </a>
  15. <a href="https://github.com/icoretech/airbroke/blob/main/package.json">
  16. <img alt="Version" src="https://img.shields.io/github/package-json/v/icoretech/airbroke?style=for-the-badge" />
  17. </a>
  18. </p>
  19. <div align="center">
  20. <img src="public/aidemo.gif" alt="Demo" width="600" />
  21. </div>
  22. ## Features
  23. > Airbroke is currently in active development! Using it in production environments is at your own discretion. We appreciate your feedback and support as we work towards a stable release.
  24. - :floppy_disk: Based on PostgreSQL
  25. - :globe_with_meridians: Airbrake(tm)/Sentry(tm)-compatible HTTP collector endpoints
  26. - :computer: Modern, React-based frontend for error management
  27. - :rocket: Designed with simplicity at its core
  28. - :wrench: Maintains small database footprint even under heavy data ingestion
  29. - :robot: Ask AI about issues
  30. - :clipboard: Provide cURL command to reproduce HTTP exceptions
  31. - :arrow_forward: Replay HTTP exceptions
  32. - :key: Supports multiple OAuth providers for secure user authentication
  33. - :bar_chart: Occurrence charts
  34. - :bookmark: Save and manage bookmarks for important occurrences
  35. - :electric_plug: MCP API for LLM/agent integrations
  36. ## System Requirements
  37. - Node.js 26.13.1+ compatible environment
  38. - Minimum of 300MB RAM
  39. - At least 1000 millicores, equivalent to 1 CPU core
  40. - PostgreSQL 15+ database
  41. - 8+ free database connections slots per instance
  42. ## Deployment Options
  43. Airbroke provides flexibility in deployment options. You can either deploy it from the built source code or use a multiarch Docker image. For Kubernetes deployments, a Helm chart is provided. As Airbroke is a Next.js 16 application, it can be deployed wherever a Node.js server is supported. This includes managed environments such as Vercel, Netlify, and Heroku.
  44. ### Build from source
  45. For a production build, you can run:
  46. ```sh
  47. cp .env.dist .env
  48. ```
  49. Then edit the `.env` file to set your own values.
  50. ```sh
  51. npm install --global corepack@0.36.0
  52. corepack enable
  53. yarn install
  54. yarn build
  55. ```
  56. This will generate a `.next` build output. Because this repo uses `output: "standalone"`, the runnable server output is in `.next/standalone` (see the `Dockerfile` for a working copy strategy / asset layout).
  57. You can also run `yarn start` to test the production build locally on port `3000`.
  58. ### Docker
  59. We publish images for both `amd64` and `arm64` architectures on [ghcr.io](https://github.com/icoretech/airbroke/pkgs/container/airbroke) but in case you want to build your own image you can do so.
  60. You can build the Docker image with:
  61. ```sh
  62. docker build --no-cache -t icoretech/airbroke:latest .
  63. ```
  64. You can then run the image locally with:
  65. ```sh
  66. docker run -p 3000:3000 icoretech/airbroke:latest
  67. ```
  68. ### Vercel
  69. [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Ficoretech%2Fairbroke&project-name=airbroke&repository-name=airbroke&env=DATABASE_URL%2CDIRECT_URL%2CBETTER_AUTH_SECRET%2CAIRBROKE_CORS_ORIGINS&envDescription=Required+env+vars+for+Airbroke+%28Prisma+%2B+Better+Auth%29.+Generate+a+random+BETTER_AUTH_SECRET.+Set+AIRBROKE_CORS_ORIGINS+to+your+app+origin%28s%29.&envLink=https%3A%2F%2Fgithub.com%2Ficoretech%2Fairbroke%2Fblob%2Fmain%2F.env.dist&envDefaults=%7B%22AIRBROKE_CORS_ORIGINS%22%3A%22*%22%7D&build-command=if+%5B+%22%24VERCEL_ENV%22+%3D+%22production%22+%5D%3B+then+corepack+yarn+db%3Amigrate%3B+fi+%26%26+corepack+yarn+build)
  70. While [testing on Vercel](https://nextjs.org/docs/app/getting-started/deploying) has not been conducted, Airbroke should be fully compatible.
  71. It's important to keep the following points in mind:
  72. - For optimal performance, ensure your database is located in the same region.
  73. - The endpoints under `/api/*` will be converted into serverless functions, which may introduce potential cold boot time.
  74. - If you connect directly to Postgres, use a pooler (or Prisma Accelerate / Data Proxy) to avoid exhausting DB connections.
  75. - Migrations must be executed as part of deployment. The Deploy Button above sets a `build-command` that runs DB migrations only for `VERCEL_ENV=production` before building (adjust this in your Vercel project settings if you need a different workflow).
  76. - The Deploy Button defaults `AIRBROKE_CORS_ORIGINS` to `*` for quick starts. After your first deploy, set it to your deployed origin (for example `https://<project>.vercel.app`) and any custom domains.
  77. Detailed instructions for this process can also be found in the [Prisma deployment guide for Vercel](https://www.prisma.io/docs/orm/prisma-client/deployment/serverless/deploy-to-vercel).
  78. ### Render.com
  79. [![Deploy with Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/icoretech/airbroke)
  80. The Render Deploy Button uses `render.yaml` (Render Blueprint). On the free tier, the template runs `yarn db:migrate` at boot (safe no-op if already applied). Airbroke allows all origins if `AIRBROKE_CORS_ORIGINS` is unset — once Render assigns your public URL, lock it down in the Render dashboard for production (this controls CORS for `/api/v3/notices` and `/api/sentry/*/envelope`).
  81. ### Railway
  82. Deploy the stable Airbroke image with a private PostgreSQL 18 database, persistent storage, generated application secrets, and migrations before startup.
  83. [![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/airbroke?referralCode=ftyt7p&utm_medium=integration&utm_source=template&utm_campaign=generic)
  84. Choose the GitHub organizations allowed to sign in. After deployment, configure a GitHub OAuth application using the generated domain. The [Railway deployment guide](deploy/railway/README.md) covers setup, screenshots, verification, backups, and upgrades.
  85. ### Netlify
  86. [![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/icoretech/airbroke)
  87. The Deploy to Netlify button is configured via `netlify.toml`. The build command runs DB migrations only for production deploys.
  88. Because you don't know your final `*.netlify.app` URL before the first deploy, you can start with `AIRBROKE_CORS_ORIGINS=*` and then tighten it to your deployed origin (for example `https://<site>.netlify.app`) and any custom domains.
  89. ### Heroku
  90. [![Deploy to Heroku](https://www.herokucdn.com/deploy/button.svg)](https://www.heroku.com/deploy?template=https://github.com/icoretech/airbroke)
  91. The Deploy to Heroku button uses `app.json` to provision add-ons and prompt for required environment variables.
  92. Because you don't know your final `*.herokuapp.com` URL before the app is created, you can start with `AIRBROKE_CORS_ORIGINS=*` and then tighten it to your deployed origin (for example `https://<app>.herokuapp.com`) and any custom domains.
  93. ### Helm
  94. You can deploy Airbroke to Kubernetes using the dedicated Helm chart.
  95. The Helm chart includes a `values.yaml` file with some default values that you can override with your own. It also includes a pgBouncer chart as optional dependency.
  96. When using Helm we recommend using a GitOps approach to deploy your application(s), such as [Flux](https://fluxcd.io/).
  97. Please find more information about the Helm chart in the dedicated repository: [icoretech/charts](https://github.com/icoretech/helm/tree/main/charts/airbroke)
  98. ### Docker Compose
  99. For users who prefer Docker Compose for managing multi-container Docker applications, a `docker-compose.yml` file is provided at the root of the repository.
  100. To get started, make sure you have Docker and Docker Compose installed on your system. Then, you can start the application using the following command in the terminal:
  101. ```sh
  102. make build
  103. make run
  104. ```
  105. You can override the default values in the `docker-compose.yml` file by creating a `docker-compose.override.yml` file in the same directory. This file is ignored by Git and will not be committed to the repository.
  106. ## Setup
  107. Please view all the available configuration variables in the [`.env.dist`](https://github.com/icoretech/airbroke/blob/main/.env.dist) file.
  108. Airbroke requires `DATABASE_URL` at runtime. `DIRECT_URL` is required when you need a _direct_ database connection for migrations (for example, when `DATABASE_URL` goes through PgBouncer or a data proxy). Some examples:
  109. ```sh
  110. # Example Connection to Prisma Data Proxy
  111. DATABASE_URL="prisma://__HOST__/?api_key=__KEY__"
  112. # Example Connection to PostgreSQL
  113. DATABASE_URL="postgresql://__USER__:__PASSWORD__@__HOST__:__PORT__/__DATABASE__?connection_limit=20&pool_timeout=10&application_name=airbroke"
  114. # Direct connection to the database, used for migrations
  115. DIRECT_URL="postgresql://__USER__:__PASSWORD__@__HOST__:__PORT__/__DATABASE__"
  116. ```
  117. The optimal connection pool size without pgBouncer (`connection_limit`) can be calculated using the following formula:
  118. ```ruby
  119. connection_limit = (num_physical_cpus * 2 + 1) ÷ number_of_application_instances
  120. ```
  121. For a system with 8 CPU cores and 3 application instances, the calculation would proceed as follows:
  122. ```ruby
  123. connection_limit = (8 * 2 + 1) ÷ 3
  124. connection_limit = (16 + 1) ÷ 3
  125. connection_limit = 17 ÷ 3
  126. connection_limit ≈ 5.67
  127. ```
  128. Since `connection_limit` must be an integer, it should be rounded down to the nearest whole number. In this scenario, each of the 3 application instances should have a `connection_limit` of `5`.
  129. This limit can be set in your connection strings.
  130. After deployment, you should be able to access your ingress (preferably secured with HTTPS) and start adding projects.
  131. This process will generate an API key that you can use with your Airbrake-compatible clients.
  132. This key, along with other essential information, will be provided to you.
  133. ### About PgBouncer
  134. To optimize your experience with Airbroke, as well as with Postgres overall, we advise integrating PgBouncer 1.24.0+ into your tech stack in transaction mode. For more comprehensive information, we recommend reviewing [Prisma's Connection Management documentation](https://www.prisma.io/docs/guides/performance-and-optimization/connection-management#external-connection-poolers), which provides insights on external connection poolers.
  135. We recommend not setting `pgbouncer=true` in the database connection string if you're using **PgBouncer 1.21.0 or later** ([source](https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer)).
  136. ### About DIRECT_URL
  137. The `DIRECT_URL` environment variable should be configured to establish a direct connection to the database. This is particularly crucial when using PgBouncer, as it enables migrations that cannot be executed through a data proxy. You can find more detailed information about this subject in the [Prisma's guide on configuring pgBouncer](https://www.prisma.io/docs/orm/prisma-client/setup-and-configuration/databases-connections/pgbouncer).
  138. ## Architecture
  139. ### Frontend
  140. The Airbroke frontend provides a user-friendly interface for managing and analyzing error reports. It utilizes a modern tech stack, including React, Tailwind CSS, and Next.js, to deliver a seamless user experience. The frontend leverages server-rendering capabilities to optimize initial page load times and ensure fast and responsive navigation.
  141. To optimize performance, the frontend may implement caching strategies to reduce the number of database queries and enhance overall responsiveness. This ensures that you can efficiently navigate through error reports and analyze critical information without experiencing unnecessary delays.
  142. ### Data Collection API
  143. The Data Collection API is a core component of Airbroke responsible for handling the ingestion of error reports. It serves as the endpoint where clients can send error reports, enabling efficient data collection for error management.
  144. To ensure simplicity and performance, the Data Collection API sidesteps the use of queue systems and performs parsing and transactions in-band. This means that parsing and processing of error reports happen synchronously within the API request cycle. Despite this approach, the Data Collection API demonstrates robust request-per-minute (RPM) performance even under high traffic volumes.
  145. ### MCP API (LLM/Agent Integrations)
  146. Airbroke exposes an MCP-compatible JSON-RPC API for read-only error triage workflows:
  147. - `POST /api/mcp`
  148. Authentication is static-header based (no OAuth in v1). Set `AIRBROKE_MCP_API_KEY` and send either:
  149. - `Authorization: Bearer <AIRBROKE_MCP_API_KEY>`
  150. - `X-Airbroke-Mcp-Key: <AIRBROKE_MCP_API_KEY>`
  151. Origin policy for browser clients:
  152. - Optional `AIRBROKE_MCP_ALLOWED_ORIGINS` (comma-separated) explicitly allows specific `Origin` values.
  153. - If `AIRBROKE_MCP_ALLOWED_ORIGINS` is unset, Airbroke allows same-origin browser requests by default.
  154. - Non-browser clients that do not send an `Origin` header are unaffected by this check.
  155. Available tools:
  156. - `airbroke_list_projects`
  157. - `airbroke_get_project`
  158. - `airbroke_list_notices`
  159. - `airbroke_list_occurrences`
  160. - `airbroke_get_notice`
  161. - `airbroke_search`
  162. - `airbroke_get_occurrence`
  163. - `airbroke_get_setup_guide`
  164. Notes on richer MCP outputs:
  165. - `airbroke_list_projects`, `airbroke_list_notices`, and `airbroke_list_occurrences`
  166. support `offset` + `limit` for page-like iteration.
  167. - `airbroke_list_projects` is the recommended discovery-first tool for fresh conversations.
  168. It matches both project names and organization names case-insensitively, so queries like
  169. `my-app`, `school-portal`, or `example-org` can surface the right project candidates without
  170. already knowing the internal project id.
  171. - `airbroke_get_project`, `airbroke_list_notices`, `airbroke_search`, and
  172. `airbroke_get_setup_guide` accept exact project ids, but also resolve common LLM-style
  173. project references such as partial project names when the match is unambiguous. If a
  174. reference is ambiguous, they return candidate projects instead of a silent false negative.
  175. - `airbroke_list_notices` supports `include_project=true` to embed minimal project data
  176. and `include_resolved=false` to hide resolved notices (default: `true`, show all).
  177. Notice payloads include `resolved_at` (null when unresolved).
  178. - `airbroke_list_occurrences` is summary-first by default, and supports:
  179. - `include_details=true` (+ optional `backtrace_frames`) for backtrace preview and key context fields.
  180. - `include_notice=true` / `include_project=true` to embed parent notice/project context inline.
  181. - `include_resolved=false` to hide resolved occurrences (default: `true`).
  182. - When notice data is included, `resolved_at` is present in the notice payload.
  183. - `airbroke_get_notice` returns:
  184. - the notice payload (includes `resolved_at`)
  185. - `latest_occurrences` (by `updated_at desc`)
  186. - `top_occurrences` (by `seen_count desc`, then `updated_at desc`)
  187. - optional occurrence detail snippets for faster LLM triage.
  188. - `include_resolved=false` filters occurrences to unresolved only (default: `true`).
  189. - Includes `remarks_count` for notice-level remarks.
  190. - `airbroke_get_occurrence` returns full occurrence details with parent notice
  191. (including `resolved_at`) and project. Includes `remarks` array with
  192. notice-level and occurrence-level remarks (id, body, user_name, created_at,
  193. is_notice_level).
  194. - `airbroke_search` supports cross-project query by occurrence message + notice/project metadata
  195. with optional filters: `organization`, `project_id`, `env`, `include_resolved`,
  196. and rich snippets via `include_details` + `backtrace_frames`.
  197. Notice data in search results includes `resolved_at`.
  198. - `airbroke_get_setup_guide` returns integration code snippets for connecting applications
  199. to Airbroke. Supports Airbrake-compatible SDKs and Sentry SDKs. Optional `project_id`
  200. returns ready-to-use code with real credentials; without it, templates contain placeholders.
  201. Filter by `sdk` (`airbrake` or `sentry`) and/or `framework` (e.g. `ruby`, `node`, `python`).
  202. Each snippet explicitly disables non-error SDK features (APM, tracing, remote config, etc.)
  203. since Airbroke is an error-only collector.
  204. Example Codex MCP server config:
  205. ```toml
  206. [mcp_servers.airbroke]
  207. url = "https://myairbroke.xyz/api/mcp"
  208. [mcp_servers.airbroke.http_headers]
  209. X-Airbroke-Mcp-Key = "replace-me"
  210. ```
  211. Example discovery flow:
  212. 1. Call `airbroke_list_projects` with the best human-friendly hint you have, such as
  213. `search: "my-app"` or `organization: "example-org"`
  214. 2. If needed, call `airbroke_get_project` with the returned id or the same unambiguous
  215. project reference
  216. 3. Use the resolved project id for `airbroke_list_notices` / `airbroke_search`
  217. ## Authentication Layer
  218. Airbroke includes an authentication layer that allows you to secure access to the application by enabling user authentication. It supports various authentication providers, including:
  219. - GitHub
  220. - Atlassian
  221. - Auth0
  222. - Google
  223. - Apple
  224. - Authentik
  225. - Bitbucket
  226. - BoxyHQ SAML
  227. - Cognito
  228. - FusionAuth
  229. - GitLab
  230. - Keycloak
  231. - Microsoft Entra ID
  232. - Salesforce
  233. - Slack
  234. - Okta
  235. To configure the authentication layer, you need to set the necessary environment variables corresponding to the authentication providers you want to use. These environment variables typically include client IDs, client secrets, and other provider-specific configuration details. Make sure to keep these environment variables secure, as they contain sensitive information.
  236. To complete the configuration, you also need to set the callback path in your OAuth applications for each provider. The callback path should be set to `https://<myhostname>/api/auth/callback/<provider>`. This path is where the authentication provider will redirect the user after successful authentication.
  237. You can find a list of available authentication providers and their documentation on the [Better Auth documentation](https://www.better-auth.com/docs/concepts/oauth). Each provider has its own specific configuration requirements and authentication flow, so refer to their documentation for more details.
  238. To configure the authentication providers, you'll need to set specific environment variables. You can find the list of required environment variables and their descriptions in the [`.env.dist`](https://github.com/icoretech/airbroke/blob/main/.env.dist) file in the Airbroke repository.
  239. To enable authentication in Airbroke and allow users to authenticate using third-party providers, follow these steps:
  240. 1. Configure the necessary environment variables for the desired authentication providers. You can refer to the [`.env.dist`](https://github.com/icoretech/airbroke/blob/main/.env.dist) file in the Airbroke repository for a list of required environment variables and their descriptions. Copy this file as `.env` and fill in the necessary values for your authentication providers.
  241. 2. Create OAuth applications with the respective authentication providers. Each provider will have its own developer console or settings page where you can create an OAuth application. During the application setup, configure the callback url to match the Airbroke authentication callback path: `https://myairbroke.xyz/api/auth/callback/<provider>`. Save the settings.
  242. 3. Start the Airbroke application, ensuring that the environment variables are properly configured.
  243. 4. Users can now authenticate with Airbroke by clicking on the login button and selecting their desired authentication provider. They will be redirected to the provider's authentication page to enter their credentials. Upon successful authentication, users will be logged in to Airbroke.
  244. Note: The callback path in step 2 is essential for the authentication flow to work correctly. It ensures that the authentication provider can redirect the user back to the Airbroke application after authentication is complete.
  245. Please refer to the documentation of the respective authentication providers to obtain the necessary configuration details and understand their authentication flows.
  246. ## Best Practices for Efficient Error Collection and Storage
  247. Airbroke provides error grouping mechanisms that analyze the incoming error data and automatically group similar errors based on their attributes.
  248. However when working with exceptions that include dynamic information as part of the exception itself (e.g., `raise(NotFound, 'no record 1234')`), it is important to consider efficient error collection and storage strategies. By following these practices, you can ensure that Airbroke maintains an efficient database and effectively groups and displays related errors without much overhead.
  249. ### Strategy 1: Use Generic Error Messages and Provide Detailed Reporting in `params`
  250. If the exceptions are generated within your own code, consider using more generic error messages and providing detailed reporting using the `params` field. Here's an example:
  251. ```ruby
  252. begin
  253. data = { book_id: 22 }
  254. raise 'ugh' # no dynamic data
  255. rescue => e
  256. Airbrake.notify(e, data) # ugh happened on book_id 22
  257. end
  258. ```
  259. ### Strategy 2: Collect and Wrap Exceptions Produced by Libraries
  260. If the exceptions are produced by libraries, consider collecting the necessary information, wrapping the exceptions, and re-raising them with cleaned-up messages. This approach allows you to provide more meaningful and informative error messages to Airbroke. Here's an example:
  261. ```ruby
  262. begin
  263. # Your code that interacts with a library
  264. rescue SomeLibraryError => e
  265. # Collect necessary information
  266. error_data = { library_error_message: e.message, library_error_code: e.code }
  267. # Wrap and re-raise the exception with a cleaned-up message
  268. wrapped_exception = RuntimeError.new("An error occurred in the library.")
  269. Airbrake.notify(wrapped_exception, error_data)
  270. raise wrapped_exception
  271. end
  272. ```
  273. By wrapping the library exception with a customized error message and including the relevant information in the `params` field, you can ensure that Airbroke receives clean and consistent error messages while retaining the necessary context.
  274. By adopting these best practices, you can enhance the efficiency and effectiveness of error collection and storage in Airbroke. These strategies allow for better grouping and analysis of related errors, providing you with the insights needed to identify and address issues more effectively.
  275. ### Limitations
  276. When working with error collection in Airbroke, you may come across situations where you find an error occurrence with a high count, but upon opening it, you discover that it only has one document to consult. This happens because Airbroke groups errors based on their "kind" and "message". If any of these attributes differ, Airbroke will create a new error group.
  277. As a result, you may encounter repeated errors that don't expose the specific parameter or stack trace after the first occurrence, or they may have originated from a different part of the application. This tradeoff is made to ensure a compact database size and high performance. The underlying idea is to encourage you to address and resolve errors, so maintaining a clean and organized error slate will yield better insights and improvements over time.
  278. By understanding these limitations and keeping your error collection streamlined, you can effectively utilize Airbroke's features to identify and resolve issues in your application.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.