Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #880 from joyent/ether/v3-rollbar
Browse files Browse the repository at this point in the history
v3: rollbar improvements
  • Loading branch information
karenetheridge authored Sep 10, 2019
2 parents 37600f8 + 9a54503 commit 8908c4a
Show file tree
Hide file tree
Showing 14 changed files with 1,097 additions and 131 deletions.
23 changes: 17 additions & 6 deletions conch.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,23 @@
},
},

# Rollbar access token. Must be a token with write permissions
# rollbar_access_token => '00000000000000000000000000000000',

# Optional environment string override for rollbar exceptions. If not
# present, uses the value of $app->mode ('production' with Hypnotoad).
# rollbar_environment => 'staging',
rollbar => {
# Rollbar access token: must have scope "post_server_item" or "post_client_item".
# You can generate one from https://rollbar.com/$account/$application/settings/access_tokens/
# access_token => '00000000000000000000000000000000',

# Optional environment string override for rollbar exceptions. If not
# present, uses the value of $app->mode ('production' with Hypnotoad).
# environment => 'staging',

# a hash of regexes that are matched against the named request header:
# if there is a match, all 4xx responses (other than 401, 403, 404) are
# forwarded to rollbar
# error_match_header => {
# 'X-Conch-UI' => qr/^v4.[3-9]/, # forward errors for X-Conch-UI 4.3 and later
# 'User-Agent' => qr/^Conch\/(3.1|2.6.0$)/, # " for Conch/3.1* or Conch/2.6.0 exactly
# },
},

features => {
audit => 0, # turns on logging of request and response bodies
Expand Down
1 change: 1 addition & 0 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ requires 'Getopt::Long::Descriptive';
requires 'Session::Token';
requires 'Sys::Hostname';
requires 'Sub::Install';
requires 'WebService::Rollbar::Notifier';

# debugging aids
requires 'Data::Printer', '0.99_019', dist => 'GARU/Data-Printer-0.99_019.tar.gz';
Expand Down
15 changes: 15 additions & 0 deletions cpanfile.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -4044,6 +4044,21 @@ DISTRIBUTIONS
base 0
lib 0
perl 5.008
WebService-Rollbar-Notifier-1.002009
pathname: B/BJ/BJAKUBSKI/WebService-Rollbar-Notifier-1.002009.tar.gz
provides:
WebService::Rollbar::Notifier 1.002009
requirements:
Carp 0
ExtUtils::MakeMaker 0
IO::Socket::SSL 1.94
Mojo::Base 0
Mojo::UserAgent 0
Mojolicious 6.04
Scalar::Util 0
perl 5.006
strict 0
warnings 0
Win32-ShellQuote-0.003001
pathname: H/HA/HAARG/Win32-ShellQuote-0.003001.tar.gz
provides:
Expand Down
33 changes: 29 additions & 4 deletions docs/modules/Conch::Plugin::Rollbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,40 @@ Conch::Plugin::Rollbar

# DESCRIPTION

Mojo plugin to send exceptions to [Rollbar](https://rollbar.com)
Mojo plugin to send messages and exceptions to [Rollbar](https://rollbar.com).

Also support sending various errors to Rollbar, depending on matching criteria.

# HOOKS

## before\_render

Sends exceptions to Rollbar.

# EVENTS

## dispatch\_message\_payload

Listens to the `dispatch_message_payload` event (which is sent by the dispatch logger in
[Conch::Plugin::Logging](../modules/Conch::Plugin::Logging)). When an error response is generated (any 4xx response code other
than 401, 403 or 404), and a request header matches a key in the `rollbar` config
`error_match_header`, and the header value matches the corresponding regular expression, a
message is sent to Rollbar.

# HELPERS

## send\_exception\_to\_rollbar

Asynchronously send exception details to Rollbar if 'rollbar\_access\_token' is
configured. Returns a unique uuid suitable for logging, to correlate with the
Rollbar entry thus created.
Asynchronously send exception details to Rollbar (if the `rollbar` `access_token` is
configured). Returns a unique uuid suitable for logging, to correlate with the Rollbar entry
thus created.

## send\_message\_to\_rollbar

Asynchronously send a message to Rollbar (if the `rollbar` `access_token` is configured).
Returns a unique uuid suitable for logging, to correlate with the Rollbar entry thus created.

Requires a message string. A hashref of additional data is optional.

# LICENSING

Expand Down
7 changes: 7 additions & 0 deletions docs/modules/Test::Conch.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,13 @@ that are already in a specific order.

`$routes` should be a [Mojolicious::Routes](https://metacpan.org/pod/Mojolicious::Routes) object that holds the route(s) to be added.

## do\_and\_wait\_for\_event

Sets up a [Mojo::Promise](https://metacpan.org/pod/Mojo::Promise) to wait for a specific event name, then executes the first subref
provided. When the event is received \*and\* the task subref has finished, the success subref is
invoked with the argument(s) sent to the event. If the timeout is reached, the failure subref
is called, or if left undefined a test failure is generated.

# LICENSING

Copyright Joyent, Inc.
Expand Down
Loading

0 comments on commit 8908c4a

Please sign in to comment.