Пример #1
0
        public HttpHandler(FrontierSetings setings, IMetricScope metricScope, ILog log, IAirlockClient airlockClient)
        {
            this.log           = log;
            this.airlockClient = airlockClient;
            log.Debug("settings: " + setings?.ToPrettyJson());
            var httpScope = metricScope.WithTag(MetricsTagNames.Type, "http");

            resendTo = setings?.ResendTo;
            if (string.IsNullOrWhiteSpace(resendTo))
            {
                resendTo = null;
            }
            else
            {
                resendHttpClient = new HttpClient();
            }

            reportHandlers = new IReportHandler[]
            {
                new StacktraceHandler("stacktracejs", httpScope, log, setings),
                new ReportHandler <CspReport>("csp", httpScope, log),
                new ReportHandler <PkpReport>("pkp", httpScope, log)
            };
            var handlerScope = metricScope.WithTag(MetricsTagNames.Operation, "handler");

            totalCounter = handlerScope.Counter("total");
            errorCounter = handlerScope.Counter("errors");
            environment  = VostokHostingEnvironment.Current.Environment;
        }
Пример #2
0
        public ConsumerMetrics(TimeSpan flushMetricsInterval, IMetricScope rootMetricScope)
        {
            statScope       = rootMetricScope.WithTag(MetricsTagNames.Type, "libstat");
            processorsScope = rootMetricScope.WithTag(MetricsTagNames.Type, "processors");
            hostScope       = rootMetricScope.WithTag(MetricsTagNames.Type, "grouphost");
            var errorsScope = rootMetricScope.WithTag(MetricsTagNames.Type, "error");

            CriticalErrorCounter = errorsScope.Counter(flushMetricsInterval, "critical");
            ConsumeErrorCounter  = errorsScope.Counter(flushMetricsInterval, "consume");
            MetricClocks.Get(flushMetricsInterval).Register(WriteMetrics);
        }
Пример #3
0
 public ReportHandler(string name, IMetricScope metricScope, ILog log)
 {
     Name         = name;
     this.log     = log;
     metricScope  = metricScope.WithTag(MetricsTagNames.Operation, name);
     totalCounter = metricScope.Counter("total");
     errorCounter = metricScope.Counter("errors");
 }
Пример #4
0
        public static void SystemMetrics(this IMetricScope scope, TimeSpan period)
        {
            var systemScope = scope.WithTag(MetricsTagNames.Type, "system");

            systemScope.CpuLoad(period);
            systemScope.MemoryUsage(period);
            systemScope.DiskUsage(period);
            systemScope.NetworkUsage(period);
            systemScope.ThreadPool(period);
            systemScope.GC(period);
            systemScope.Uptime(period);
        }