Пример #1
0
        internal ScorpionMonitorImplement(string contextName, SMConfig config)
        {
            if (null != Context)
            {
                Console.WriteLine("!!!!!!!!!!!!Error: null != Context");
                return;
            }
            Context = Metric.Context(contextName);
            var metricConfig = new MetricsConfig(Context);

            metricConfig.WithReporting(report =>
            {
                if (config.ConsoleReport)
                {
                    report.WithConsoleReport(TimeSpan.FromSeconds(config.ConsoleFreq));
                }
                if (config.DBReport)
                {
                    report.WithInflux(config.Ip, config.Port, config.User, config.Password, config.DBName, TimeSpan.FromSeconds(config.DBFreq), new ConfigOptions
                    {
                        UseHttps = config.SSL,
                    });
                }
            });
        }
 protected override Task OnStart(IMessageSession session)
 {
     metricsConfig.WithReporting(r =>
     {
         r.WithReport(new NServiceBusMetricReporter(dispatcher, monitorQueue), TimeSpan.FromSeconds(5));
     });
     return(Task.CompletedTask);
 }
        public static IMetricsBuilder AddReporter(this IMetricsBuilder builder,
                                                  Action <MetricsReports> reportsAction, MetricsConfig config)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            config.WithReporting(reportsAction);

            return(builder);
        }
        public static MetricsConfig WithReporting(
            this MetricsConfig config,
            ServiceDescriptor service,
            EventHubConnectionInfo eventHubConnection)
        {
            Require.NotNull(config, nameof(config));
            Require.NotNull(service, nameof(service));
            Require.NotNull(eventHubConnection, nameof(eventHubConnection));

            config.WithReporting(reports => reports.WithReport(new EventHubReporter(service, eventHubConnection), TimeSpan.FromSeconds(5)));

            return(config);
        }
Пример #5
0
        protected override void Setup(FeatureConfigurationContext context)
        {
            var metricsContext = new DefaultMetricsContext();
            var metricsConfig  = new MetricsConfig(metricsContext);

            metricsConfig.WithReporting(r =>
            {
                r.WithCSVReports(".", TimeSpan.FromSeconds(5));
            });

            var processedMeter = metricsContext.Meter("Processed", Unit.Custom("audits"), TimeUnit.Seconds, default);

            var settings         = context.Settings.Get <Settings>("ServiceControl.Settings");
            var loadGenetorQueue = SettingsReader <string> .Read("LoadGeneratorQueue");

            var auditQueueAddress = context.Settings.ToTransportAddress(settings.AuditQueue);
            var statistics        = new Statistics();

            context.Container.ConfigureComponent(b => new StatisticsEnricher(statistics, processedMeter), DependencyLifecycle.SingleInstance);
            context.RegisterStartupTask(new ReportProcessingStatistics(statistics, auditQueueAddress, loadGenetorQueue));
        }
Пример #6
0
 public static MetricsConfig WithDemo(this MetricsConfig config, IDemo pulse, string @event, TimeSpan interval)
 {
     return(config.WithReporting(x => x.WithReport(new DemoReport(pulse, @event), interval)));
 }