class GitLab::Exporter::CLI::Process
Process
runner
Takes a pid and name for metrics
Constants
- COMMAND_NAME
Public Class Methods
new(args)
click to toggle source
# File lib/gitlab_exporter/cli.rb, line 206 def initialize(args) @options = options(args) @options.parse! @target = args.shift || STDOUT @target = File.open(@target, "a") if @target.is_a?(String) end
Public Instance Methods
help()
click to toggle source
# File lib/gitlab_exporter/cli.rb, line 232 def help @options.help end
options(args)
click to toggle source
# File lib/gitlab_exporter/cli.rb, line 214 def options(args) args.options do |opts| opts.banner = "Usage: #{EXECUTABLE_NAME} #{COMMAND_NAME} [options]" opts.on("--pid=123", "Process ID") do |val| @pid = val end opts.on("--pattern=worker", "Process command pattern") do |val| @pattern = val end opts.on("--name=NAME", "Process name to be used in metrics") do |val| @name = val end opts.on("--quantiles", "Return quantiles instead of exact metrics") do @quantiles = true end end end
run()
click to toggle source
# File lib/gitlab_exporter/cli.rb, line 236 def run ::GitLab::Exporter::ProcessProber.new(pid_or_pattern: @pid || @pattern, name: @name, quantiles: @quantiles) .probe_stat .probe_count .probe_smaps .write_to(@target) end