@Override public void onStart(SpanWrapper spanWrapper) { info = SpanContextInformation.forSpan(spanWrapper); info.spanWrapper = spanWrapper; info.setParent(SpanContextInformation.getCurrent()); spanContextMap.put(spanWrapper, info); for (Map.Entry<String, String> entry : Stagemonitor.getMeasurementSession().asMap().entrySet()) { spanWrapper.setTag(entry.getKey(), entry.getValue()); } }
private void reportToInfluxDb(Metric2Registry metricRegistry, int reportingInterval, MeasurementSession measurementSession) { if (getInfluxDbUrl() != null && reportingInterval > 0) { logger.info("Sending metrics to InfluxDB ({}) every {}s", getInfluxDbUrl(), reportingInterval); final InfluxDbReporter reporter = InfluxDbReporter.forRegistry(metricRegistry, this) .globalTags(measurementSession.asMap()) .build(); reporter.start(reportingInterval, TimeUnit.SECONDS); reporters.add(reporter); } else { logger.info("Not sending metrics to InfluxDB (url={}, interval={}s)", getInfluxDbUrl(), reportingInterval); } }
private void reportToElasticsearch(Metric2Registry metricRegistry, int reportingInterval, final MeasurementSession measurementSession) { if (corePlugin.isReportToElasticsearch()) { logger.info("Sending metrics to Elasticsearch ({}) every {}s", corePlugin.getElasticsearchUrlsWithoutAuthenticationInformation(), reportingInterval); } if (corePlugin.isReportToElasticsearch() || corePlugin.isOnlyLogElasticsearchMetricReports()) { final ElasticsearchReporter reporter = ElasticsearchReporter.forRegistry(metricRegistry, corePlugin) .globalTags(measurementSession.asMap()) .build(); reporter.start(reportingInterval, TimeUnit.SECONDS); corePlugin.closeOnShutdown(reporter); } else { logger.info("Not sending metrics to Elasticsearch (url={}, interval={}s)", corePlugin.getElasticsearchUrlsWithoutAuthenticationInformation(), reportingInterval); } }