private Task CreateTask(string hostName, GraphiteClient client, SqlToGraphiteConfigTemplatesWorkItemsTaskSetTask item) { var graphiteParams = new GraphiteParams(hostName, client.Port); var taskParams = new TaskParams(item.path, item.sql, item.connectionstring, item.type, item.name, item.client); var task = new Task(taskParams, this.dataClientFactory, this.graphiteClientFactory, graphiteParams, log); return task; }
public Task(TaskParams taskParams, IDataClientFactory dataClientFactory, IGraphiteClientFactory graphiteClientFactory, GraphiteParams graphiteParams, ILog log) { this.taskParams = taskParams; this.dataClientFactory = dataClientFactory; this.graphiteClientFactory = graphiteClientFactory; this.graphiteParams = graphiteParams; this.log = log; }
public IStatsClient Create(GraphiteParams graphiteParams, TaskParams taskParams) { var clientType = taskParams.Client.ToLower(); log.Debug(string.Format("Creating a graphite client of type: {0} with values {1} {2}", taskParams.Client, graphiteParams.Hostname, graphiteParams.Port)); if (clientType == "graphitetcp") { return new GraphiteTcpClient(graphiteParams.Hostname, graphiteParams.Port); } if (clientType == "graphiteudp") { return new GraphiteUdpClient(graphiteParams.Hostname, graphiteParams.Port); } if (clientType == "statsdudp") { return new StatsdClient(graphiteParams.Hostname, graphiteParams.Port); } throw new UnknownGraphiteClientTypeException(string.Format("{0} {1}", ErrorMessage, clientType)); }