Class: Cybertrain::Test::SentryEnvelope
- Inherits:
-
Object
- Object
- Cybertrain::Test::SentryEnvelope
- Defined in:
- cybertrain/test/sentry_receiver.rb
Overview
One envelope as the receiver read it: the request’s path, its
X-Sentry-Auth and Content-Type, and the envelope’s text.
Instance Attribute Summary collapse
-
#sentry_auth ⇒ String
readonly
The
X-Sentry-Authheader. -
#sentry_body ⇒ String
readonly
The envelope as sent: the envelope header, the item header and the event, one JSON object per line.
-
#sentry_content_type ⇒ String
readonly
The
Content-Typeheader (application/x-sentry-envelope). -
#sentry_path ⇒ String
readonly
The request’s path:
/api/<project id>/envelope/, after the DSN’s path when it has one.
Instance Method Summary collapse
-
#sentry_field(path) ⇒ String
A field of the event (the envelope’s third line) by its dotted path:
"exception.values.0.type", an Array’s elements by their index. -
#sentry_header_field(name) ⇒ String
A field of the envelope header (its first line):
"event_id","sent_at","dsn"; read as #sentry_field reads the event.
Instance Attribute Details
#sentry_auth ⇒ String (readonly)
The X-Sentry-Auth header.
28 29 30 |
# File 'cybertrain/test/sentry_receiver.rb', line 28 def sentry_auth @sentry_auth end |
#sentry_body ⇒ String (readonly)
The envelope as sent: the envelope header, the item header and the event, one JSON object per line.
39 40 41 |
# File 'cybertrain/test/sentry_receiver.rb', line 39 def sentry_body @sentry_body end |
#sentry_content_type ⇒ String (readonly)
The Content-Type header (application/x-sentry-envelope).
33 34 35 |
# File 'cybertrain/test/sentry_receiver.rb', line 33 def sentry_content_type @sentry_content_type end |
#sentry_path ⇒ String (readonly)
The request’s path: /api/<project id>/envelope/, after the DSN’s
path when it has one.
23 24 25 |
# File 'cybertrain/test/sentry_receiver.rb', line 23 def sentry_path @sentry_path end |
Instance Method Details
#sentry_field(path) ⇒ String
A field of the event (the envelope’s third line) by its dotted
path: "exception.values.0.type", an Array’s elements by their
index. In an object, the longest run of the path’s remaining parts
that is a key is taken first, so a key with dots in it (a job
report’s extra, "job.attempt") is read whole:
"extra.job.attempt". A String is itself, a number or a boolean
its JSON text; "" when the field is absent, null, an object or an
array.
67 68 69 |
# File 'cybertrain/test/sentry_receiver.rb', line 67 def sentry_field(path) SentryEnvelope.json_field(SentryEnvelope.envelope_line(@sentry_body, 2), path) end |
#sentry_header_field(name) ⇒ String
A field of the envelope header (its first line): "event_id",
"sent_at", "dsn"; read as #sentry_field reads the event.
76 77 78 |
# File 'cybertrain/test/sentry_receiver.rb', line 76 def sentry_header_field(name) SentryEnvelope.json_field(SentryEnvelope.envelope_line(@sentry_body, 0), name) end |