@@ -144,6 +144,9 @@ def tags=(tags)
144144 # Custom details data
145145 attr_accessor :details
146146
147+ # The ID of the request which caused this notice.
148+ attr_accessor :request_id
149+
147150 # The parsed exception backtrace. Lines in this backtrace that are from installed gems
148151 # have the base path for gem installs replaced by "[GEM_ROOT]", while those in the project
149152 # have "[PROJECT_ROOT]".
@@ -213,13 +216,14 @@ def initialize(config, opts = {})
213216 self . api_key = opts [ :api_key ] || config [ :api_key ]
214217 self . tags = construct_tags ( opts [ :tags ] ) | construct_tags ( context [ :tags ] )
215218
216- self . url = opts [ :url ] || request_hash [ :url ] || nil
217- self . action = opts [ :action ] || request_hash [ :action ] || nil
218- self . component = opts [ :controller ] || opts [ :component ] || request_hash [ :component ] || nil
219- self . params = opts [ :parameters ] || opts [ :params ] || request_hash [ :params ] || { }
220- self . session = opts [ :session ] || request_hash [ :session ] || { }
221- self . cgi_data = opts [ :cgi_data ] || request_hash [ :cgi_data ] || { }
222- self . details = opts [ :details ] || { }
219+ self . url = opts [ :url ] || request_hash [ :url ] || nil
220+ self . action = opts [ :action ] || request_hash [ :action ] || nil
221+ self . component = opts [ :controller ] || opts [ :component ] || request_hash [ :component ] || nil
222+ self . params = opts [ :parameters ] || opts [ :params ] || request_hash [ :params ] || { }
223+ self . session = opts [ :session ] || request_hash [ :session ] || { }
224+ self . cgi_data = opts [ :cgi_data ] || request_hash [ :cgi_data ] || { }
225+ self . details = opts [ :details ] || { }
226+ self . request_id = opts [ :request_id ] || nil
223227
224228 self . session = opts [ :session ] [ :data ] if opts [ :session ] && opts [ :session ] [ :data ]
225229
@@ -261,6 +265,9 @@ def as_json(*args)
261265 stats : stats ,
262266 time : now ,
263267 pid : pid
268+ } ,
269+ correlation_context : {
270+ request_id : s ( request_id )
264271 }
265272 }
266273 end
0 commit comments