Beispiel #1
0
        static JMetric()
        {
            MetricsOptions options = OptionParser.ParserOptions();

            Metric.Config.WithReporting(config =>
            {
                if (options.Reporter == ReporterTypeEnum.Influxdb)
                {
                    config.WithInfluxDb(new Uri(options.ReportUrl), options.Username, options.Password, TimeSpan.FromSeconds(options.Interval));
                }
                else
                {
                    config.WithServiceReport(TimeSpan.FromMinutes(options.Interval), options.ReportUrl);
                }
            });

            string httpEndpoint = System.Configuration.ConfigurationManager.AppSettings["Metrics.HttpEndpoint"];

            if (!string.IsNullOrEmpty(httpEndpoint))
            {
                Metric.Config.WithHttpEndpoint(httpEndpoint);
            }
        }