test_class.declarator: DURATION_UNIT = TimeUnit.MICROSECONDS
test_class.modifier: private static final
test_class.original_string: private static final TimeUnit DURATION_UNIT = TimeUnit.MICROSECONDS;
test_class.type: TimeUnit
test_class.var_name: DURATION_UNIT
test_class.declarator: DURATION_FACTOR = 1.0 / DURATION_UNIT.toNanos(1)
test_class.modifier: private static final
test_class.original_string: private static final double DURATION_FACTOR = 1.0 / DURATION_UNIT.toNanos(1);
test_class.type: double
test_class.var_name: DURATION_FACTOR
test_class.declarator: elasticsearchReporter
test_class.modifier: private
test_class.original_string: private ElasticsearchReporter elasticsearchReporter;
test_class.type: ElasticsearchReporter
test_class.var_name: elasticsearchReporter
test_class.declarator: timestamp
test_class.modifier: private
test_class.original_string: private long timestamp;
test_class.type: long
test_class.var_name: timestamp
test_class.declarator: out
test_class.modifier: private
test_class.original_string: private ByteArrayOutputStream out;
test_class.type: ByteArrayOutputStream
test_class.var_name: out
test_class.declarator: metricsLogger
test_class.modifier: private
test_class.original_string: private Logger metricsLogger;
test_class.type: Logger
test_class.var_name: metricsLogger
test_class.declarator: corePlugin
test_class.modifier: private
test_class.original_string: private CorePlugin corePlugin;
test_class.type: CorePlugin
test_class.var_name: corePlugin
test_class.declarator: registry
test_class.modifier: private
test_class.original_string: private Metric2Registry registry;
test_class.type: Metric2Registry
test_class.var_name: registry
test_class.declarator: clock
test_class.modifier: private
test_class.original_string: private Clock clock;
test_class.type: Clock
test_class.var_name: clock
test_class.file: stagemonitor-core/src/test/java/org/stagemonitor/core/metrics/metrics2/ElasticsearchReporterTest.java
test_class.identifier: ElasticsearchReporterTest
test_case.body: @Test
  	public void testReportMeters() throws Exception {
  		elasticsearchReporter.reportMetrics(
  				metricNameMap(Gauge.class),
  				metricNameMap(Counter.class),
  				metricNameMap(Histogram.class),
  				metricNameMap(name("meter").build(), meter(10)),
  				metricNameMap(Timer.class));
  
  		assertEquals(map("@timestamp", timestamp, Object.class)
  						.add("name", "meter")
  						.add("app", "test")
  						.add("count", 10)
  						.add("m15_rate", 5.0)
  						.add("m1_rate", 3.0)
  						.add("m5_rate", 4.0)
  						.add("mean_rate", 2.0),
  				asMap(out));
  	}
