sentry-ruby
sentry-ruby copied to clipboard
Make transaction required in Span constructor
Not directly related to this change, but I think conceptually a Span
should always have a transaction
? Because a Transaction
always has itself as the transaction
, and it'll pass down to all Span
that are created by it and their descendants.
If that's the case, do you think we should mark transaction
as a required constructor param? Like
class Span
def initialize(transaction:, ...)
end
end
class Transaction < Span
def initialize(transaction: nil, ...)
@transaction = self # ignore the passed argument
end
end
And then we can change attr_accessor :transaction
to attr_reader
+ being sure the transaction
will never be nil
in such occasions.
Originally posted by @st0012 in https://github.com/getsentry/sentry-ruby/pull/1869#discussion_r970521483