Skip to content

Latest commit

 

History

History
56 lines (42 loc) · 1.3 KB

README.md

File metadata and controls

56 lines (42 loc) · 1.3 KB

GCP Error Reporting

Report Elixir errors to Google Error Reporting.

Installation

If available in Hex, the package can be installed by adding gcp_error_reporting to your list of dependencies in mix.exs:

def deps do
  [
    {:gcp_error_reporting, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/gcp_error_reporting.

Configure Goth

GcpErrorReporting uses goth to authenticate with Google. Follow its installation instructions to configure it, and define an app-specific Goth module to use with GcpErrorReporting.

Define a Reporter

Example:

version = System.fetch_env!("CI_COMMIT")

%GcpErrorReporting.Reporter{
  goth: MyApp.Goth,
  project_id: "gcp_project_name",
  service: "app_name",
  service_version: version,
  sources: [
    [repository: "https://www.github.com/org/project", revision: version]
  ]
}

Catch errors and report them

TBD. something like:

# in app outer loop:
begin do
  app_outer_loop
rescue e
  GcpErrorReporting.report_error(e, __STACKTRACE__, app_reporter)
end