Map<String, String> attributes = (Map<String, String>) categories.get(category);
String valueMetrics = attributes.get("value_metrics");
if (valueMetrics != null) {
Set<String> metrics = new HashSet<String>(Arrays.asList(valueMetrics.toLowerCase().replaceAll(SPACE, EMPTY_STRING).split(COMMA)));
for (String s : metrics) {
addMetricMeta(category + SEPARATOR + s, new MetricMeta(false));
}
}
String counterMetrics = attributes.get("counter_metrics");
if (counterMetrics != null) {
Set<String> metrics = new HashSet<String>(Arrays.asList(counterMetrics.toLowerCase().replaceAll(SPACE, EMPTY_STRING).split(COMMA)));
for (String s : metrics) {
addMetricMeta(category + SEPARATOR + s, new MetricMeta(true));
}
}
}
/* Define New Relic specific metrics used for default dashboards */
addMetricMeta("newrelic/volume_reads", new MetricMeta(true, "Queries/Second"));
addMetricMeta("newrelic/volume_writes", new MetricMeta(true, "Queries/Second"));
addMetricMeta("newrelic/bytes_reads", new MetricMeta(true, "Bytes/Second"));
addMetricMeta("newrelic/bytes_writes", new MetricMeta(true, "Bytes/Second"));
addMetricMeta("newrelic/connections_connected", new MetricMeta(false, "Connections"));
addMetricMeta("newrelic/connections_running", new MetricMeta(false, "Connections"));
addMetricMeta("newrelic/connections_cached", new MetricMeta(false, "Connections"));
addMetricMeta("newrelic/innodb_bp_pages_created", new MetricMeta(true, "Pages/Second"));
addMetricMeta("newrelic/innodb_bp_pages_read", new MetricMeta(true, "Pages/Second"));
addMetricMeta("newrelic/innodb_bp_pages_written", new MetricMeta(true, "Pages/Second"));
addMetricMeta("newrelic/query_cache_hits", new MetricMeta(true, "Queries/Seconds"));
addMetricMeta("newrelic/query_cache_misses", new MetricMeta(true, "Queries/Seconds"));
addMetricMeta("newrelic/query_cache_not_cached", new MetricMeta(true, "Queries/Seconds"));
addMetricMeta("newrelic/replication_lag", new MetricMeta(false, "Seconds"));
addMetricMeta("newrelic/replication_status", new MetricMeta(false, "State"));
addMetricMeta("newrelic/pct_connection_utilization", new MetricMeta(false, "Percent"));
addMetricMeta("newrelic/pct_innodb_buffer_pool_hit_ratio", new MetricMeta(false, "Percent"));
addMetricMeta("newrelic/pct_query_cache_hit_utilization", new MetricMeta(false, "Percent"));
addMetricMeta("newrelic/pct_query_cache_memory_in_use", new MetricMeta(false, "Percent"));
addMetricMeta("newrelic/pct_tmp_tables_written_to_disk", new MetricMeta(false, "Percent"));
addMetricMeta("newrelic/innodb_fsyncs_data", new MetricMeta(true, "Fsyncs/Second"));
addMetricMeta("newrelic/innodb_fsyncs_os_log", new MetricMeta(true, "Fsyncs/Second"));
addMetricMeta("newrelic/slave_relay_log_bytes", new MetricMeta(true, "Bytes/Second"));
addMetricMeta("newrelic/master_log_lag_bytes", new MetricMeta(true, "Bytes/Second"));
/* Define improved metric values for certain general metrics */
addMetricMeta("status/aborted_clients", new MetricMeta(true, "Connections/Second"));
addMetricMeta("status/aborted_connects", new MetricMeta(true, "Connections/Second"));
addMetricMeta("status/bytes_sent", new MetricMeta(true, "Bytes/Second"));
addMetricMeta("status/bytes_received", new MetricMeta(true, "Bytes/Second"));
addMetricMeta("status/com_select", new MetricMeta(true, "Selects/Second"));
addMetricMeta("status/com_insert", new MetricMeta(true, "Inserts/Second"));
addMetricMeta("status/com_insert_select", new MetricMeta(true, "Inserts/Second"));
addMetricMeta("status/com_update", new MetricMeta(true, "Updates/Second"));
addMetricMeta("status/com_update_multi", new MetricMeta(true, "Updates/Second"));
addMetricMeta("status/com_delete", new MetricMeta(true, "Deletes/Second"));
addMetricMeta("status/com_delete_multi", new MetricMeta(true, "Deletes/Second"));
addMetricMeta("status/com_replace", new MetricMeta(true, "Replaces/Second"));
addMetricMeta("status/com_replace_select", new MetricMeta(true, "Replaces/Second"));
addMetricMeta("status/slow_queries", new MetricMeta(true, "Queries/Second"));
addMetricMeta("status/created_tmp_tables", new MetricMeta(true, "Queries/Second"));
addMetricMeta("status/created_tmp_disk_tables", new MetricMeta(true, "Queries/Second"));
addMetricMeta("status/innodb_buffer_pool_pages_flushed", new MetricMeta(true, "Pages/Second"));
addMetricMeta("newrelic/innodb_buffer_pool_pages_clean", new MetricMeta(false, "Pages"));
addMetricMeta("newrelic/innodb_buffer_pool_pages_dirty", new MetricMeta(false, "Pages"));
addMetricMeta("newrelic/innodb_buffer_pool_pages_misc", new MetricMeta(false, "Pages"));
addMetricMeta("newrelic/innodb_buffer_pool_pages_free", new MetricMeta(false, "Pages"));
addMetricMeta("newrelic/innodb_buffer_pool_pages_unassigned", new MetricMeta(false, "Pages"));
addMetricMeta("status/innodb_data_fsyncs", new MetricMeta(true, "Fsyncs/Second"));
addMetricMeta("status/innodb_os_log_fsyncs", new MetricMeta(true, "Fsyncs/Second"));
addMetricMeta("status/innodb_os_log_written", new MetricMeta(true, "Bytes/Second"));
/* Query Cache Units */
addMetricMeta("status/qcache_free_blocks", new MetricMeta(false, "Blocks"));
addMetricMeta("status/qcache_free_memory", new MetricMeta(false, "Bytes"));
addMetricMeta("status/qcache_hits", new MetricMeta(true, "Queries/Second"));
addMetricMeta("status/qcache_inserts", new MetricMeta(true, "Queries/Second"));
addMetricMeta("status/qcache_lowmem_prunes", new MetricMeta(true, "Queries/Second"));
addMetricMeta("status/qcache_not_cached", new MetricMeta(true, "Queries/Second"));
addMetricMeta("status/qcache_queries_in_cache", new MetricMeta(false, "Queries"));
addMetricMeta("status/qcache_total_blocks", new MetricMeta(false, "Blocks"));
addMetricMeta("innodb_status/history_list_length", new MetricMeta(false, "Pages"));
addMetricMeta("innodb_status/queries_inside_innodb", new MetricMeta(false, "Queries"));
addMetricMeta("innodb_status/queries_in_queue", new MetricMeta(false, "Queries"));
addMetricMeta("innodb_status/checkpoint_age", new MetricMeta(false, "Bytes"));
addMetricMeta("master/position", new MetricMeta(true, "Bytes/Second"));
addMetricMeta("slave/relay_log_pos", new MetricMeta(true, "Bytes/Second"));
}