setName('statsd:statsd') ->setDescription('Insert metric in statsd service') ->addArgument('metric', InputArgument::REQUIRED, 'Metric name') ->addArgument('value', InputArgument::REQUIRED, 'Metric value') ->addArgument('function', InputArgument::OPTIONAL, 'StatsD service function', 'gauge') ; } /** * @param InputInterface $input * @param OutputInterface $output */ protected function execute(InputInterface $input, OutputInterface $output) { $function = $input->getArgument('function'); $metric = $input->getArgument('metric'); $value = $input->getArgument('value'); $output->writeln("statsd: {$function} metric: {$metric} value: {$value}"); $statsdService = $this->getContainer()->get('statsd'); $statsdService->$function($metric, $value); } }