protected AbstractProducerWithMetricsFactory(ILogger <AbstractProducerWithMetricsFactory <TKey, TValue> > logger, AbstractKafkaProducerSettings settings, ISerializer <TKey> keySerializer, ISerializer <TValue> valueSerializer, IMetricsPublisher stats) : base(logger, settings, keySerializer, valueSerializer) { Stats = stats; }
public MetricsScrapeAndUpload(IMetricsScraper scraper, IMetricsPublisher publisher, Guid metricsCollectorRuntimeId) { this.scraper = Preconditions.CheckNotNull(scraper); this.publisher = Preconditions.CheckNotNull(publisher); Preconditions.CheckArgument(metricsCollectorRuntimeId != Guid.Empty); this.metricsCollectorRuntimeId = metricsCollectorRuntimeId; }
public MetricsWorker(IMetricsScraper scraper, IMetricsStorage storage, IMetricsPublisher uploader, ISystemTime systemTime = null) { this.scraper = Preconditions.CheckNotNull(scraper, nameof(scraper)); this.storage = Preconditions.CheckNotNull(storage, nameof(storage)); this.uploader = Preconditions.CheckNotNull(uploader, nameof(uploader)); this.systemTime = systemTime ?? SystemTime.Instance; }
public PerfMetricPublisherService( IMetricsPublisher metricsPublisher, IReadOnlyCollection <NamedPerformanceMetric> availablePerfMetrics) { this.metricsPublisher = metricsPublisher; this.availablePerfMetrics = availablePerfMetrics; }
public void Configure(MobileCore core, ServiceConfiguration config) { this.identifier = config.Id; string metricsUrl = config.Url; this.publisher = new NetworkMetricsPublisher(metricsUrl); }
protected AbstractKafkaPipelineWithMetrics(ILogger <AbstractKafkaPipelineWithMetrics <TConsumerKey, TConsumerValue, TPipe> > logger, IConsumerFactory <TConsumerKey, TConsumerValue> consumerFactory, IMetricsPublisher stats, IServiceProvider serviceProvider) : base(logger, consumerFactory, serviceProvider) { _stats = stats; }
protected AbstractConsumerWithMetricsFactory(ILogger <AbstractConsumerWithMetricsFactory <TKey, TValue> > logger, AbstractKafkaConsumerSettings settings, IDeserializer <TValue> valueDeserializer, IMetricsPublisher stats) : base(logger, settings, valueDeserializer) { Stats = stats; }
public SymbolServiceEventProcessor( IWebHostEnvironment environment, IMetricsPublisher metrics, IOptions <SymbolServiceOptions> options) { _environment = environment; _metrics = metrics; _options = options.Value; }
public MetricsWorker(IMetricsScraper scraper, IMetricsStorage storage, IMetricsPublisher uploader) { this.scraper = Preconditions.CheckNotNull(scraper, nameof(scraper)); this.storage = Preconditions.CheckNotNull(storage, nameof(storage)); this.uploader = Preconditions.CheckNotNull(uploader, nameof(uploader)); this.metricFilter = new MetricFilter() .AddAllowedTags(new KeyValuePair <string, string>(MetricsConstants.MsTelemetry, true.ToString())) .AddTagsToRemove(MetricsConstants.MsTelemetry, MetricsConstants.IotHubLabel, MetricsConstants.DeviceIdLabel); }
public MetricsWorker(IMetricsScraper scraper, IMetricsStorage storage, IMetricsPublisher uploader) { this.scraper = Preconditions.CheckNotNull(scraper, nameof(scraper)); this.storage = Preconditions.CheckNotNull(storage, nameof(storage)); this.uploader = Preconditions.CheckNotNull(uploader, nameof(uploader)); this.metricFilter = new MetricTransformer() .AddAllowedTags(new KeyValuePair <string, string>(MetricsConstants.MsTelemetry, true.ToString())) .AddTagsToRemove(MetricsConstants.MsTelemetry, MetricsConstants.IotHubLabel, MetricsConstants.DeviceIdLabel) .AddTagsToModify(("id", this.ReplaceDeviceId), ("module_name", name => name.CreateSha256())); }
public MetricsEventManager(IOptionsMonitor <AppServiceOptions> appServiceOptions, IEventGenerator generator, int functionActivityFlushIntervalSeconds, IMetricsPublisher metricsPublisher, int metricsFlushIntervalMS = DefaultFlushIntervalMS) { // we read these in the ctor (not static ctor) since it can change on the fly _appServiceOptions = appServiceOptions; _eventGenerator = generator; _functionActivityFlushIntervalSeconds = functionActivityFlushIntervalSeconds; QueuedEvents = new ConcurrentDictionary <string, SystemMetricEvent>(StringComparer.OrdinalIgnoreCase); // Initialize the periodic log flush timer _metricsFlushTimer = new Timer(TimerFlush, null, metricsFlushIntervalMS, metricsFlushIntervalMS); _metricsPublisher = metricsPublisher; }
public MetricsEventManager(IEnvironment environment, IEventGenerator generator, int functionActivityFlushIntervalSeconds, IMetricsPublisher metricsPublisher, int metricsFlushIntervalMS = DefaultFlushIntervalMS) { // we read these in the ctor (not static ctor) since it can change on the fly appName = GetNormalizedString(environment.GetAzureWebsiteUniqueSlotName()); subscriptionId = environment.GetSubscriptionId() ?? string.Empty; _eventGenerator = generator; _functionActivityFlushIntervalSeconds = functionActivityFlushIntervalSeconds; QueuedEvents = new ConcurrentDictionary <string, SystemMetricEvent>(StringComparer.OrdinalIgnoreCase); // Initialize the periodic log flush timer _metricsFlushTimer = new Timer(TimerFlush, null, metricsFlushIntervalMS, metricsFlushIntervalMS); _metricsPublisher = metricsPublisher; }
internal FunctionActivityTracker(IOptionsMonitor <AppServiceOptions> appServiceOptions, IEventGenerator generator, IMetricsPublisher metricsPublisher, ILinuxContainerActivityPublisher linuxContainerActivityPublisher, int functionActivityFlushInterval) { MetricsEventGenerator = generator; _appServiceOptions = appServiceOptions; _functionActivityFlushInterval = functionActivityFlushInterval; if (linuxContainerActivityPublisher != null && linuxContainerActivityPublisher != NullLinuxContainerActivityPublisher.Instance) { _linuxContainerActivityPublisher = linuxContainerActivityPublisher; } if (metricsPublisher != null && metricsPublisher != NullMetricsPublisher.Instance) { _metricsPublisher = metricsPublisher; } Task.Run( async() => { try { int currentSecond = _functionActivityFlushInterval; while (!_etwTaskCancellationSource.Token.IsCancellationRequested) { RaiseMetricsPerFunctionEvent(); if (currentSecond >= _functionActivityFlushInterval) { RaiseFunctionMetricEvents(); currentSecond = 0; } else { currentSecond = currentSecond + 1; } await Task.Delay(TimeSpan.FromSeconds(1), _etwTaskCancellationSource.Token); } } catch (TaskCanceledException) { // This exception gets throws when cancellation request is raised via cancellation token. // Let's eat this exception and continue } }, _etwTaskCancellationSource.Token); }
internal FunctionActivityTracker(IOptionsMonitor <AppServiceOptions> appServiceOptions, IEventGenerator generator, IMetricsPublisher metricsPublisher, ILinuxContainerActivityPublisher linuxContainerActivityPublisher, int functionActivityFlushInterval) { MetricsEventGenerator = generator; _appServiceOptions = appServiceOptions; _functionActivityFlushInterval = functionActivityFlushInterval; if (linuxContainerActivityPublisher != null && linuxContainerActivityPublisher != NullLinuxContainerActivityPublisher.Instance) { _linuxContainerActivityPublisher = linuxContainerActivityPublisher; } if (metricsPublisher != null && metricsPublisher != NullMetricsPublisher.Instance) { _metricsPublisher = metricsPublisher; } StartActivityTimer(); }
internal FunctionActivityTracker(IOptionsMonitor <AppServiceOptions> appServiceOptions, IEventGenerator generator, IMetricsPublisher metricsPublisher, ILinuxContainerActivityPublisher linuxContainerActivityPublisher, int functionActivityFlushInterval, ILogger <MetricsEventManager> logger) { MetricsEventGenerator = generator; _appServiceOptions = appServiceOptions; _functionActivityFlushInterval = functionActivityFlushInterval; if (linuxContainerActivityPublisher != null && linuxContainerActivityPublisher != NullLinuxContainerActivityPublisher.Instance) { _linuxContainerActivityPublisher = linuxContainerActivityPublisher; } if (metricsPublisher != null && metricsPublisher != NullMetricsPublisher.Instance) { _metricsPublisher = metricsPublisher; } _activityFlushCounter = _functionActivityFlushInterval; _activityTimer = new Timer(TimerFlush, null, _activityTimerIntervalMS, _activityTimerIntervalMS); _logger = logger; }
public SymsorterBatchFinalizer( IMetricsPublisher metrics, IOptions <SymbolServiceOptions> options, ISymbolGcsWriter gcsWriter, BundleIdGenerator bundleIdGenerator, IHub hub, ILogger <SymsorterBatchFinalizer> logger) { _options = options?.Value ?? throw new ArgumentNullException(nameof(options)); _metrics = metrics; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _gcsWriter = gcsWriter ?? throw new ArgumentNullException(nameof(gcsWriter)); _bundleIdGenerator = bundleIdGenerator; _hub = hub; if (!File.Exists(_options.SymsorterPath)) { throw new ArgumentException($"Symsorter not found at: {_options.SymsorterPath}"); } _symsorterOutputPath = Path.Combine(_options.BaseWorkingPath, "symsorter_output"); Directory.CreateDirectory(_symsorterOutputPath); }
protected override void Load(ContainerBuilder builder) { // IMetricsScraper builder.Register(c => new MetricsScraper(new string[] { "http://edgeHub:9600/metrics", "http://edgeAgent:9600/metrics" })) .As <IMetricsScraper>() .SingleInstance(); // Task<IMetricsStorage> builder.Register(async c => { IStoreProvider storeProvider = await c.Resolve <Task <IStoreProvider> >(); ISequentialStore <IEnumerable <Metric> > dataStore = await storeProvider.GetSequentialStore <IEnumerable <Metric> >("Metrics"); return(new MetricsStorage(dataStore) as IMetricsStorage); }) .As <Task <IMetricsStorage> >() .SingleInstance(); // IMetricsPublisher builder.RegisterType <EdgeRuntimeDiagnosticsUpload>() .As <IMetricsPublisher>() .SingleInstance(); // Task<MetricsWorker> builder.Register(async c => { IMetricsScraper scraper = c.Resolve <IMetricsScraper>(); IMetricsPublisher publisher = c.Resolve <IMetricsPublisher>(); Task <IMetricsStorage> storage = c.Resolve <Task <IMetricsStorage> >(); return(new MetricsWorker(scraper, await storage, publisher)); }) .As <Task <MetricsWorker> >() .SingleInstance(); base.Load(builder); }
internal FunctionActivityTracker(IEventGenerator generator, IMetricsPublisher metricsPublisher, int functionActivityFlushInterval) { MetricsEventGenerator = generator; _functionActivityFlushInterval = functionActivityFlushInterval; _metricsPublisher = metricsPublisher; Task.Run( async() => { try { int currentSecond = _functionActivityFlushInterval; while (!_etwTaskCancellationSource.Token.IsCancellationRequested) { RaiseMetricsPerFunctionEvent(); if (currentSecond >= _functionActivityFlushInterval) { RaiseFunctionMetricEvents(); currentSecond = 0; } else { currentSecond = currentSecond + 1; } await Task.Delay(TimeSpan.FromSeconds(1), _etwTaskCancellationSource.Token); } } catch (TaskCanceledException) { // This exception gets throws when cancellation request is raised via cancellation token. // Let's eat this exception and continue } }, _etwTaskCancellationSource.Token); }
public MetricsWorker(IMetricsScraper scraper, IMetricsStorage storage, IMetricsPublisher uploader) { this.scraper = Preconditions.CheckNotNull(scraper, nameof(scraper)); this.storage = Preconditions.CheckNotNull(storage, nameof(storage)); this.uploader = Preconditions.CheckNotNull(uploader, nameof(uploader)); this.metricFilter = new MetricTransformer() .AddAllowedTags((MetricsConstants.MsTelemetry, true.ToString())) .AddDisallowedTags( ("quantile", "0.1"), ("quantile", "0.5"), ("quantile", "0.99")) .AddTagsToRemove(MetricsConstants.MsTelemetry, MetricsConstants.IotHubLabel, MetricsConstants.DeviceIdLabel) .AddTagsToModify( ("id", this.ReplaceDeviceId), ("module_name", this.ReplaceModuleId), ("to", name => name.CreateSha256()), ("from", name => name.CreateSha256()), ("to_route_input", name => name.CreateSha256()), ("from_route_output", name => name.CreateSha256())); #pragma warning disable SA1111 // Closing parenthesis should be on line of last parameter this.metricAggregator = new MetricAggregator( new AggregationTemplate("edgehub_gettwin_total", "id", new Summer()), new AggregationTemplate( "edgehub_messages_received_total", ("route_output", new Summer()), ("id", new Summer()) ), new AggregationTemplate( "edgehub_messages_sent_total", ("from", new Summer()), ("to", new Summer()), ("from_route_output", new Summer()), ("to_route_input", new Summer()) ), new AggregationTemplate( new string[] { "edgehub_message_size_bytes", "edgehub_message_size_bytes_sum", "edgehub_message_size_bytes_count" }, "id", new Averager()), new AggregationTemplate( new string[] { "edgehub_message_process_duration_seconds", "edgehub_message_process_duration_seconds_sum", "edgehub_message_process_duration_seconds_count", }, ("from", new Averager()), ("to", new Averager()) ), new AggregationTemplate( "edgehub_direct_methods_total", ("from", new Summer()), ("to", new Summer()) ), new AggregationTemplate("edgehub_queue_length", "endpoint", new Summer()), new AggregationTemplate( new string[] { "edgehub_messages_dropped_total", "edgehub_messages_unack_total", }, ("from", new Summer()), ("from_route_output", new Summer()) ), new AggregationTemplate("edgehub_client_connect_failed_total", "id", new Summer()) ); #pragma warning restore SA1111 // Closing parenthesis should be on line of last parameter }
public MetricsEventManager(IOptionsMonitor <AppServiceOptions> appServiceOptions, IEventGenerator generator, int functionActivityFlushIntervalSeconds, IMetricsPublisher metricsPublisher, ILinuxContainerActivityPublisher linuxContainerActivityPublisher, ILogger <MetricsEventManager> logger, int metricsFlushIntervalMS = DefaultFlushIntervalMS) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); // we read these in the ctor (not static ctor) since it can change on the fly _appServiceOptions = appServiceOptions; _eventGenerator = generator; _functionActivityFlushIntervalSeconds = functionActivityFlushIntervalSeconds; QueuedEvents = new ConcurrentDictionary <string, SystemMetricEvent>(StringComparer.OrdinalIgnoreCase); // Initialize the periodic log flush timer _metricsFlushTimer = new Timer(TimerFlush, null, metricsFlushIntervalMS, metricsFlushIntervalMS); _functionActivityTracker = new FunctionActivityTracker(_appServiceOptions, _eventGenerator, metricsPublisher, linuxContainerActivityPublisher, _functionActivityFlushIntervalSeconds, _logger); }
public MetricsWorker(IMetricsScraper scraper, IMetricsStorage storage, IMetricsPublisher uploader) { this.scraper = Preconditions.CheckNotNull(scraper, nameof(scraper)); this.storage = Preconditions.CheckNotNull(storage, nameof(storage)); this.uploader = Preconditions.CheckNotNull(uploader, nameof(uploader)); }
protected AbstractProducerWithMetricsFactory(ILogger <AbstractProducerWithMetricsFactory <TKey, TValue> > logger, AbstractKafkaProducerSettings settings, ISerializer <TValue> valueSerializer, IMetricsPublisher stats) : this(logger, settings, null, valueSerializer, stats) { }
public MetricsScrapeAndUpload(IMetricsScraper scraper, IMetricsPublisher publisher, Dictionary <string, string> additionalTags) { this.scraper = Preconditions.CheckNotNull(scraper); this.publisher = Preconditions.CheckNotNull(publisher); this.additionalTags = Preconditions.CheckNotNull(additionalTags); }
public Metrics(IMetricsPublisher stats) { _stats = stats; }
public WebHostMetricsLogger(IOptionsMonitor <AppServiceOptions> appServiceOptions, IEventGenerator eventGenerator, IMetricsPublisher metricsPublisher) : this(appServiceOptions, eventGenerator, metricsPublisher, 5) { }
public static Metrics Metric(this IMetricsPublisher stats) { return(new Metrics(stats)); }
protected WebHostMetricsLogger(IOptionsMonitor <AppServiceOptions> appServiceOptions, IEventGenerator eventGenerator, IMetricsPublisher metricsPublisher, int metricEventIntervalInSeconds) { _metricsEventManager = new MetricsEventManager(appServiceOptions, eventGenerator, metricEventIntervalInSeconds, metricsPublisher); }
public WebHostMetricsLogger(IEnvironment environment, IEventGenerator eventGenerator, IMetricsPublisher metricsPublisher) : this(environment, eventGenerator, metricsPublisher, 5) { }
protected WebHostMetricsLogger(IEnvironment environment, IEventGenerator eventGenerator, IMetricsPublisher metricsPublisher, int metricEventIntervalInSeconds) { _metricsEventManager = new MetricsEventManager(environment, eventGenerator, metricEventIntervalInSeconds, metricsPublisher); }
protected internal KafkaProducerWithMetrics(ILogger logger, string topic, IProducer <TKey, TValue> producer, IMetricsPublisher stats) : base(logger, topic, producer) { _stats = stats; }