<commit_before>require 'mixpanel'

module AbPanel
  module Mixpanel
    class Tracker < ::Mixpanel::Tracker
      def initialize(options={})
        @tracker = ::Mixpanel::Tracker.new Config.token, ab_panel_options.merge(options)
      end

      def ab_panel_options
        {
          api_key: Config.api_key,
          env:     AbPanel.env
        }
      end

      def track(event_name, properties, options={})
        @tracker.track event_name, properties, options
      end
    end

    class Config<commit_msg>Use Resque for background jobs if present.<commit_after>require 'mixpanel'

module AbPanel
  module Mixpanel
    class Tracker < ::Mixpanel::Tracker
      def initialize(options={})
        @tracker = ::Mixpanel::Tracker.new Config.token, ab_panel_options.merge(options)
      end

      def ab_panel_options
        {
          api_key: Config.api_key,
          env:     AbPanel.env
        }
      end

      def track(event_name, properties, options={})
        if defined?(Resque)
          Resque.enqueue ResqueTracker, event_name, properties, options
        else
          @tracker.track event_name, properties, options
        end
      end
    end

    class ResqueTracker
      @queue = :ab_panel

      def self.perform(event_name, properties, options={})
        Tracker.new.track(event_name, properties, options)
      end
    end

    class Config
{'fraction_non_alphanumeric': 0.0832729905865315, 'fraction_numerical': 0.0, 'mean_word_length': 2.330120481927711, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4086827', 'n_tokens_mistral': 398, 'n_tokens_neox': 389, 'n_words': 97}