Class: Sqreen::Kit::Signals::Context::HttpContext
- Inherits:
-
Object
- Object
- Sqreen::Kit::Signals::Context::HttpContext
- Includes:
- DtoHelper
- Defined in:
- lib/sqreen/kit/signals/context/http_context.rb
Constant Summary collapse
- PARAMS_ATTRS =
[:params_query, :params_form, :params_cookies, :params_json, :params_other].freeze
- SCHEMA_VERSION =
'http/2020-01-01T00:00:00.000Z'.freeze
Constants included from DtoHelper
DtoHelper::DO_NOT_CONVERT_TYPES, DtoHelper::RFC_3339_FMT
Instance Attribute Summary collapse
-
#content_length ⇒ Integer
Response content length.
-
#content_type ⇒ String
Response content type.
-
#datadog_span_id ⇒ Integer
Datadog span id.
-
#datadog_trace_id ⇒ Integer
Datadog trace id.
- #endpoint ⇒ String
-
#headers ⇒ Array<Array<String>>
mandatory.
-
#host ⇒ String
mandatory Host header; may include the port.
- #params_cookies ⇒ Hash
- #params_form ⇒ Hash
- #params_json ⇒ Hash
- #params_other ⇒ Hash
- #params_query ⇒ Hash
-
#path ⇒ String
mandatory XXX: Unclear is decoded or not.
-
#port ⇒ Integer|String
mandatory.
- #referer ⇒ String
-
#remote_ip ⇒ String
mandatory.
-
#remote_port ⇒ Integer|String
mandatory.
- #reveal_replayed ⇒ Boolean
- #rid ⇒ String
-
#scheme ⇒ String
mandatory.
-
#status ⇒ Integer
Response status.
-
#user_agent ⇒ String
mandatory.
- #verb ⇒ Object
Instance Method Summary collapse
Methods included from DtoHelper
#append_to_h_filter, #compact_hash, included, #initialize, #to_json
Instance Attribute Details
#content_length ⇒ Integer
Response content length
104 105 106 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 104 def content_length @content_length end |
#content_type ⇒ String
Response content type
108 109 110 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 108 def content_type @content_type end |
#datadog_span_id ⇒ Integer
Datadog span id
116 117 118 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 116 def datadog_span_id @datadog_span_id end |
#datadog_trace_id ⇒ Integer
Datadog trace id
112 113 114 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 112 def datadog_trace_id @datadog_trace_id end |
#endpoint ⇒ String
93 94 95 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 93 def endpoint @endpoint end |
#headers ⇒ Array<Array<String>>
mandatory
34 35 36 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 34 def headers @headers end |
#host ⇒ String
mandatory Host header; may include the port
55 56 57 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 55 def host @host end |
#params_cookies ⇒ Hash
84 85 86 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 84 def @params_cookies end |
#params_form ⇒ Hash
81 82 83 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 81 def params_form @params_form end |
#params_json ⇒ Hash
87 88 89 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 87 def params_json @params_json end |
#params_other ⇒ Hash
90 91 92 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 90 def params_other @params_other end |
#params_query ⇒ Hash
78 79 80 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 78 def params_query @params_query end |
#path ⇒ String
mandatory XXX: Unclear is decoded or not
72 73 74 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 72 def path @path end |
#port ⇒ Integer|String
mandatory
59 60 61 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 59 def port @port end |
#referer ⇒ String
75 76 77 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 75 def referer @referer end |
#remote_ip ⇒ String
mandatory
63 64 65 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 63 def remote_ip @remote_ip end |
#remote_port ⇒ Integer|String
mandatory
67 68 69 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 67 def remote_port @remote_port end |
#reveal_replayed ⇒ Boolean
96 97 98 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 96 def reveal_replayed @reveal_replayed end |
#rid ⇒ String
30 31 32 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 30 def rid @rid end |
#scheme ⇒ String
mandatory
42 43 44 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 42 def scheme @scheme end |
#status ⇒ Integer
Response status
100 101 102 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 100 def status @status end |
#user_agent ⇒ String
mandatory
38 39 40 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 38 def user_agent @user_agent end |
#verb ⇒ Object
47 48 49 50 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 47 def verb raise 'verb not set' unless defined?(@verb) && @verb @verb.upcase end |
Instance Method Details
#to_h ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/sqreen/kit/signals/context/http_context.rb', line 118 def to_h check_mandatories { request: compact_hash({ rid: rid, headers: headers, user_agent: user_agent, scheme: scheme, verb: verb, host: host, port: port, remote_ip: remote_ip, remote_port: remote_port, path: path, referer: referer, parameters: compact_hash({ query: params_query, form: params_form, cookies: , json: params_json, other: params_other, }), endpoint: endpoint, # yes, this one is in CamelCase isRevealReplayed: reveal_replayed, }), response: compact_hash({ status: status, content_type: content_type, content_length: content_length, }), }.merge!(compact_hash( datadog_trace_id: datadog_trace_id, datadog_span_id: datadog_span_id, )) end |