public GraphiteReporter( MetricsReportingGraphiteOptions options, IGraphiteClient graphiteClient) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (options.FlushInterval < TimeSpan.Zero) { throw new InvalidOperationException($"{nameof(MetricsReportingGraphiteOptions.FlushInterval)} must not be less than zero"); } _graphiteClient = graphiteClient ?? throw new ArgumentNullException(nameof(graphiteClient)); Formatter = options.MetricsOutputFormatter ?? new MetricsGraphitePlainTextProtocolOutputFormatter(); FlushInterval = options.FlushInterval > TimeSpan.Zero ? options.FlushInterval : AppMetricsConstants.Reporting.DefaultFlushInterval; Filter = options.Filter; Logger.Debug($"Using Metrics Reporter {this}. Url: {options.Graphite.BaseUri} FlushInterval: {FlushInterval}"); }
public RtqEventFeedPeriodicJobRunner(IRtqPeriodicJobRunner rtqPeriodicJobRunner, IGraphiteClient graphiteClient, [NotNull] string eventFeedGraphitePathPrefix) { this.rtqPeriodicJobRunner = rtqPeriodicJobRunner; this.graphiteClient = graphiteClient; graphitePathPrefix = $"{eventFeedGraphitePathPrefix}.ActualizationLag.{Dns.GetHostName()}"; }
internal Graphite( ICakeLog log, GraphiteSettings settings, IGraphiteClient client ) { _log = log; _settings = settings; _client = client; }
/// <summary> /// Initializes a new instance of the <see cref="Graphite"/> class. /// </summary> /// <param name="log">Cake log instance.</param> /// <param name="settings"><see cref="GraphiteSettings"/> instance.</param> public Graphite( ICakeLog log, GraphiteSettings settings) { _log = log; _settings = settings; _client = new GraphiteClientWrapper(new GraphiteClient(settings.Host) { HttpApiPort = settings.HttpApiPort, BatchSize = settings.BatchSize, UseSsl = settings.UseSsl, }); }
public GraphiteRtqProfiler([NotNull] IStatsDClient statsDClient, [NotNull] IGraphiteClient graphiteClient, [NotNull] string statsDKeyNamePrefix, [NotNull] string consumerGraphitePathPrefix) { if (string.IsNullOrEmpty(statsDKeyNamePrefix)) { throw new InvalidOperationException("statsDKeyNamePrefix is empty"); } if (string.IsNullOrEmpty(consumerGraphitePathPrefix)) { throw new InvalidOperationException("consumerGraphitePathPrefix is empty"); } this.statsDClient = statsDClient.WithScopes($"{statsDKeyNamePrefix}.{Dns.GetHostName()}", $"{statsDKeyNamePrefix}.Total"); this.graphiteClient = graphiteClient; this.consumerGraphitePathPrefix = FormatGraphitePathPrefix(consumerGraphitePathPrefix); }
public RtqMonitoringEventFeeder(ILog logger, RtqElasticsearchIndexerSettings indexerSettings, IRtqElasticsearchClient elasticsearchClient, IGraphiteClient graphiteClient, IStatsDClient statsDClient, IRtqPeriodicJobRunner rtqPeriodicJobRunner, RemoteTaskQueue remoteTaskQueue) { this.logger = logger.ForContext("CassandraDistributedTaskQueue").ForContext(nameof(RtqMonitoringEventFeeder)); this.indexerSettings = indexerSettings; this.elasticsearchClient = elasticsearchClient; GlobalTime = remoteTaskQueue.GlobalTime; eventSource = new RtqEventSource(remoteTaskQueue.EventLogRepository); var eventFeedPeriodicJobRunner = new RtqEventFeedPeriodicJobRunner(rtqPeriodicJobRunner, graphiteClient, indexerSettings.EventFeedGraphitePathPrefix); eventFeedFactory = new EventFeedFactory(new RtqEventFeedGlobalTimeProvider(GlobalTime), eventFeedPeriodicJobRunner); var perfGraphiteReporter = new RtqMonitoringPerfGraphiteReporter(statsDClient, indexerSettings.PerfGraphitePathPrefix); var taskMetaProcessor = new TaskMetaProcessor(this.logger, indexerSettings, elasticsearchClient, remoteTaskQueue, perfGraphiteReporter); eventConsumer = new RtqMonitoringEventConsumer(indexerSettings, taskMetaProcessor); }
public PeriodicJobWithLeaderElection( [NotNull] IRemoteLockCreator remoteLockCreator, [NotNull] IPeriodicTaskRunner periodicTaskRunner, [NotNull] IGraphiteClient graphiteClient, [NotNull] ILog logger, [NotNull] string jobName, TimeSpan delayBetweenIterations, TimeSpan leaderAcquisitionAttemptDelay, [NotNull] Action <CancellationToken> jobAction, [CanBeNull] Action onTakeTheLead, [CanBeNull] Action onLoseTheLead, CancellationToken cancellationToken) { this.remoteLockCreator = remoteLockCreator; this.periodicTaskRunner = periodicTaskRunner; this.graphiteClient = graphiteClient; this.logger = logger; this.jobName = jobName; this.delayBetweenIterations = delayBetweenIterations; this.leaderAcquisitionAttemptDelay = leaderAcquisitionAttemptDelay; this.jobAction = jobAction; this.onTakeTheLead = onTakeTheLead; this.onLoseTheLead = onLoseTheLead; isDisposed = false; jobCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); leaderActivityReportingJobId = $"leaderActivityReportingJobId-{jobName}"; leaderActivityReportingGraphitePath = $"SubSystem.LeaderElection.{jobName}.{Dns.GetHostName()}"; jobThread = new Thread(() => ThreadProc(jobCancellationTokenSource.Token)) { Name = jobName, IsBackground = true, }; jobThread.Start(); this.logger.Info("Job thread has started for {JobName}", new { JobName = jobName }); }
public RtqTaskCounterEventFeeder(ILog logger, ISerializer serializer, RtqTaskCounterSettings settings, IRtqTaskDataRegistry taskDataRegistry, IRtqTaskCounterStateStorage stateStorage, IGraphiteClient graphiteClient, IStatsDClient statsDClient, IRtqPeriodicJobRunner rtqPeriodicJobRunner, RemoteTaskQueue remoteTaskQueue) { this.serializer = serializer; this.settings = settings; this.taskDataRegistry = taskDataRegistry; this.stateStorage = stateStorage; GlobalTime = remoteTaskQueue.GlobalTime; var eventFeedPeriodicJobRunner = new RtqEventFeedPeriodicJobRunner(rtqPeriodicJobRunner, graphiteClient, settings.EventFeedGraphitePathPrefix); eventFeedFactory = new EventFeedFactory(new RtqEventFeedGlobalTimeProvider(GlobalTime), eventFeedPeriodicJobRunner); eventSource = new RtqEventSource(remoteTaskQueue.EventLogRepository); handleTasksMetaStorage = remoteTaskQueue.HandleTasksMetaStorage; perfGraphiteReporter = new RtqMonitoringPerfGraphiteReporter(statsDClient, settings.PerfGraphitePathPrefix); this.logger = logger.ForContext("CassandraDistributedTaskQueue").ForContext(nameof(RtqTaskCounterEventFeeder)); this.logger.Info("Using RtqTaskCounterSettings: {RtqTaskCounterSettings}", new { RtqTaskCounterSettings = settings.ToPrettyJson() }); }
public static void Send(this IGraphiteClient self, string path, long value) { self.Send(path, value, DateTime.Now); }
public GraphQuery(IGraphiteClient graphiteClient) { _graphiteClient = graphiteClient; }
internal static Graphite Graphite(this ICakeContext context, GraphiteSettings settings, IGraphiteClient graphiteClient) { return(new Graphite(context.Log, settings, graphiteClient)); }
public RtqTaskCounterGraphiteReporter(RtqTaskCounterStateManager stateManager, IGraphiteClient graphiteClient, [NotNull] string graphitePathPrefix) { if (string.IsNullOrEmpty(graphitePathPrefix)) { throw new InvalidOperationException("graphitePathPrefix is empty"); } this.stateManager = stateManager; this.graphiteClient = graphiteClient; this.graphitePathPrefix = graphitePathPrefix; }
public DataPointsController(IGraphiteClient graphiteClient) { _graphiteClient = graphiteClient; }
public PeriodicJobRunnerWithLeaderElection(IRemoteLockCreator remoteLockCreator, IPeriodicTaskRunner periodicTaskRunner, IGraphiteClient graphiteClient, ILog logger) { this.remoteLockCreator = remoteLockCreator; this.periodicTaskRunner = periodicTaskRunner; this.graphiteClient = graphiteClient; this.logger = logger.ForContext(nameof(PeriodicJobRunnerWithLeaderElection)); }