private function createMetricPublisher(ContainerBuilder $container, $name, array $publisher)
{
$serviceName = 'tolerance.metrics.publisher.' . $name;
if ('logger' == $publisher['type']) {
$definiton = $container->setDefinition($serviceName, new Definition(LoggerPublisher::class, [new Reference('logger')]));
} elseif ('hosted_graphite' == $publisher['type']) {
$definiton = $container->setDefinition($serviceName, new Definition(HostedGraphitePublisher::class, [$publisher['options']['server'], $publisher['options']['port'], $publisher['options']['api_key']]));
} elseif ('beberlei' == $publisher['type']) {
$definiton = $container->setDefinition($serviceName, new Definition(BeberleiMetricsAdapterPublisher::class, [new Reference($publisher['options']['service']), array_key_exists('auto_flush', $publisher['options']) ? (bool) $publisher['options']['auto_flush'] : true]));
} else {
throw new \RuntimeException(sprintf('Publisher "%s" not supported', $publisher['type']));
}
if (isset($publisher['operation_runner'])) {
$definiton = $container->setDefinition($serviceName, new Definition(DelegatesToOperationRunnerPublisher::class, [$container->getDefinition($serviceName), new Reference($publisher['operation_runner'])]));
}
$definiton->addTag('tolerance.metrics.publisher');
}