<commit_before>module Mnemosyne
  class Trace < Span
    attr_reader :uuid, :transaction, :origin

    def initialize(name, transaction: nil, origin: nil)
      super name

      @uuid = ::SecureRandom.uuid
      @span = []

      @origin      = origin
      @transaction = transaction
    end

    def <<(span)
      @span << span
    end

    def submit
      finish! unless finish

      client.send self
    end

    def client
      ::Mnemosyne::Client.instance
    end

    def serialize
      {
        uuid: uuid,
        origin: origin,
        transaction: transaction,
        name: name,
        start: start,
        stop: finish,
        meta: meta,
        span: @span.map(&:serialize)
      }
    end<commit_msg>Add application (demo) to trace data<commit_after>module Mnemosyne
  class Trace < Span
    attr_reader :uuid, :transaction, :application, :origin

    def initialize(name, transaction: nil, origin: nil)
      super name

      @uuid = ::SecureRandom.uuid
      @span = []

      @origin      = origin
      @transaction = transaction
      @application = '9d77c3fa-9859-45a6-9765-99b18fdf1aeb' # TODO
    end

    def <<(span)
      @span << span
    end

    def submit
      finish! unless finish

      client.send self
    end

    def client
      ::Mnemosyne::Client.instance
    end

    def serialize
      {
        uuid: uuid,
        origin: origin,
        transaction: transaction,
        application: application,
        name: name,
        start: start,
        stop: finish,
        meta: meta,
        span: @span.map(&:serialize)
      }
    end
{'fraction_non_alphanumeric': 0.09096612296110414, 'fraction_numerical': 0.012547051442910916, 'mean_word_length': 1.868705035971223, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3673258', 'n_tokens_mistral': 489, 'n_tokens_neox': 460, 'n_words': 132}