Skip to content

Make transaction required in Span constructor #1890

@sl0thentr0py

Description

@sl0thentr0py

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 #1869 (comment)

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions