From 350079f6072f21080d6a65f2624138a69f2070aa Mon Sep 17 00:00:00 2001 From: Peter Solnica Date: Thu, 8 Aug 2024 12:05:15 +0000 Subject: [PATCH] Include transaction data in the trace context Closes #2363 --- sentry-ruby/lib/sentry/span.rb | 3 ++- sentry-ruby/spec/sentry/span_spec.rb | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sentry-ruby/lib/sentry/span.rb b/sentry-ruby/lib/sentry/span.rb index 061b7b1e0..da7232d9a 100644 --- a/sentry-ruby/lib/sentry/span.rb +++ b/sentry-ruby/lib/sentry/span.rb @@ -192,7 +192,8 @@ def get_trace_context description: @description, op: @op, status: @status, - origin: @origin + origin: @origin, + data: @data } end diff --git a/sentry-ruby/spec/sentry/span_spec.rb b/sentry-ruby/spec/sentry/span_spec.rb index 0bc187eec..d890dfa25 100644 --- a/sentry-ruby/spec/sentry/span_spec.rb +++ b/sentry-ruby/spec/sentry/span_spec.rb @@ -28,12 +28,15 @@ it "returns correct context data" do context = subject.get_trace_context + subject.set_data(:foo, "bar") + expect(context[:op]).to eq("sql.query") expect(context[:description]).to eq("SELECT * FROM users;") expect(context[:status]).to eq("ok") expect(context[:trace_id].length).to eq(32) expect(context[:span_id].length).to eq(16) expect(context[:origin]).to eq('manual') + expect(context[:data]).to eq(foo: "bar") end end