From 0cf49960b3dc8f6c5b896fee996e21bae1b8e898 Mon Sep 17 00:00:00 2001 From: Neel Shah Date: Mon, 28 Aug 2023 17:46:28 +0200 Subject: [PATCH] Review fixes --- sentry-ruby/lib/sentry/event.rb | 1 + sentry-ruby/lib/sentry/hub.rb | 4 ++-- sentry-ruby/lib/sentry/propagation_context.rb | 6 ++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sentry-ruby/lib/sentry/event.rb b/sentry-ruby/lib/sentry/event.rb index fa66c3187..b9f8a58e6 100644 --- a/sentry-ruby/lib/sentry/event.rb +++ b/sentry-ruby/lib/sentry/event.rb @@ -59,6 +59,7 @@ def initialize(configuration:, integration_meta: nil, message: nil) @tags = {} @fingerprint = [] + @dynamic_sampling_context = nil # configuration data that's directly used by events @server_name = configuration.server_name diff --git a/sentry-ruby/lib/sentry/hub.rb b/sentry-ruby/lib/sentry/hub.rb index 48a131cd9..0efd00b3c 100644 --- a/sentry-ruby/lib/sentry/hub.rb +++ b/sentry-ruby/lib/sentry/hub.rb @@ -233,14 +233,14 @@ def get_traceparent return nil unless current_scope current_scope.get_span&.to_sentry_trace || - current_scope.propagation_context&.get_traceparent + current_scope.propagation_context.get_traceparent end def get_baggage return nil unless current_scope current_scope.get_span&.to_baggage || - current_scope.propagation_context&.get_baggage&.serialize + current_scope.propagation_context.get_baggage&.serialize end def get_trace_propagation_headers diff --git a/sentry-ruby/lib/sentry/propagation_context.rb b/sentry-ruby/lib/sentry/propagation_context.rb index 1e99d2756..9bf163b72 100644 --- a/sentry-ruby/lib/sentry/propagation_context.rb +++ b/sentry-ruby/lib/sentry/propagation_context.rb @@ -65,12 +65,10 @@ def populate_head_baggage "sample_rate" => configuration.traces_sample_rate&.to_s, "environment" => configuration.environment, "release" => configuration.release, - "public_key" => configuration.dsn&.public_key + "public_key" => configuration.dsn&.public_key, + "user_segment" => @scope.user && @scope.user["segment"] } - user = @scope&.user - items["user_segment"] = user["segment"] if user && user["segment"] - items.compact! @baggage = Baggage.new(items, mutable: false) end