Class: Capistrano::MetricCollector

### Home Classes Methods

### In Files

- lib/capistrano-stats/metric-collector.rb

### Parent

Object

### Methods

- ::new
- #collect
- #user_preference

### Class/Module Index

Quicksearch

- Capistrano
- Capistrano::MetricCollector
- Capistrano::MetricMessage
- Capistrano::Stats
- Object

No matching classes.

# Capistrano::MetricCollector

### Attributes

pwd[R]

### Public Class Methods

new(pwd) click to toggle source

    # File lib/capistrano-stats/metric-collector.rb, line 11
    def initialize(pwd)
      @pwd = Pathname.new(pwd)
    end

### Public Instance Methods

collect() click to toggle source

    # File lib/capistrano-stats/metric-collector.rb, line 27
    def collect
      return if user_preference == :none
      socket = UDPSocket.new
      message.anonymize! unless user_preference == :full
      socket.send(message.to_s, 0, *destination)
    rescue SocketError, Errno::EACCES, Errno::EADDRINUSE, Errno::EADDRNOTAVAIL,
      Errno::EAFNOSUPPORT, Errno::EALREADY, Errno::EBADF, Errno::ECONNREFUSED,
      Errno::ECONNRESET, Errno::EFAULT, Errno::EHOSTUNREACH, Errno::EINPROGRESS,
      Errno::EINTR, Errno::EINVAL, Errno::EIO, Errno::EISCONN, Errno::ELOOP,
      Errno::ENAMETOOLONG, Errno::ENETDOWN,
      Errno::ENETUNREACH, Errno::ENOBUFS, Errno::ENOENT, Errno::ENOSR,
      Errno::ENOTDIR, Errno::ENOTSOCK, Errno::EOPNOTSUPP, Errno::EPROTOTYPE,
      Errno::ETIMEDOUT, Errno::EWOULDBLOCK
      warn "There was a problem tracking statistics, please report to https://github.com/capistrano/stats"
    end

user_preference() click to toggle source

    # File lib/capistrano-stats/metric-collector.rb, line 15
    def user_preference
      ask_to_enable unless File.exists?(sentry_file)
      pref = File.read(sentry_file)
      if pref.chomp == "true"
        :full
      elsif pref.chomp == "false"
        :ping
      else
        pref && pref.to_sym
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.