Example #1
0
        /// <summary>
        /// Configures the Metric class with a configuration. Call this once at application startup (Main(), Global.asax, etc).
        /// </summary>
        /// <param name="config">Configuration settings.</param>
        public static void Configure(MetricsConfig config)
        {
            CheckValidity(config);

            _textUdp = new TextUDP(
                config.ServerName,
                config.ServerPort,
                config.MaxUDPPacketSize);

            _statsD     = new SyncSender(_textUdp, config.Tags);
            _configured = true;
        }
Example #2
0
        public static AsyncSender ConfigureAsync(MetricsConfig config)
        {
            CheckValidity(config);

            _textUdp = new TextUDP(
                config.ServerName,
                config.ServerPort,
                config.MaxUDPPacketSize);

            var asyncSender = new AsyncSender(
                _textUdp,
                config.Tags,
                config.AsyncMaxNumberOfPointsInQueue,
                config.MaxUDPPacketSize);

            _statsD     = asyncSender;
            _configured = true;

            return(asyncSender);
        }