<commit_before>class Iostat < Scout::Plugin

  OPTIONS=<<-EOS
  device:
    name: Device
    notes: The device to check, eg 'sda1'. If not specified, uses the device mounted at '/'
  EOS

  def build_report
    @default_device_used = false
    # determine the device, either from the passed option or by parsing `mount`
    device = get_symlinked_device_name(option('device')) || option('device') || default_device
    stats = iostat(device)
    error("Device not found: #{device} -- check your plugin settings.",
          "FYI, mount returns:\n#{`mount`}") and return if !stats

    counter(:rps,   stats['rio'],        :per => :second)
    counter(:wps,   stats['wio'],        :per => :second)
    counter(:rkbps, stats['rsect'] / 2,  :per => :second)
    counter(:wkbps, stats['wsect'] / 2,  :per => :second)
    counter(:util,  stats['use'] / 10.0, :per => :second)
    # Not 100% sure that average queue length is present on all distros.
    if stats['aveq']
      counter(:aveq,  stats['aveq'], :per => :second)
    end

    if old = memory("#{device}_stats")
      ios = (stats['rio'] - old['rio']) + (stats['wio']  - old['wio'])

      if ios > 0
        await = ((stats['ruse'] - old['ruse']) + (stats['wuse'] - old['wuse'])) / ios.to_f

        report(:await => await)<commit_msg>Use absolute value to iostat wait calculation<commit_after>class Iostat < Scout::Plugin

  OPTIONS=<<-EOS
  device:
    name: Device
    notes: The device to check, eg 'sda1'. If not specified, uses the device mounted at '/'
  EOS

  def build_report
    @default_device_used = false
    # determine the device, either from the passed option or by parsing `mount`
    device = get_symlinked_device_name(option('device')) || option('device') || default_device
    stats = iostat(device)
    error("Device not found: #{device} -- check your plugin settings.",
          "FYI, mount returns:\n#{`mount`}") and return if !stats

    counter(:rps,   stats['rio'],        :per => :second)
    counter(:wps,   stats['wio'],        :per => :second)
    counter(:rkbps, stats['rsect'] / 2,  :per => :second)
    counter(:wkbps, stats['wsect'] / 2,  :per => :second)
    counter(:util,  stats['use'] / 10.0, :per => :second)
    # Not 100% sure that average queue length is present on all distros.
    if stats['aveq']
      counter(:aveq,  stats['aveq'], :per => :second)
    end

    if old = memory("#{device}_stats")
      ios = (stats['rio'] - old['rio']) + (stats['wio']  - old['wio'])

      if ios > 0
        await = ((stats['ruse'] - old['ruse']) + (stats['wuse'] - old['wuse'])).abs / ios.to_f

        report(:await => await)
{'fraction_non_alphanumeric': 0.17074102368220015, 'fraction_numerical': 0.007639419404125287, 'mean_word_length': 3.1179245283018866, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '2591538', 'n_tokens_mistral': 883, 'n_tokens_neox': 846, 'n_words': 247}