public void Configure(dynamic configuration) { try { DisposeDependencies(); //IResolveCounterType resolver, Uri endpoint, int maxUdpPacket = 512 _connection = new StatsdUDP(configuration.Host.ToString(), (int)configuration.Port, (int)configuration.MaxUdpPacket); _sender = new Statsd(_connection); _resolver = new RegexResolver(); foreach (var map in configuration.CounterTypeMaps) { _resolver.Add(map.Regex.ToString(), Enum.Parse(typeof(StatsDTypes),map.Type.ToString())); } } catch (Exception ex) { Logger.ErrorFormat("Error configuring StatsDSink, check your configuration file! Exception:{@exception}",ex); throw; } }
public StatsDSink(RegexResolver resolver, Uri uri,int maxUdpPacketSize=512) { _resolver = resolver; _connection = new StatsdUDP(uri.Host, uri.Port, maxUdpPacketSize); }