test_case.class_method_signature: ElasticsearchReporterTest.testReportMeters()
test_case.full_signature: @Test public void testReportMeters()
test_case.identifier: testReportMeters
test_case.invocations: reportMetrics metricNameMap metricNameMap metricNameMap metricNameMap build name meter metricNameMap assertEquals add add add add add add add map asMap
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testReportMeters()
focal_class.declarator: STAGEMONITOR_METRICS_INDEX_PREFIX = "stagemonitor-metrics-"
focal_class.modifier: public static final
focal_class.original_string: public static final String STAGEMONITOR_METRICS_INDEX_PREFIX = "stagemonitor-metrics-";
focal_class.type: String
focal_class.var_name: STAGEMONITOR_METRICS_INDEX_PREFIX
focal_class.declarator: ES_METRICS_LOGGER = "ElasticsearchMetrics"
focal_class.modifier: public static final
focal_class.original_string: public static final String ES_METRICS_LOGGER = "ElasticsearchMetrics";
focal_class.type: String
focal_class.var_name: ES_METRICS_LOGGER
focal_class.declarator: METRICS_TYPE = "metrics"
focal_class.modifier: private static final
focal_class.original_string: private static final String METRICS_TYPE = "metrics";
focal_class.type: String
focal_class.var_name: METRICS_TYPE
focal_class.declarator: reportingTimeMetricName = name("reporting_time").tag("reporter", "elasticsearch").build()
focal_class.modifier: private static final
focal_class.original_string: private static final MetricName reportingTimeMetricName = name("reporting_time").tag("reporter", "elasticsearch").build();
focal_class.type: MetricName
focal_class.var_name: reportingTimeMetricName
focal_class.declarator: logger = LoggerFactory.getLogger(getClass())
focal_class.modifier: private final
focal_class.original_string: private final Logger logger = LoggerFactory.getLogger(getClass());
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: elasticsearchMetricsLogger
focal_class.modifier: private final
focal_class.original_string: private final Logger elasticsearchMetricsLogger;
focal_class.type: Logger
focal_class.var_name: elasticsearchMetricsLogger
focal_class.declarator: globalTags
focal_class.modifier: private final
focal_class.original_string: private final Map<String, String> globalTags;
focal_class.type: Map<String, String>
focal_class.var_name: globalTags
focal_class.declarator: corePlugin
focal_class.modifier: private final
focal_class.original_string: private final CorePlugin corePlugin;
focal_class.type: CorePlugin
focal_class.var_name: corePlugin
focal_class.declarator: httpClient
focal_class.modifier: private final
focal_class.original_string: private final HttpClient httpClient;
focal_class.type: HttpClient
focal_class.var_name: httpClient
focal_class.declarator: jfactory = new JsonFactory()
focal_class.modifier: private final
focal_class.original_string: private final JsonFactory jfactory = new JsonFactory();
focal_class.type: JsonFactory
focal_class.var_name: jfactory
focal_class.declarator: metric2RegistryModule
focal_class.modifier: private final
focal_class.original_string: private final Metric2RegistryModule metric2RegistryModule;
focal_class.type: Metric2RegistryModule
focal_class.var_name: metric2RegistryModule
focal_class.declarator: elasticsearchClient
focal_class.modifier: private final
focal_class.original_string: private final ElasticsearchClient elasticsearchClient;
focal_class.type: ElasticsearchClient
focal_class.var_name: elasticsearchClient
focal_class.file: stagemonitor-core/src/main/java/org/stagemonitor/core/metrics/metrics2/ElasticsearchReporter.java
focal_class.identifier: ElasticsearchReporter
focal_class.class_method_signature: ElasticsearchReporter.forRegistry(Metric2Registry registry, CorePlugin corePlugin)
focal_class.full_signature: public static ElasticsearchReporter.Builder forRegistry(Metric2Registry registry, CorePlugin corePlugin)
focal_class.identifier: forRegistry
focal_class.modifiers: public static
focal_class.parameters: (Metric2Registry registry, CorePlugin corePlugin)
focal_class.return: ElasticsearchReporter.Builder
focal_class.signature: ElasticsearchReporter.Builder forRegistry(Metric2Registry registry, CorePlugin corePlugin)
focal_class.class_method_signature: ElasticsearchReporter.ElasticsearchReporter(Builder builder)
focal_class.full_signature: private  ElasticsearchReporter(Builder builder)
focal_class.identifier: ElasticsearchReporter
focal_class.modifiers: private
focal_class.parameters: (Builder builder)
focal_class.signature:  ElasticsearchReporter(Builder builder)
focal_class.class_method_signature: ElasticsearchReporter.reportMetrics(final Map<MetricName, Gauge> gauges,
  							  final Map<MetricName, Counter> counters,
  							  final Map<MetricName, Histogram> histograms,
  							  final Map<MetricName, Meter> meters,
  							  final Map<MetricName, Timer> timers)
focal_class.full_signature: @Override public void reportMetrics(final Map<MetricName, Gauge> gauges,
  							  final Map<MetricName, Counter> counters,
  							  final Map<MetricName, Histogram> histograms,
  							  final Map<MetricName, Meter> meters,
  							  final Map<MetricName, Timer> timers)
focal_class.identifier: reportMetrics
focal_class.modifiers: @Override public
focal_class.parameters: (final Map<MetricName, Gauge> gauges,
  							  final Map<MetricName, Counter> counters,
  							  final Map<MetricName, Histogram> histograms,
  							  final Map<MetricName, Meter> meters,
  							  final Map<MetricName, Timer> timers)
focal_class.return: void
focal_class.signature: void reportMetrics(final Map<MetricName, Gauge> gauges,
  							  final Map<MetricName, Counter> counters,
  							  final Map<MetricName, Histogram> histograms,
  							  final Map<MetricName, Meter> meters,
  							  final Map<MetricName, Timer> timers)
focal_class.class_method_signature: ElasticsearchReporter.reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters,
  							  Map<MetricName, Histogram> histograms, final Map<MetricName, Meter> meters,
  							  Map<MetricName, Timer> timers, OutputStream os, byte[] bulkActionBytes, long timestamp)
focal_class.full_signature: public void reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters,
  							  Map<MetricName, Histogram> histograms, final Map<MetricName, Meter> meters,
  							  Map<MetricName, Timer> timers, OutputStream os, byte[] bulkActionBytes, long timestamp)
focal_class.identifier: reportMetrics
focal_class.modifiers: public
focal_class.parameters: (Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters,
  							  Map<MetricName, Histogram> histograms, final Map<MetricName, Meter> meters,
  							  Map<MetricName, Timer> timers, OutputStream os, byte[] bulkActionBytes, long timestamp)
focal_class.return: void
focal_class.signature: void reportMetrics(Map<MetricName, Gauge> gauges, Map<MetricName, Counter> counters,
  							  Map<MetricName, Histogram> histograms, final Map<MetricName, Meter> meters,
  							  Map<MetricName, Timer> timers, OutputStream os, byte[] bulkActionBytes, long timestamp)
