Example #1
0
        public GraphiteReporter(IGraphiteConfiguration configuration, IGraphiteSwitch graphiteSwitch)
        {
            if (configuration.IpAddress == null)
            {
                return;
            }

            var       values = configuration.IpAddress.Split(':');
            IPAddress ipAddress;

            ipAddress = IPAddress.TryParse(values[0], out ipAddress) ? ipAddress : null;

            if (ipAddress == null)
            {
                return;
            }

            _graphiteSwitch    = graphiteSwitch;
            _iPEndPoint        = new IPEndPoint(ipAddress, 8125);
            _reportMachineName = configuration.ReportMachineName;
            _prefix            = configuration.Prefix;
            _udpClient         = new UdpClient();
#if (!NETSTANDARD1_6)
            _udpClient.Connect(_iPEndPoint);
#endif
        }
        private void SetupPipes(IGraphiteConfiguration graphite, IStatsDConfiguration statsd)
        {
            if (graphite != null && !string.IsNullOrWhiteSpace(graphite.Address))
            {
                this.SetupGraphite(graphite);
                this.graphitePrefix = graphite.PrefixKey;
            }

            if (statsd != null && !string.IsNullOrWhiteSpace(statsd.Address))
            {
                this.SetupStatsD(statsd);
                this.statsdPrefix = statsd.PrefixKey;
            }
        }
        private void SetupGraphite(IGraphiteConfiguration configuration)
        {
            IPAddress address = Helpers.ParseAddress(configuration.Address);

            if (configuration.Transport == TransportType.Tcp)
            {
                // Initialize with ip address.
                this.graphitePipe = new TcpPipe(address, configuration.Port);
            }
            else if (configuration.Transport == TransportType.Udp)
            {
                // Initialize with ip address.
                this.graphitePipe = new UdpPipe(address, configuration.Port);
            }
            else
            {
                throw new NotImplementedException("Unknown transport type for graphite pipe: " + configuration.Transport);
            }
        }
Example #4
0
        public GraphiteBackend(IGraphiteConfiguration configuration)
        {
            this.factory = new ChannelFactory(configuration, null);

            this.graphiteChannel = this.factory.CreateChannel("gauge", "graphite");
        }
Example #5
0
 public OutputFactory(IGraphiteConfiguration graphiteConfiguration, IStatsDConfiguration statsDConfiguration)
 {
     this.graphiteConfiguration = graphiteConfiguration;
     this.statsDConfiguration   = statsDConfiguration;
 }
Example #6
0
 public OutputFactory(IGraphiteConfiguration graphiteConfiguration, IStatsDConfiguration statsDConfiguration)
 {
     this.graphiteConfiguration = graphiteConfiguration;
     this.statsDConfiguration = statsDConfiguration;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelFactory" /> class.
        /// </summary>
        /// <param name="graphite">The graphite configuration.</param>
        /// <param name="statsd">The statsd configuration.</param>
        /// <exception cref="System.ArgumentException">Invalid configuration values.</exception>
        public ChannelFactory(IGraphiteConfiguration graphite, IStatsDConfiguration statsd)
        {
            this.formatters = new FormatterFactory();

            this.SetupPipes(graphite, statsd);
        }
        private void SetupPipes(IGraphiteConfiguration graphite, IStatsDConfiguration statsd)
        {
            if (graphite != null && !string.IsNullOrWhiteSpace(graphite.Address))
            {
                this.SetupGraphite(graphite);
                this.graphitePrefix = graphite.PrefixKey;
            }

            if (statsd != null && !string.IsNullOrWhiteSpace(statsd.Address))
            {
                this.SetupStatsD(statsd);
                this.statsdPrefix = statsd.PrefixKey;
            }
        }
        private void SetupGraphite(IGraphiteConfiguration configuration)
        {
            IPAddress address = Helpers.ParseAddress(configuration.Address);

            if (configuration.Transport == TransportType.Tcp)
            {
                // Initialize with ip address.
                this.graphitePipe = new TcpPipe(address, configuration.Port);
            }
            else if (configuration.Transport == TransportType.Udp)
            {
                // Initialize with ip address.
                this.graphitePipe = new UdpPipe(address, configuration.Port);
            }
            else
            {
                throw new NotImplementedException("Unknown transport type for graphite pipe: " + configuration.Transport);
            }
        }
Example #10
0
        public GraphiteBackend(IGraphiteConfiguration configuration)
        {
            this.factory = new ChannelFactory(configuration, null);

            this.graphiteChannel = this.factory.CreateChannel("gauge", "graphite");
        }
 public GraphiteMetricsReporterFactory(IGraphiteConfiguration configuration, IGraphiteSwitch graphiteSwitch = null)
 {
     _configuration  = configuration;
     _graphiteSwitch = graphiteSwitch;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelFactory" /> class.
        /// </summary>
        /// <param name="graphite">The graphite configuration.</param>
        /// <param name="statsd">The statsd configuration.</param>
        /// <exception cref="System.ArgumentException">Invalid configuration values.</exception>
        public ChannelFactory(IGraphiteConfiguration graphite, IStatsDConfiguration statsd)
        {
            this.formatters = new FormatterFactory();

            this.SetupPipes(graphite, statsd);
        }