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);
            }
Exemplo n.º 2
0
            private static void DoubleHandler(IStatsd client, string metricType, string name, object arg)
            {
                var value = Convert.ToDouble(arg);

                switch (metricType)
                {
                case MetricType.COUNT:
                    throw new NotSupportedException();

                case MetricType.GAUGE:
                    client.LogGauge(name, value);
                    break;

                case MetricType.TIMING:
                    throw new NotSupportedException();

                case MetricType.SET:
                    throw new NotSupportedException();
                }
            }
Exemplo n.º 3
0
            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;
                }
            }
Exemplo n.º 4
0
 public void Gauge(string statName, double value)
 {
     _client.LogGauge(statName, (int)value);
 }
Exemplo n.º 5
0
 public void LogGauge(string name, int value, Dictionary <string, string> tags = null)
 {
     RunSafe(() =>
             _statsd.LogGauge(BuildName(name, tags), value));
 }
Exemplo n.º 6
0
 public void LogGauge(string name, int value)
 {
     _statsdClient.LogGauge(string.Format("{0}.{1}", GetStandardPrefix, name), value);
 }