1Sentry::Raven(3)      User Contributed Perl Documentation     Sentry::Raven(3)
2
3
4

NAME

6       Sentry::Raven - A perl sentry client
7

VERSION

9       Version 1.10
10

SYNOPSIS

12         my $raven = Sentry::Raven->new( sentry_dsn => 'http://<publickey>:<secretkey>@app.getsentry.com/<projectid>' );
13
14         # capture all errors
15         $raven->capture_errors( sub {
16             ..do something here..
17         } );
18
19         # capture an individual event
20         $raven->capture_message('The sky is falling');
21
22         # annotate an event with context
23         $raven->capture_message(
24           'The sky is falling',
25           Sentry::Raven->exception_context('SkyException', 'falling'),
26         );
27

DESCRIPTION

29       This module implements the recommended raven interface for posting
30       events to a sentry service.
31

CONSTRUCTOR

33   my $raven = Sentry::Raven->new( %options, %context )
34       Create a new sentry interface object.  It accepts the following named
35       options:
36
37       "sentry_dsn =>
38       'http://<publickey>:<secretkey>@app.getsentry.com/<projectid>'"
39           The DSN for your sentry service.  Get this from the client
40           configuration page for your project.
41
42       "timeout => 5"
43           Do not wait longer than this number of seconds when attempting to
44           send an event.
45

ERROR HANDLERS

47       These methods are designed to capture events and handle them
48       automatically.
49
50   $raven->capture_errors( $subref, %context )
51       Execute the $subref and report any exceptions (die) back to the sentry
52       service.  If it is unable to submit an event (capture_message return
53       undef), it will die and include the event details in the die message.
54       This automatically includes a stacktrace unless $SIG{__DIE__} has been
55       overridden in subsequent code.
56

METHODS

58       These methods are for generating individual events.
59
60   $raven->capture_message( $message, %context )
61       Post a string message to the sentry service.  Returns the event id.
62
63   $raven->capture_exception( $exception_value, %exception_context, %context )
64       Post an exception type and value to the sentry service.  Returns the
65       event id.
66
67       %exception_context can contain:
68
69       "type => $type"
70
71   $raven->capture_request( $url, %request_context, %context )
72       Post a web url request to the sentry service.  Returns the event id.
73
74       %request_context can contain:
75
76       "method => 'GET'"
77       "data => 'foo=bar'"
78       "query_string => 'foo=bar'"
79       "cookies => 'foo=bar'"
80       "headers => { 'Content-Type' => 'text/html' }"
81       "env => { REMOTE_ADDR => '192.168.0.1' }"
82
83   $raven->capture_stacktrace( $frames, %context )
84       Post a stacktrace to the sentry service.  Returns the event id.
85
86       $frames can be either a Devel::StackTrace object, or an arrayref of
87       hashrefs with each hashref representing a single frame.
88
89           my $frames = [
90               {
91                   filename => 'my/file1.pl',
92                   function => 'function1',
93                   vars     => { foo => 'bar' },
94                   lineno   => 10,
95               },
96               {
97                   filename => 'my/file2.pl',
98                   function => 'function2',
99                   vars     => { bar => 'baz' },
100                   lineno   => 20,
101               },
102           ];
103
104       The first frame should be the oldest frame.  Frames must contain at
105       least one of "filename", "function", or "module".  These additional
106       attributes are also supported:
107
108       "filename => $file_name"
109       "function => $function_name"
110       "module => $module_name"
111       "lineno => $line_number"
112       "colno => $column_number"
113       "abs_path => $absolute_path_file_name"
114       "context_line => $line_of_code"
115       "pre_context => [ $previous_line1, $previous_line2 ]"
116       "post_context => [ $next_line1, $next_line2 ]"
117       "in_app => $one_if_not_external_library"
118       "vars => { $variable_name => $variable_value }"
119
120   $raven->capture_user( %user_context, %context )
121       Post a user to the sentry service.  Returns the event id.
122
123       %user_context can contain:
124
125       "id => $unique_id"
126       "username => $username"
127       "email => $email"
128       "ip_address => $ip_address"
129
130   $raven->capture_query( $query, %query_context, %context )
131       Post a query to the sentry service.  Returns the event id.
132
133       %query_context can contain:
134
135       "engine => $engine'"
136

EVENT CONTEXT

