class ElasticAPM::Serializers::Transactions
@api private
def build(transaction)
def build(transaction) base = { id: transaction.id, name: transaction.name, type: transaction.type, result: transaction.result.to_s, duration: ms(transaction.duration), timestamp: micros_to_time(transaction.timestamp).utc.iso8601, spans: transaction.spans.map(&method(:build_span)), sampled: transaction.sampled, context: transaction.context.to_h } if transaction.dropped_spans > 0 base[:span_count] = { dropped: { total: transaction.dropped_spans } } end base end
def build_all(transactions)
def build_all(transactions) { transactions: Array(transactions).map(&method(:build)) } end
def build_span(span)
def build_span(span) { id: span.id, parent: span.parent && span.parent.id, name: span.name, type: span.type, start: ms(span.relative_start), duration: ms(span.duration), context: span.context && { db: span.context.to_h }, stacktrace: span.stacktrace.to_a } end