/// <summary> /// Construct a HeartbeaterService that periodically reports heartbeats for multiple /// components. /// </summary> /// <param name="wavefrontMetricSender"> /// Sender that handles sending of heartbeat metrics to Wavefront. /// </param> /// <param name="applicationTags">Application tags.</param> /// <param name="components">List of components to send heartbeats for.</param> /// <param name="source">The source (or host).</param> public HeartbeaterService( IWavefrontMetricSender wavefrontMetricSender, ApplicationTags applicationTags, IList <string> components, string source) : this(wavefrontMetricSender, applicationTags, components, source, Logging.LoggerFactory) { }
/// <summary> /// Construct a HeartbeaterService that periodically reports heartbeats for one component. /// </summary> /// <param name="wavefrontMetricSender"> /// Sender that handles sending of heartbeat metrics to Wavefront. /// </param> /// <param name="applicationTags">Application tags.</param> /// <param name="component">The component to send heartbeats for.</param> /// <param name="source">The source (or host).</param> public HeartbeaterService( IWavefrontMetricSender wavefrontMetricSender, ApplicationTags applicationTags, string component, string source) : this(wavefrontMetricSender, applicationTags, new List <string> { component }, source) { }
public HeartbeaterService( IWavefrontMetricSender wavefrontMetricSender, ApplicationTags applicationTags, string component, string source) { this.wavefrontMetricSender = wavefrontMetricSender; this.source = source; heartbeatMetricTags = new Dictionary <string, string> { { Constants.ApplicationTagKey, applicationTags.Application }, { Constants.ClusterTagKey, applicationTags.Cluster ?? Constants.NullTagValue }, { Constants.ServiceTagKey, applicationTags.Service }, { Constants.ShardTagKey, applicationTags.Shard ?? Constants.NullTagValue }, { Constants.ComponentTagKey, component } }; }
/// <summary> /// Construct a HeartbeaterService that periodically reports heartbeats for multiple /// components. /// </summary> /// <param name="wavefrontMetricSender"> /// Sender that handles sending of heartbeat metrics to Wavefront. /// </param> /// <param name="applicationTags">Application tags.</param> /// <param name="components">List of components to send heartbeats for.</param> /// <param name="source">The source (or host).</param> /// <param name="source">The logger factory used to create a logger.</param> public HeartbeaterService( IWavefrontMetricSender wavefrontMetricSender, ApplicationTags applicationTags, IList <string> components, string source, ILoggerFactory loggerFactory) { this.wavefrontMetricSender = wavefrontMetricSender; this.source = source; heartbeatMetricTagsList = new List <IDictionary <string, string> >(); customTagsSet = new ConcurrentDictionary <IDictionary <string, string>, bool>( new TagsDictionaryComparer()); logger = loggerFactory.CreateLogger <HeartbeaterService>() ?? throw new ArgumentNullException(nameof(loggerFactory)); foreach (string component in components) { var tags = new Dictionary <string, string> { { Constants.ApplicationTagKey, applicationTags.Application }, { Constants.ClusterTagKey, applicationTags.Cluster ?? Constants.NullTagValue }, { Constants.ServiceTagKey, applicationTags.Service }, { Constants.ShardTagKey, applicationTags.Shard ?? Constants.NullTagValue }, { Constants.ComponentTagKey, component } }; if (applicationTags.CustomTags != null) { foreach (var customTag in applicationTags.CustomTags) { if (!tags.ContainsKey(customTag.Key)) { tags.Add(customTag.Key, customTag.Value); } } } heartbeatMetricTagsList.Add(tags); } }