private void ShipMetricUDP(metric m) { udpClient = udpClient ?? new GraphiteUdpClient(config.Hostname, config.Port, config.Prefix + "." + pm.Hostname); var theMetric = FormatMetric(m); var path = MetricPath(theMetric); udpClient.Send(path, (int)m.value); }
public Task CreateContinuousTask(CancellationToken cancellationToken) { return(new Task(() => { var reader = new PerfmonCounterReader(); using (GraphiteUdpClient client = new GraphiteUdpClient(_counterSamplingConfig.MetricHost, _counterSamplingConfig.MetricHostPort, _counterSamplingConfig.MetricPrefix)) { foreach (var samples in reader.StreamCounterSamples(_counterPaths, _counterSamplingConfig.SampleInterval, cancellationToken)) { foreach (PerformanceCounterSample metric in samples.CounterSamples) { foreach (CounterFilter filter in _counterFilters) { if (!metric.IsFiltered(_counterFilters)) { client.Send(metric.MetricPath, metric.MetricValue, metric.Timestamp); } } } } } }, cancellationToken)); }