focal_class.class_method_signature: ElasticsearchReporter.reportMetric(Map<MetricName, T> metrics, long timestamp, Metric2RegistryModule.ValueWriter<T> valueWriter,
  												 JsonGenerator jg, byte[] bulkActionBytes)
focal_class.full_signature: private void reportMetric(Map<MetricName, T> metrics, long timestamp, Metric2RegistryModule.ValueWriter<T> valueWriter,
  												 JsonGenerator jg, byte[] bulkActionBytes)
focal_class.identifier: reportMetric
focal_class.modifiers: private
focal_class.parameters: (Map<MetricName, T> metrics, long timestamp, Metric2RegistryModule.ValueWriter<T> valueWriter,
  												 JsonGenerator jg, byte[] bulkActionBytes)
focal_class.return: void
focal_class.signature: void reportMetric(Map<MetricName, T> metrics, long timestamp, Metric2RegistryModule.ValueWriter<T> valueWriter,
  												 JsonGenerator jg, byte[] bulkActionBytes)
focal_class.class_method_signature: ElasticsearchReporter.writeMap(JsonGenerator jg, Map<String, String> map)
focal_class.full_signature: private void writeMap(JsonGenerator jg, Map<String, String> map)
focal_class.identifier: writeMap
focal_class.modifiers: private
focal_class.parameters: (JsonGenerator jg, Map<String, String> map)
focal_class.return: void
focal_class.signature: void writeMap(JsonGenerator jg, Map<String, String> map)
focal_class.class_method_signature: ElasticsearchReporter.getTodaysIndexName()
focal_class.full_signature: public static String getTodaysIndexName()
focal_class.identifier: getTodaysIndexName
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getTodaysIndexName()
focal_class.superclass: extends ScheduledMetrics2Reporter
focal_method.body: @Override
  	public void reportMetrics(final Map<MetricName, Gauge> gauges,
  							  final Map<MetricName, Counter> counters,
  							  final Map<MetricName, Histogram> histograms,
  							  final Map<MetricName, Meter> meters,
  							  final Map<MetricName, Timer> timers) {
  
  		if (!corePlugin.isStagemonitorActive()) {
  			return;
  		}
  
  		long timestamp = clock.getTime();
  
  		final Timer.Context time = registry.timer(reportingTimeMetricName).time();
  		final MetricsOutputStreamHandler metricsOutputStreamHandler = new MetricsOutputStreamHandler(gauges, counters, histograms, meters, timers, timestamp);
  		if (!corePlugin.isOnlyLogElasticsearchMetricReports()) {
  			if (!elasticsearchClient.isElasticsearchAvailable()) {
  				return;
  			}
  			final String url = corePlugin.getElasticsearchUrl() + "/" + getTodaysIndexName() + "/" + METRICS_TYPE + "/_bulk";
  			httpClient.send("POST", url, CONTENT_TYPE_JSON,
  					metricsOutputStreamHandler, NoopResponseHandler.INSTANCE);
  		} else {
  			try {
  				final ByteArrayOutputStream os = new ByteArrayOutputStream();
  				metricsOutputStreamHandler.withHttpURLConnection(os);
  				elasticsearchMetricsLogger.info(os.toString("UTF-8"));
  			} catch (IOException e) {
  				logger.warn(e.getMessage(), e);
  			}
  		}
  		time.stop();
  	}
focal_method.class_method_signature: ElasticsearchReporter.reportMetrics(final Map<MetricName, Gauge> gauges,
  							  final Map<MetricName, Counter> counters,
  							  final Map<MetricName, Histogram> histograms,
  							  final Map<MetricName, Meter> meters,
  							  final Map<MetricName, Timer> timers)
focal_method.full_signature: @Override public void reportMetrics(final Map<MetricName, Gauge> gauges,
  							  final Map<MetricName, Counter> counters,
  							  final Map<MetricName, Histogram> histograms,
  							  final Map<MetricName, Meter> meters,
  							  final Map<MetricName, Timer> timers)
focal_method.identifier: reportMetrics
focal_method.invocations: isStagemonitorActive getTime time timer isOnlyLogElasticsearchMetricReports isElasticsearchAvailable getElasticsearchUrl getTodaysIndexName send withHttpURLConnection info toString warn getMessage stop
focal_method.modifiers: @Override public
focal_method.parameters: (final Map<MetricName, Gauge> gauges,
  							  final Map<MetricName, Counter> counters,
  							  final Map<MetricName, Histogram> histograms,
  							  final Map<MetricName, Meter> meters,
  							  final Map<MetricName, Timer> timers)
focal_method.return: void
focal_method.signature: void reportMetrics(final Map<MetricName, Gauge> gauges,
  							  final Map<MetricName, Counter> counters,
  							  final Map<MetricName, Histogram> histograms,
  							  final Map<MetricName, Meter> meters,
  							  final Map<MetricName, Timer> timers)