It wasn't clear to me from the documentation that calling Scope#set_context with the same name multiple times would clobber existing values, should that be the case? By way of example, here's what I'm doing:
# in my correlation ID middleware:
Sentry.configure_scope do |scope|
scope.set_context(:request, { correlation_id: env[NAME] })
end
# in my separate session ID middleware:
Sentry.configure_scope do |scope|
scope.set_context(:request, { session_id: env[Rack::RACK_SESSION][NAME] })
end
Right now, the only context stored in the :request name is the :session_id because that's called later in my middleware stack. Maybe it's just personal opinion, but I would have expected the :request context to contain both :correlation_id and :session_id, but the code calls .merge! and clobbers any existing value using the same name.
Is this by design or should we be able to add to contexts over time? I'd be happy to contribute a change to get that sort of feature added if that would help.
It wasn't clear to me from the documentation that calling
Scope#set_contextwith the same name multiple times would clobber existing values, should that be the case? By way of example, here's what I'm doing:Right now, the only context stored in the
:requestname is the:session_idbecause that's called later in my middleware stack. Maybe it's just personal opinion, but I would have expected the:requestcontext to contain both:correlation_idand:session_id, but the code calls.merge!and clobbers any existing value using the same name.Is this by design or should we be able to add to contexts over time? I'd be happy to contribute a change to get that sort of feature added if that would help.