{"id":14068067,"url":"https://github.com/jcpsantiago/sentryR","last_synced_at":"2025-07-30T02:32:52.204Z","repository":{"id":55441229,"uuid":"177139571","full_name":"jcpsantiago/sentryR","owner":"jcpsantiago","description":"Unofficial R client for Sentry","archived":false,"fork":false,"pushed_at":"2024-07-14T11:34:52.000Z","size":702,"stargazers_count":41,"open_issues_count":2,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-22T14:52:34.166Z","etag":null,"topics":["error-monitoring","r","sentry","shared-lib"],"latest_commit_sha":null,"homepage":"https://jcpsantiago.github.io/sentryR/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcpsantiago.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-22T12:52:12.000Z","updated_at":"2024-12-18T14:51:11.000Z","dependencies_parsed_at":"2024-01-03T10:59:20.524Z","dependency_job_id":null,"html_url":"https://github.com/jcpsantiago/sentryR","commit_stats":null,"previous_names":["jcpsantiago/sentryr","ozean12/sentryr"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jcpsantiago/sentryR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcpsantiago%2FsentryR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcpsantiago%2FsentryR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcpsantiago%2FsentryR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcpsantiago%2FsentryR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcpsantiago","download_url":"https://codeload.github.com/jcpsantiago/sentryR/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcpsantiago%2FsentryR/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267798625,"owners_count":24145727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["error-monitoring","r","sentry","shared-lib"],"created_at":"2024-08-13T07:05:55.414Z","updated_at":"2025-07-30T02:32:51.617Z","avatar_url":"https://github.com/jcpsantiago.png","language":"R","readme":"[![R-CMD-check](https://github.com/ozean12/sentryR/workflows/R-CMD-check/badge.svg)](https://github.com/jcpsantiago/sentryR/actions)\n[![CRAN status](https://www.r-pkg.org/badges/version/sentryR)](https://CRAN.R-project.org/package=sentryR)\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/mit/)\n\n# sentryR \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"200px\"/\u003e\n\n`sentryR` is an unofficial R client for [Sentry](https://sentry.io).\nIt includes an error handler for Plumber for uncaught exceptions.\n\n## Installation\nYou can install the latest development version of `sentryR` with:\n\n``` r\n# install.packages(\"remotes\")\nremotes::install_github(\"jcpsantiago/sentryR\")\n```\n\nor the stable version in CRAN with:\n\n```r\ninstall.packages(\"sentryR\")\n```\n\n\n## Using sentryR\n\n`configure_sentry` and `capture` are the two core functions of `sentryR`.\nThe first sets up an isolated environment with your Sentry project's DSN,\noptionally your app's name, version and the environment it's running in.\nBoth `configure_sentry` and any of the `capture_` functions accept\nadditional fields to pass on to Sentry as named lists.\n`NULL`ifying a field will remove it.\n\n```r\nlibrary(sentryR)\n\nconfigure_sentry(dsn = Sys.getenv(\"SENTRY_DSN\"),\n                 app_name = \"myapp\", app_version = \"8.8.8\",\n                 environment = Sys.getenv(\"APP_ENV\"),\n                 tags = list(foo = \"tag1\", bar = \"tag2\"),\n                 runtime = NULL)\n\ncapture(message = \"my message\", level = \"info\")\n```\n\nYou are encouraged to use the two wrappers around `capture` included:\n`capture_exception`, which handles the error object and then reports the error\nto Sentry, and `capture_message` for transmitting messages.\nRefer to the [Sentry docs](https://docs.sentry.io/development/sdk-dev/event-payloads/)\nfor a full list of available fields.\n\nBy default `sentryR` will send the following fields to Sentry:\n```r\nlist(\n  logger = \"R\",\n  platform = \"R\", # Sentry will ignore this for now\n  sdk = list(\n    name = \"SentryR\",\n    version = ...\n  ),\n  contexts = list(\n    os = list(\n      name = ...,\n      version = ...,\n      kernel_version = ...\n    ),\n    runtime = list(\n      version = ...,\n      type = \"runtime\",\n      name = \"R\",\n      build = ...\n    )\n  ),\n  timestamp = ...,\n  event_id = ...\n)\n```\n\n`capture_exception` further adds the `exception` field to the payload.\n\n\n## Example with Plumber\n\nIn a Plumber API, besides the initial configuration for Sentry,\nyou'll also have to set the error handler.\n\n`sentryR` ships with the default `plumber` error handler wrapped\nin the convenience function `sentry_error_handler`, but you can use\nyour own function and wrap it as below:\n\n```r\nlibrary(plumber)\nlibrary(sentryR)\n\n# add list of installed packages and their versions.\n# this can be slow in systems with a high number of packages installed,\n# so it is not the default behavior\ninstalled_pkgs_df \u003c- as.data.frame(utils::installed.packages(),\nstringsAsFactors = FALSE\n)\nversions \u003c- installed_pkgs_df$Version\nnames(versions) \u003c- installed_pkgs_df$Package\npackages \u003c- as.list(versions)\n\nconfigure_sentry(dsn = Sys.getenv('SENTRY_DSN'),\n                 app_name = \"myapp\", app_version = \"1.0.0\",\n                 modules = packages)\n\nmy_sentry_error_handler \u003c- wrap_error_handler_with_sentry(my_error_handler)\n\nr \u003c- plumb(\"R/api.R\")\nr$setErrorHandler(my_sentry_error_handler)\nr$run(host = \"0.0.0.0\", port = 8000)\n```\n\nand wrap your endpoint functions with `with_captured_calls`\n\n```r\n#* @get /error\napi_error \u003c- with_captured_calls(function(res, req){\n  stop(\"error\")\n})\n```\n\nonce this is done, Plumber will handle any errors, send them to Sentry using\n`capture_exception`, and respond with status `500` and the error message.\nYou don't need to do any further configuration.\n\n## Example with Shiny\n\nYou can also use `sentryR` to capture exceptions in your Shiny applications\nby providing a callback function to the `shiny.error` option.\n\n```r\nlibrary(shiny)\nlibrary(sentryR)\n\nconfigure_sentry(dsn = Sys.getenv('SENTRY_DSN'),\n                 app_name = \"myapp\", app_version = \"1.0.0\",\n\t\t modules = packages)\n\nerror_handler \u003c- function() {\n    capture_exception(error = geterrmessage())\n}\n\noptions(shiny.error = error_handler)\n\nshinyServer(function(input, output) {\n    # Define server logic\n    ...\n}\n```\n\n## Acknowledgements\n\n`sentryR` took inspiration from\n[raven-clj](https://github.com/sethtrain/raven-clj) a Clojure interface to Sentry.\n\n## Contributing\n\nPRs and issues are welcome! :tada:\n","funding_links":[],"categories":["R"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcpsantiago%2FsentryR","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcpsantiago%2FsentryR","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcpsantiago%2FsentryR/lists"}