138       These methods are for annotating events with additional context, such
139       as stack traces or HTTP requests.  Simply pass their output to any
140       other method accepting %context.  They accept all of the same arguments
141       as their "capture_*" counterparts.
142
143         $raven->capture_message(
144           'The sky is falling',
145           Sentry::Raven->exception_context('falling', type => 'SkyException'),
146         );
147
148   Sentry::Raven->exception_context( $value, %exception_context )
149   Sentry::Raven->request_context( $url, %request_context )
150   Sentry::Raven->stacktrace_context( $frames )
151   Sentry::Raven->user_context( %user_context )
152   Sentry::Raven->query_context( $query, %query_context )
153       The default context can be modified with the following accessors:
154
155   my %context = $raven->get_context();
156   $raven->add_context( %context )
157   $raven->merge_tags( %tags )
158       Merge additional tags into any existing tags in the current context.
159
160   $raven->merge_extra( %tags )
161       Merge additional extra into any existing extra in the current context.
162
163   $raven->clear_context()

EVENT PROCESSORS

165       Processors are a mechanism for modifying events after they are
166       generated but before they are posted to the sentry service.  They are
167       useful for scrubbing sensitive data, such as passwords, as well as
168       adding additional context.  If the processor fails (dies or returns
169       undef), the failure will be passed to the caller.
170
171       See Sentry::Raven::Processor for information on creating new
172       processors.
173
174       Available processors:
175
176       Sentry::Raven::Processor::RemoveStackVariables
177
178   $raven->add_processors( [ Sentry::Raven::Processor::RemoveStackVariables,
179       ... ] )
180   $raven->clear_processors( [ Sentry::Raven::Processor::RemoveStackVariables,
181       ... ] )

STANDARD OPTIONS

183       These options can be passed to all methods accepting %context.  Passing
184       context to the constructor overrides defaults.
185
186       "culprit => 'Some::Software'"
187           The source of the event.  Defaults to "undef".
188
189       "event_id => '534188f7c1ff4ff280c2e1206c9e0548'"
190           The unique identifier string for an event, usually UUID v4.  Max 32
191           characters.  Defaults to a new unique UUID for each event.  Invalid
192           ids may be discarded silently.
193
194       "extra => { key1 => 'val1', ... }"
195           Arbitrary key value pairs with extra information about an event.
196           Defaults to "{}".
197
198       "level => 'error'"
199           Event level of an event.  Acceptable values are "fatal", "error",
200           "warning", "info", and "debug".  Defaults to "error".
201
202       "logger => 'root'"
203           The creator of an event.  Defaults to 'root'.
204
205       "platform => 'perl'"
206           The platform (language) in which an event occurred.  Defaults to
207           "perl".
208
209       "release => 'ec899ea'"
210           Track the release version of your application.
211
212       "processors => [ Sentry::Raven::Processor::RemoveStackVariables, ... ]"
213           A set or processors to be applied to events before they are posted.
214           See Sentry::Raven::Processor for more information.  This can only
215           be set during construction and not on other methods accepting
216           %context.
217
218       "server_name => 'localhost.example.com'"
219           The hostname on which an event occurred.  Defaults to the system
220           hostname.
221
222       "tags => { key1 => 'val1, ... }"
223           Arbitrary key value pairs with tags for categorizing an event.
224           Defaults to "{}".
225
226       "fingerprint => [ 'val1', 'val2', ... }"
227           Array of strings used to control how events aggregate in the sentry
228           web interface. The string '{{ default }}' has special meaning when
229           used as the first value; it indicates that sentry should use the
230           default aggregation method in addition to any others specified
231           (useful for fine-grained aggregation). Defaults to "['{{ default
232           }}']".
233
234       "timestamp => '1970-01-01T00:00:00'"
235           Timestamp of an event.  ISO 8601 format.  Defaults to the current
236           time.  Invalid values may be discarded silently.
237
238       "environment => 'production'"
239           Specify the environment (i.e. staging, production, etc.) that your
240           project is deployed in. More information can be found on the Sentry
241           website <https://blog.getsentry.com/2016/07/22/environment-
242           details.html>.
243

CONFIGURATION AND ENVIRONMENT

245       SENTRY_DSN="http://<publickey>:<secretkey>@app.getsentry.com/<projectid>"
246           A default DSN to be used if sentry_dsn is not passed to c<new>.
247

LICENSE

249       Copyright (C) 2014 by Rentrak Corporation
250
251       The full text of this license can be found in the LICENSE file included
252       with this module.
253
254
255
256perl v5.28.0                      2017-06-12                  Sentry::Raven(3)
Impressum