public override bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { if (binder.Operation == ExpressionType.AddAssign) { var quantity = (int)arg; var name = String.Join(".", _parts); switch (_metricType) { case MetricType.COUNT: _statsd.LogCount(name, quantity); break; case MetricType.GAUGE: _statsd.LogGauge(name, quantity); break; case MetricType.TIMING: _statsd.LogTiming(name, quantity); break; case MetricType.SET: _statsd.LogSet(name, quantity); break; } result = null; return(true); } result = null; return(false); }
private static void IntHandler(IStatsd client, string metricType, string name, object arg) { var value = Convert.ToInt32(arg); switch (metricType) { case MetricType.COUNT: client.LogCount(name, value); break; case MetricType.GAUGE: client.LogGauge(name, value); break; case MetricType.TIMING: client.LogTiming(name, value); break; case MetricType.SET: client.LogSet(name, value); break; } }
public void LogSet(string name, int value) { _statsdClient.LogSet(string.Format("{0}.{1}", GetStandardPrefix, name), value); }