Ejemplo n.º 1
0
  private void registerReporters(Metric2Registry metric2Registry, Configuration configuration) {
    RegexMetricFilter regexFilter = new RegexMetricFilter(getExcludedMetricsPatterns());
    MetricFilter allFilters = new OrMetricFilter(regexFilter, new MetricsWithCountFilter());
    MetricRegistry metricRegistry = metric2Registry.getMetricRegistry();

    reportToGraphite(
        metricRegistry,
        getGraphiteReportingInterval(),
        Stagemonitor.getMeasurementSession(),
        allFilters);
    reportToInfluxDb(
        metric2Registry,
        reportingIntervalInfluxDb.getValue(),
        Stagemonitor.getMeasurementSession());
    reportToElasticsearch(
        metric2Registry,
        reportingIntervalElasticsearch.getValue(),
        Stagemonitor.getMeasurementSession(),
        configuration.getConfig(CorePlugin.class));

    List<ScheduledReporter> onShutdownReporters = new LinkedList<ScheduledReporter>();
    onShutdownReporters.add(
        new SimpleElasticsearchReporter(
            getElasticsearchClient(), metricRegistry, "simple-es-reporter", allFilters));

    reportToConsole(metricRegistry, getConsoleReportingInterval(), allFilters, onShutdownReporters);
    registerAggregationReporter(
        metricRegistry, allFilters, onShutdownReporters, getAggregationReportingInterval());
    if (reportToJMX()) {
      reportToJMX(metricRegistry, allFilters);
    }
  }
Ejemplo n.º 2
0
  private void reportToElasticsearch(
      Metric2Registry metricRegistry,
      int reportingInterval,
      final MeasurementSession measurementSession,
      CorePlugin corePlugin) {
    if (isReportToElasticsearch()) {
      elasticsearchClient.sendBulkAsync("KibanaConfig.bulk");
      logger.info(
          "Sending metrics to Elasticsearch ({}) every {}s",
          getElasticsearchUrl(),
          reportingInterval);
      final String mappingJson =
          ElasticsearchClient.requireBoxTypeHotIfHotColdAritectureActive(
              "stagemonitor-elasticsearch-metrics-index-template.json",
              corePlugin.moveToColdNodesAfterDays.getValue());
      elasticsearchClient.sendMappingTemplateAsync(mappingJson, "stagemonitor-metrics");
      final ElasticsearchReporter reporter =
          new ElasticsearchReporter(
              metricRegistry,
              Metric2Filter.ALL,
              TimeUnit.SECONDS,
              TimeUnit.MILLISECONDS,
              measurementSession.asMap(),
              new HttpClient(),
              this);

      reporter.start(reportingInterval, TimeUnit.SECONDS);
      reporters.add(reporter);
      elasticsearchClient.scheduleIndexManagement(
          ElasticsearchReporter.STAGEMONITOR_METRICS_INDEX_PREFIX,
          moveToColdNodesAfterDays.getValue(),
          deleteElasticsearchMetricsAfterDays.getValue());
    } else {
      logger.info(
          "Not sending metrics to Elasticsearch (url={}, interval={}s)",
          getElasticsearchUrl(),
          reportingInterval);
    }
  }
Ejemplo n.º 3
0
 public boolean isCollectSql() {
   return collectSql.getValue();
 }
Ejemplo n.º 4
0
 public boolean isMonitorOnlySpringMvcRequests() {
   return monitorOnlySpringMvcOption.getValue();
 }
Ejemplo n.º 5
0
 public String getMetricsServletAllowedOrigin() {
   return metricsServletAllowedOrigin.getValue();
 }
Ejemplo n.º 6
0
 public boolean isCollectPageLoadTimesPerRequest() {
   return collectPageLoadTimesPerRequest.getValue();
 }
Ejemplo n.º 7
0
 public boolean isWidgetEnabled() {
   return widgetEnabled.getValue();
 }
Ejemplo n.º 8
0
 public boolean isCollectHttpHeaders() {
   return collectHttpHeaders.getValue();
 }
Ejemplo n.º 9
0
 public Integer getReloadConfigurationInterval() {
   return reloadConfigurationInterval.getValue();
 }
Ejemplo n.º 10
0
 public boolean isDeactivateStagemonitorIfEsConfigSourceIsDown() {
   return deactivateStagemonitorIfEsConfigSourceIsDown.getValue();
 }
Ejemplo n.º 11
0
 public String getElasticsearchUrl() {
   return removeTrailingSlash(elasticsearchUrl.getValue());
 }
Ejemplo n.º 12
0
 public String getInstanceName() {
   return instanceName.getValue();
 }
Ejemplo n.º 13
0
 public String getApplicationName() {
   return applicationName.getValue();
 }
Ejemplo n.º 14
0
 public int getGraphitePort() {
   return graphitePort.getValue();
 }
Ejemplo n.º 15
0
 public String getGraphiteHostName() {
   return graphiteHostName.getValue();
 }
Ejemplo n.º 16
0
 public int getElasticsearchReportingInterval() {
   return reportingIntervalElasticsearch.getValue();
 }
Ejemplo n.º 17
0
 public Integer getMoveToColdNodesAfterDays() {
   return moveToColdNodesAfterDays.getValue();
 }
Ejemplo n.º 18
0
 public boolean isAttachAgentAtRuntime() {
   return attachAgentAtRuntime.getValue();
 }
Ejemplo n.º 19
0
 public boolean isParseUserAgent() {
   return parseUserAgent.getValue();
 }
Ejemplo n.º 20
0
 public String getInfluxDbUrl() {
   return removeTrailingSlash(influxDbUrl.getValue());
 }
Ejemplo n.º 21
0
 public boolean isRealUserMonitoringEnabled() {
   return rumEnabled.getValue();
 }
Ejemplo n.º 22
0
 public String getInfluxDbDb() {
   return influxDbDb.getValue();
 }
Ejemplo n.º 23
0
 public boolean isMonitorOnlyForwardedRequests() {
   return monitorOnlyForwardedRequests.getValue();
 }
Ejemplo n.º 24
0
 public boolean isReportToElasticsearch() {
   return StringUtils.isNotEmpty(getElasticsearchUrl())
       && reportingIntervalElasticsearch.getValue() > 0;
 }
Ejemplo n.º 25
0
 public String getMetricsServletJsonpParamName() {
   return metricsServletJsonpParameter.getValue();
 }
Ejemplo n.º 26
0
 public String getGrafanaUrl() {
   return removeTrailingSlash(grafanaUrl.getValue());
 }
Ejemplo n.º 27
0
 public boolean isMonitorOnlyResteasyRequests() {
   return monitorOnlyResteasyOption.getValue();
 }
Ejemplo n.º 28
0
 public String getGrafanaApiKey() {
   return grafanaApiKey.getValue();
 }
Ejemplo n.º 29
0
 public boolean isCollectPreparedStatementParameters() {
   return collectPreparedStatementParameters.getValue();
 }
Ejemplo n.º 30
0
 public int getThreadPoolQueueCapacityLimit() {
   return threadPoolQueueCapacityLimit.getValue();
 }