Movatterモバイル変換


[0]ホーム

URL:


packagesentry

  1. Overview
  2. Docs

You can search for identifiers within the package.

in-package search v0.2.0

Unofficial Async Sentry error monitoring client

Install

Dune Dependency

Authors

Maintainers

Sources

sentry-v0.11.0.tbz
sha256=f475f3b68fb7386da82ba2fa7d45bf19ab5d08c535b27d38d0b3699251ec05c2
sha512=aa37df63286cb744acb5ccd2923ce2e812f448ce80dac125f4985cf2aad31982c242bb222102c78ed9eb4af7d2f5452bad8b21ac55339adf9c4e55ce0a46e779

Description

Sentry is an unofficial Async OCaml client for the Sentry error reporting.

Published:19 Aug 2020

README

README.md

Sentry (OCaml) - WORK IN PROGRESS

This is an unofficial work-in-progressSentry library for OCaml.

This currently requires the Async scheduler to be running or data will not be uploaded

Missing features:

  • Only supports Async (pull requests to factor out Lwt/Unix are welcome!)

  • Global unhandled exception handler isn't implemented yet.

  • Probably other things

Example

Seethe example program.

In general, you should use this like:

let () =  let spec = Command.Spec.(...) in  Command.async_spec ~summary:"..." spec @@ fun args () ->  (* Using [SENTRY_DSN] from the environment *)  Sentry.with_exn_handler @@ fun () ->  (* your normal code here *)

To release the warning above: The Async schedulemust be running.

This will execute your code as usual, and if it throws an exception, it will be uploaded to Sentry:

Then the exception will be re-thrown so your program will exit and print the backtrace to stderr as usual (if you want to continue after errors, wrapSentry.with_exn_handler in another error handler or useSentry.with_exn_handler_ignore).

Note thatSentry.with_error_and_exn_handler exists (which handles both exceptions andOr_error.t), but using exceptions exclusively is recommended because they have backtraces (and wrapping exceptions inError.t loses whatever backtrace did exist in most cases).

Tags

We upload some data by default. From environment variables, we get:

  • SENTRY_ENVIRONMENT ->environment

  • SENTRY_RELEASE ->release

FromSys orUnix:

  • Sys.argv ->argv

  • Sys.backend_type ->backend_type

  • Sys.executable_name ->executable_name

  • Sys.gethostname ->server_name

  • Sys.os_type ->os_type

You can override any of these withSentry.merge_extra,Sentry.set_environment, andSentry.set_release.

You can also upload custom tags using eitherSentry.merge_tags or by passing~tags to acapture function. Tags will be merged for the current async job, so you only need to pass additional tags:

Sentry.merge_tags [ "app_name", "http_server" ];Sentry.with_exn_handler @@ fun () ->...Sentry.merge_tags [ "method", "GET", "path", "/example" ];...(* This will upload with default tags + app_name, method, path, and user_id *)Sentry.capture_message ~tags:[ "user_id", user_id ] "invalid login"

Dependencies (14)

  1. yojson< "2.0.0"
  2. uri
  3. uuidm
  4. sexplib>= "v0.13.0"
  5. re2
  6. ocaml>= "4.08.0"
  7. ppx_jane
  8. json-derivers
  9. hex>= "1.2.0"
  10. dune>= "1.11.0"
  11. cohttp-async>= "2.0.0"
  12. cohttp>= "2.0.0"
  13. atdgen< "2.10.0"
  14. core>= "v0.13.0"

Dev Dependencies (1)

  1. bisect_ppxdev & >= "2.0.0"

Used by

None

Conflicts

None


[8]ページ先頭

©2009-2025 Movatter.jp