diff --git a/grafana.json b/grafana.json new file mode 100644 index 00000000..9d83f569 --- /dev/null +++ b/grafana.json @@ -0,0 +1,3849 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 29, + "iteration": 1622894339083, + "links": [], + "panels": [ + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 55, + "panels": [], + "title": "Overall progress", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 1 + }, + "hiddenSeries": false, + "id": 40, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_osm_pass1_osm_elements_processed", + "interval": "", + "legendFormat": "pass1 {{type}}", + "refId": "A" + }, + { + "expr": "flatmap_osm_pass2_osm_elements_processed", + "interval": "", + "legendFormat": "pass2 {{type}}", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "OSM element progress", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 8, + "x": 8, + "y": 1 + }, + "hiddenSeries": false, + "id": 39, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_osm_pass2_osm_elements_processed\n/\nflatmap_osm_pass1_osm_elements_processed", + "interval": "", + "legendFormat": "{{type}}", + "refId": "A" + }, + { + "expr": "flatmap_mbtiles_features_processed", + "interval": "", + "legendFormat": "mbtiles features", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "% Progress", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": "1", + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 8, + "x": 16, + "y": 1 + }, + "hiddenSeries": false, + "id": 25, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(flatmap_osm_pass1_osm_elements_processed[$interval])", + "interval": "", + "legendFormat": "pass1 {{type}}", + "refId": "A" + }, + { + "expr": "rate(flatmap_osm_pass2_osm_elements_processed[$interval])", + "interval": "", + "legendFormat": "pass2 {{type}}", + "refId": "B" + }, + { + "expr": "rate(flatmap_mbtiles_features_processed[$interval])", + "interval": "", + "legendFormat": "mbtiles features processed", + "refId": "C" + }, + { + "expr": "sum(rate(flatmap_osm_pass2_features_emitted[$interval])) by (layer)", + "interval": "", + "legendFormat": "pass2 emitted {{layer}} feature", + "refId": "D" + }, + { + "expr": "sum(rate(flatmap_mbtiles_tiles_written_count[$interval])) by (zoom)", + "interval": "", + "legendFormat": "z{{zoom}} tiles written", + "refId": "E" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "What's happening/s", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 10, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 6, + "x": 0, + "y": 7 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(process_cpu_seconds_total{exported_job=\"flatmap\"}[$interval])", + "interval": "", + "legendFormat": "total", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "CPU usage", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 6, + "x": 6, + "y": 7 + }, + "hiddenSeries": false, + "id": 4, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": false, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(jvm_thread_cpu_time_seconds_total[$interval])) by (name)", + "interval": "", + "legendFormat": "{{name}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Thread CPU utilization", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 6, + "x": 12, + "y": 7 + }, + "hiddenSeries": false, + "id": 41, + "legend": { + "alignAsTable": true, + "avg": false, + "current": true, + "max": false, + "min": false, + "rightSide": true, + "show": false, + "sort": "current", + "sortDesc": true, + "total": false, + "values": true + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(jvm_gc_collection_seconds_sum{exported_job=\"flatmap\"}[$interval]))", + "interval": "", + "legendFormat": "{{name}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "GC", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 6, + "x": 18, + "y": 7 + }, + "hiddenSeries": false, + "id": 26, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_file_mbtiles_size_bytes", + "interval": "", + "legendFormat": "mbtiles", + "refId": "B" + }, + { + "expr": "flatmap_file_nodes_size_bytes", + "interval": "", + "legendFormat": "features", + "refId": "A" + }, + { + "expr": "flatmap_file_features_size_bytes", + "interval": "", + "legendFormat": "nodes", + "refId": "C" + }, + { + "expr": "flatmap_file_features_usable_space_bytes", + "interval": "", + "legendFormat": "free space", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "File sizes", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "decbytes", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 12 + }, + "id": 59, + "panels": [], + "title": "pass1", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 12, + "x": 0, + "y": 13 + }, + "hiddenSeries": false, + "id": 61, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "(sum(rate(flatmap_osm_pass1_reader_queue_enqueue_block_time_seconds[$interval]))\n/\ncount(jvm_thread_cpu_time_seconds_total{name=~\"^osm_pass1_pbf.*$\"})) * sum(flatmap_osm_pass1_running) > 0", + "interval": "", + "legendFormat": "blocked enqueueing", + "refId": "B" + }, + { + "expr": "avg(rate(jvm_thread_cpu_time_seconds_total{name=~\"^pbfpass1.*$\"}[$interval])) * sum(flatmap_osm_pass1_running) > 0", + "interval": "", + "legendFormat": "PBF reader", + "refId": "C" + }, + { + "expr": "avg(rate(jvm_thread_cpu_time_seconds_total{name=~\"^osm_pass1_pbf.*$\"}[$interval]))* sum(flatmap_osm_pass1_running) > 0", + "interval": "", + "legendFormat": "PBF parsers", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass1 PBF reader", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 12, + "x": 12, + "y": 13 + }, + "hiddenSeries": false, + "id": 62, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flatmap_osm_pass1_reader_queue_dequeue_block_time_seconds[$interval]))\n* sum(flatmap_osm_pass1_running) > 0", + "interval": "", + "legendFormat": "blocked dequeueing", + "refId": "B" + }, + { + "expr": "avg(rate(jvm_thread_cpu_time_seconds_total{name=~\"^osm_pass1_process.*$\"}[$interval])) * sum(flatmap_osm_pass1_running) > 0", + "interval": "", + "legendFormat": "process CPU", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass1 processor", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 18 + }, + "hiddenSeries": false, + "id": 63, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(flatmap_osm_pass1_reader_queue_enqueue_count)", + "interval": "", + "legendFormat": "emitted", + "refId": "A" + }, + { + "expr": "sum(flatmap_osm_pass1_reader_queue_enqueue_count)", + "interval": "", + "legendFormat": "processed", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass1 reader queue", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 18 + }, + "hiddenSeries": false, + "id": 64, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flatmap_osm_pass1_reader_queue_enqueue_count[$interval]))", + "interval": "", + "legendFormat": "emitted", + "refId": "A" + }, + { + "expr": "sum(rate(flatmap_osm_pass1_reader_queue_enqueue_count[$interval]))", + "interval": "", + "legendFormat": "processed", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass1 reader queue/sec", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 18 + }, + "hiddenSeries": false, + "id": 65, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_osm_pass1_reader_queue_capacity", + "interval": "", + "legendFormat": "capacity", + "refId": "A" + }, + { + "expr": "flatmap_osm_pass1_reader_queue_size", + "interval": "", + "legendFormat": "size", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass1 reader queue size", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 18, + "y": 18 + }, + "hiddenSeries": false, + "id": 66, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_osm_pass1_reader_queue_enqueue_block_time_seconds", + "interval": "", + "legendFormat": "enqueue", + "refId": "A" + }, + { + "expr": "flatmap_osm_pass1_reader_queue_dequeue_block_time_seconds", + "interval": "", + "legendFormat": "dequeue", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "reader queue block time", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 22 + }, + "id": 53, + "panels": [], + "title": "pass2", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 8, + "x": 0, + "y": 23 + }, + "hiddenSeries": false, + "id": 47, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "(sum(rate(flatmap_osm_pass2_reader_queue_enqueue_block_time_seconds[$interval]))\n/\ncount(jvm_thread_cpu_time_seconds_total{name=~\"^osm_pass2_pbf.*$\"}))\n* sum(flatmap_osm_pass2_running) > 0", + "interval": "", + "legendFormat": "blocked enqueueing", + "refId": "B" + }, + { + "expr": "avg(rate(jvm_thread_cpu_time_seconds_total{name=~\"^pbfpass2.*$\"}[$interval])) * sum(flatmap_osm_pass2_running) > 0", + "interval": "", + "legendFormat": "PBF reader", + "refId": "C" + }, + { + "expr": "avg(rate(jvm_thread_cpu_time_seconds_total{name=~\"^osm_pass2_pbf.*$\"}[$interval])) * \nsum(flatmap_osm_pass2_running) > 0", + "interval": "", + "legendFormat": "PBF parsers", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass2 PBF reader", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 8, + "x": 8, + "y": 23 + }, + "hiddenSeries": false, + "id": 48, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flatmap_osm_pass2_reader_queue_dequeue_block_time_seconds[$interval])\n/\nflatmap_osm_pass2_process_threads) * (sum(flatmap_osm_pass2_running) > 0)", + "interval": "", + "legendFormat": "blocked dequeueing", + "refId": "A" + }, + { + "expr": "sum(rate(flatmap_osm_pass2_feature_queue_enqueue_block_time_seconds[$interval])\n/\nflatmap_osm_pass2_process_threads) * (sum(flatmap_osm_pass2_running) > 0)", + "interval": "", + "legendFormat": "blocked enqueueing", + "refId": "B" + }, + { + "expr": "sum(avg(rate(jvm_thread_cpu_time_seconds_total{name=~\"^osm_pass2_process.*$\"}[$interval]))) * (sum(flatmap_osm_pass2_running) > 0)", + "interval": "", + "legendFormat": "cpu", + "refId": "C" + }, + { + "expr": "sum(avg(rate(jvm_thread_user_time_seconds_total{name=~\"^osm_pass2_process.*$\"}[$interval]))) * (sum(flatmap_osm_pass2_running) > 0)", + "interval": "", + "legendFormat": "user time", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass2 element processor", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 8, + "x": 16, + "y": 23 + }, + "hiddenSeries": false, + "id": 49, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flatmap_osm_pass2_feature_queue_dequeue_block_time_seconds[$interval])\n/\nflatmap_osm_pass2_write_threads) * (sum(flatmap_osm_pass2_running) > 0)", + "interval": "", + "legendFormat": "blocked dequeueing", + "refId": "A" + }, + { + "expr": "avg(rate(jvm_thread_cpu_time_seconds_total{name=~\"^osm_pass2_write.*$\"}[$interval])) * (sum(flatmap_osm_pass2_running) > 0)", + "interval": "", + "legendFormat": "cpu", + "refId": "C" + }, + { + "expr": "avg(rate(jvm_thread_user_time_seconds_total{name=~\"^osm_pass2_write.*$\"}[$interval])) * (sum(flatmap_osm_pass2_running) > 0)", + "interval": "", + "legendFormat": "user time", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass2 writer", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 27 + }, + "hiddenSeries": false, + "id": 67, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(flatmap_osm_pass2_reader_queue_enqueue_count)", + "interval": "", + "legendFormat": "emitted", + "refId": "A" + }, + { + "expr": "sum(flatmap_osm_pass2_reader_queue_dequeue_count)", + "interval": "", + "legendFormat": "processed", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass2 reader queue", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 27 + }, + "hiddenSeries": false, + "id": 68, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flatmap_osm_pass2_reader_queue_enqueue_count[$interval]))", + "interval": "", + "legendFormat": "emitted", + "refId": "A" + }, + { + "expr": "sum(rate(flatmap_osm_pass2_reader_queue_dequeue_count[$interval]))", + "interval": "", + "legendFormat": "processed", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass2 reader features/sec", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 27 + }, + "hiddenSeries": false, + "id": 69, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_osm_pass2_reader_queue_capacity", + "interval": "", + "legendFormat": "capacity", + "refId": "A" + }, + { + "expr": "flatmap_osm_pass2_reader_queue_size", + "interval": "", + "legendFormat": "size", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass2 reader queue size", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 18, + "y": 27 + }, + "hiddenSeries": false, + "id": 34, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_osm_pass2_reader_queue_enqueue_block_time_seconds", + "interval": "", + "legendFormat": "enqueue", + "refId": "A" + }, + { + "expr": "flatmap_osm_pass2_reader_queue_dequeue_block_time_seconds", + "interval": "", + "legendFormat": "dequeue", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "reader queue block time", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 31 + }, + "hiddenSeries": false, + "id": 30, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(flatmap_osm_pass2_feature_queue_enqueue_count)", + "interval": "", + "legendFormat": "emitted", + "refId": "A" + }, + { + "expr": "sum(flatmap_osm_pass2_feature_queue_dequeue_count)", + "interval": "", + "legendFormat": "processed", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass2 writer queue count", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 31 + }, + "hiddenSeries": false, + "id": 31, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flatmap_osm_pass2_feature_queue_enqueue_count[$interval]))", + "interval": "", + "legendFormat": "emitted", + "refId": "A" + }, + { + "expr": "sum(rate(flatmap_osm_pass2_feature_queue_dequeue_count[$interval]))", + "interval": "", + "legendFormat": "processed", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass2 writer queue/sec", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 31 + }, + "hiddenSeries": false, + "id": 33, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_osm_pass2_feature_queue_capacity", + "interval": "", + "legendFormat": "capacity", + "refId": "A" + }, + { + "expr": "flatmap_osm_pass2_feature_queue_size", + "interval": "", + "legendFormat": "size", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "pass2 writer queue size", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 18, + "y": 31 + }, + "hiddenSeries": false, + "id": 70, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_osm_pass2_feature_queue_enqueue_block_time_seconds", + "interval": "", + "legendFormat": "enqueue", + "refId": "A" + }, + { + "expr": "flatmap_osm_pass2_feature_queue_dequeue_block_time_seconds", + "interval": "", + "legendFormat": "dequeue", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "writer queue block time", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 35 + }, + "id": 57, + "panels": [], + "title": "mbtiles writer pass", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 12, + "x": 0, + "y": 36 + }, + "hiddenSeries": false, + "id": 50, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(flatmap_mbtiles_writer_queue_enqueue_block_time_seconds[$interval])\n/\nflatmap_mbtiles_encoder_threads", + "interval": "", + "legendFormat": "blocked enqueueing", + "refId": "B" + }, + { + "expr": "avg(rate(jvm_thread_cpu_time_seconds_total{name=~\"^mbtiles_encoder.*$\"}[$interval]))", + "interval": "", + "legendFormat": "cpu", + "refId": "C" + }, + { + "expr": "avg(rate(jvm_thread_user_time_seconds_total{name=~\"^mbtiles_encoder.*$\"}[$interval]))", + "interval": "", + "legendFormat": "user time", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "mbtiles encoder", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 12, + "x": 12, + "y": 36 + }, + "hiddenSeries": false, + "id": 51, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(flatmap_mbtiles_writer_queue_dequeue_block_time_seconds[$interval])\n/\nflatmap_mbtiles_writer_threads", + "interval": "", + "legendFormat": "blocked dequeueing", + "refId": "B" + }, + { + "expr": "avg(rate(jvm_thread_cpu_time_seconds_total{name=~\"^mbtiles_writer.*$\"}[$interval]))", + "interval": "", + "legendFormat": "cpu", + "refId": "C" + }, + { + "expr": "avg(rate(jvm_thread_user_time_seconds_total{name=~\"^mbtiles_writer.*$\"}[$interval]))", + "interval": "", + "legendFormat": "user time", + "refId": "D" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "mbtiles writer", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "percentunit", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 0, + "y": 40 + }, + "hiddenSeries": false, + "id": 42, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(flatmap_mbtiles_reader_queue_enqueue_count)", + "interval": "", + "legendFormat": "emitted", + "refId": "A" + }, + { + "expr": "sum(flatmap_mbtiles_reader_queue_dequeue_count)", + "interval": "", + "legendFormat": "processed", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "mbtiles features", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 6, + "y": 40 + }, + "hiddenSeries": false, + "id": 43, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(flatmap_mbtiles_reader_queue_enqueue_count[$interval]))", + "interval": "", + "legendFormat": "emitted", + "refId": "A" + }, + { + "expr": "sum(rate(flatmap_mbtiles_reader_queue_dequeue_count[$interval]))", + "interval": "", + "legendFormat": "processed", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "mbtiles features/sec", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 40 + }, + "hiddenSeries": false, + "id": 44, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_mbtiles_reader_queue_capacity", + "interval": "", + "legendFormat": "capacity", + "refId": "A" + }, + { + "expr": "flatmap_mbtiles_reader_queue_size", + "interval": "", + "legendFormat": "size", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "mbtiles queue size", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 18, + "y": 40 + }, + "hiddenSeries": false, + "id": 46, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "flatmap_mbtiles_reader_queue_enqueue_block_time_seconds", + "interval": "", + "legendFormat": "enqueue", + "refId": "A" + }, + { + "expr": "flatmap_mbtiles_reader_queue_dequeue_block_time_seconds", + "interval": "", + "legendFormat": "dequeue", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "mbtiles queue block time", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "s", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 44 + }, + "id": 14, + "panels": [], + "title": "Memory", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 6, + "x": 0, + "y": 45 + }, + "hiddenSeries": false, + "id": 8, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "virtual", + "fill": 0 + }, + { + "alias": "{{area}}", + "fill": 0 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_memory_bytes_used{exported_job=\"flatmap\"}", + "format": "time_series", + "interval": "30s", + "intervalFactor": 1, + "legendFormat": "{{area}}", + "override": { + "fill": 0 + }, + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "memory", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "decbytes", + "min": 0, + "show": true + }, + { + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 6, + "x": 6, + "y": 45 + }, + "hiddenSeries": false, + "id": 10, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + { + "alias": "{{pool}}", + "fill": 0 + }, + { + "alias": "{{pool}} buffer pool", + "fill": 0 + } + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_memory_pool_bytes_used{exported_job=\"flatmap\"}", + "format": "time_series", + "interval": "30s", + "intervalFactor": 1, + "legendFormat": "{{pool}}", + "override": { + "fill": 0 + }, + "refId": "A" + }, + { + "expr": "jvm_buffer_pool_used_bytes{exported_job=\"flatmap\"}", + "format": "time_series", + "interval": "30s", + "intervalFactor": 1, + "legendFormat": "{{pool}} buffer pool", + "override": { + "fill": 0 + }, + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "memory pools", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "min": 0, + "show": true + }, + { + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 6, + "x": 12, + "y": 45 + }, + "hiddenSeries": false, + "id": 6, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "sum(rate(jvm_gc_collection_seconds_sum{exported_job=\"flatmap\"}[$interval])) by (instance_alias, job)", + "format": "time_series", + "interval": "30s", + "intervalFactor": 1, + "legendFormat": "{{instance_alias}} {{job}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "% time in GC", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "percentunit", + "min": 0, + "show": true + }, + { + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 6, + "x": 18, + "y": 45 + }, + "hiddenSeries": false, + "id": 20, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(jvm_gc_collection_seconds_count{exported_job=\"flatmap\"}[$interval])", + "format": "time_series", + "interval": "30s", + "intervalFactor": 1, + "legendFormat": "{{gc}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "gc count per $interval", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "min": 0, + "show": true + }, + { + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 50 + }, + "id": 18, + "title": "Misc", + "type": "row" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 6, + "x": 0, + "y": 51 + }, + "hiddenSeries": false, + "id": 16, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "process_open_fds{exported_job=\"flatmap\"}", + "format": "time_series", + "interval": "30s", + "intervalFactor": 1, + "legendFormat": "{{instance_alias}} {{job}}", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "open fds", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "min": 0, + "show": true + }, + { + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 6, + "x": 6, + "y": 51 + }, + "hiddenSeries": false, + "id": 12, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "7.3.1", + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "jvm_threads_current{exported_job=\"flatmap\"}", + "format": "time_series", + "interval": "30s", + "intervalFactor": 1, + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "threads", + "tooltip": { + "shared": true, + "sort": 2, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "min": 0, + "show": true + }, + { + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "refresh": "10s", + "schemaVersion": 26, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "allValue": null, + "current": { + "selected": false, + "text": "30s", + "value": "30s" + }, + "error": null, + "hide": 0, + "includeAll": false, + "label": "interval", + "multi": false, + "name": "interval", + "options": [ + { + "selected": true, + "text": "30s", + "value": "30s" + }, + { + "selected": false, + "text": "1m", + "value": "1m" + }, + { + "selected": false, + "text": "3m", + "value": "3m" + }, + { + "selected": false, + "text": "5m", + "value": "5m" + }, + { + "selected": false, + "text": "10m", + "value": "10m" + }, + { + "selected": false, + "text": "15m", + "value": "15m" + }, + { + "selected": false, + "text": "30m", + "value": "30m" + }, + { + "selected": false, + "text": "1h", + "value": "1h" + } + ], + "query": "30s,1m,3m,5m,10m,15m,30m,1h", + "queryValue": "", + "skipUrlSync": false, + "type": "custom" + } + ] + }, + "time": { + "from": "now-30m", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "flatmap", + "uid": "scLmtpaMz", + "version": 53 +} diff --git a/pom.xml b/pom.xml index 91bf49ff..d2b08ef1 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,7 @@ 5.7.1 2.12.3 2.14.1 + 0.11.0 @@ -111,6 +112,26 @@ jackson-datatype-jdk8 ${jackson.version} + + io.prometheus + simpleclient + ${prometheus.version} + + + io.prometheus + simpleclient_common + ${prometheus.version} + + + io.prometheus + simpleclient_pushgateway + ${prometheus.version} + + + io.prometheus + simpleclient_hotspot + ${prometheus.version} + org.junit.jupiter diff --git a/src/main/java/com/onthegomap/flatmap/Arguments.java b/src/main/java/com/onthegomap/flatmap/Arguments.java index 43bcb879..adadb483 100644 --- a/src/main/java/com/onthegomap/flatmap/Arguments.java +++ b/src/main/java/com/onthegomap/flatmap/Arguments.java @@ -1,6 +1,7 @@ package com.onthegomap.flatmap; import com.onthegomap.flatmap.geo.GeoUtils; +import com.onthegomap.flatmap.monitoring.PrometheusStats; import com.onthegomap.flatmap.monitoring.Stats; import java.nio.file.Files; import java.nio.file.Path; @@ -118,7 +119,16 @@ public class Arguments { } public Stats getStats() { - return new Stats.InMemory(); + String prometheus = getArg("pushgateway"); + if (prometheus != null && !prometheus.isBlank()) { + LOGGER.info("Using prometheus push gateway stats"); + String job = get("pushgateway.job", "prometheus pushgateway job ID", "flatmap"); + Duration interval = duration("pushgateway.interval", "how often to send stats to prometheus push gateway", "15s"); + return new PrometheusStats(prometheus, job, interval); + } else { + LOGGER.info("Using in-memory stats"); + return new Stats.InMemory(); + } } public int integer(String key, String description, int defaultValue) { diff --git a/src/main/java/com/onthegomap/flatmap/MemoryEstimator.java b/src/main/java/com/onthegomap/flatmap/MemoryEstimator.java index 9f535ff4..17314df2 100644 --- a/src/main/java/com/onthegomap/flatmap/MemoryEstimator.java +++ b/src/main/java/com/onthegomap/flatmap/MemoryEstimator.java @@ -9,30 +9,30 @@ import com.carrotsearch.hppc.LongObjectHashMap; public class MemoryEstimator { public static long size(HasEstimate object) { - return object.estimateMemoryUsageBytes(); + return object == null ? 0 : object.estimateMemoryUsageBytes(); } public static long size(LongHashSet object) { - return 24L + 8L * object.keys.length; + return object == null ? 0 : 24L + 8L * object.keys.length; } public static long size(LongLongHashMap object) { - return 24L + 8L * object.keys.length + - 24L + 8L * object.values.length; + return object == null ? 0 : (24L + 8L * object.keys.length + + 24L + 8L * object.values.length); } public static long sizeWithoutValues(LongObjectHashMap object) { - return 24L + 8L * object.keys.length + - 24L + 8L * object.values.length; + return object == null ? 0 : (24L + 8L * object.keys.length + + 24L + 8L * object.values.length); } public static long size(LongIntHashMap object) { - return 24L + 8L * object.keys.length + - 24L + 4L * object.values.length; + return object == null ? 0 : (24L + 8L * object.keys.length + + 24L + 4L * object.values.length); } public static long size(LongArrayList object) { - return 24L + 8L * object.buffer.length; + return object == null ? 0 : (24L + 8L * object.buffer.length); } public interface HasEstimate { diff --git a/src/main/java/com/onthegomap/flatmap/OpenMapTilesMain.java b/src/main/java/com/onthegomap/flatmap/OpenMapTilesMain.java index c6c86a90..2069e693 100644 --- a/src/main/java/com/onthegomap/flatmap/OpenMapTilesMain.java +++ b/src/main/java/com/onthegomap/flatmap/OpenMapTilesMain.java @@ -9,7 +9,6 @@ import com.onthegomap.flatmap.read.OpenStreetMapReader; import com.onthegomap.flatmap.read.OsmInputFile; import com.onthegomap.flatmap.read.ShapefileReader; import com.onthegomap.flatmap.write.MbtilesWriter; -import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; @@ -20,7 +19,7 @@ public class OpenMapTilesMain { private static final Logger LOGGER = LoggerFactory.getLogger(OpenMapTilesMain.class); - public static void main(String[] args) throws IOException { + public static void main(String[] args) throws Exception { Arguments arguments = Arguments.fromJvmProperties(); var stats = arguments.getStats(); var overallTimer = stats.startTimer("openmaptiles"); @@ -39,18 +38,18 @@ public class OpenMapTilesMain { boolean useWikidata = arguments.get("use_wikidata", "use wikidata translations", true); Path wikidataNamesFile = arguments.file("wikidata_cache", "wikidata cache file", Path.of("data", "sources", "wikidata_names.json")); - Path output = arguments.file("output", "mbtiles output file", Path.of("data", "massachusetts.mbtiles")); + Path mbtilesOutputPath = arguments.file("output", "mbtiles output file", Path.of("data", "massachusetts.mbtiles")); List languages = arguments.get("name_languages", "languages to use", "en,ru,ar,zh,ja,ko,fr,de,fi,pl,es,be,br,he".split(",")); CommonParams config = CommonParams.from(arguments, osmInputFile); if (config.forceOverwrite()) { - FileUtils.deleteFile(output); - } else if (Files.exists(output)) { - throw new IllegalArgumentException(output + " already exists, use force to overwrite."); + FileUtils.deleteFile(mbtilesOutputPath); + } else if (Files.exists(mbtilesOutputPath)) { + throw new IllegalArgumentException(mbtilesOutputPath + " already exists, use force to overwrite."); } - LOGGER.info("Building OpenMapTiles profile into " + output + " in these phases:"); + LOGGER.info("Building OpenMapTiles profile into " + mbtilesOutputPath + " in these phases:"); if (fetchWikidata) { LOGGER.info(" [wikidata] Fetch OpenStreetMap element name translations from wikidata"); } @@ -60,16 +59,20 @@ public class OpenMapTilesMain { LOGGER.info(" [osm_pass1] Pre-process OpenStreetMap input (store node locations then relation members)"); LOGGER.info(" [osm_pass2] Process OpenStreetMap nodes, ways, then relations"); LOGGER.info(" [sort] Sort rendered features by tile ID"); - LOGGER.info(" [mbtiles] Encode each tile and write to " + output); + LOGGER.info(" [mbtiles] Encode each tile and write to " + mbtilesOutputPath); var translations = Translations.defaultProvider(languages); var profile = new OpenMapTilesProfile(); Files.createDirectories(tmpDir); - Path nodeDb = tmpDir.resolve("node.db"); - LongLongMap nodeLocations = LongLongMap.newFileBackedSortedTable(nodeDb); + Path nodeDbPath = tmpDir.resolve("node.db"); + LongLongMap nodeLocations = LongLongMap.newFileBackedSortedTable(nodeDbPath); + Path featureDbPath = tmpDir.resolve("feature.db"); FeatureSort featureDb = FeatureSort.newExternalMergeSort(tmpDir.resolve("feature.db"), config.threads(), stats); FeatureGroup featureMap = new FeatureGroup(featureDb, profile, stats); + stats.monitorFile("nodes", nodeDbPath); + stats.monitorFile("features", featureDbPath); + stats.monitorFile("mbtiles", mbtilesOutputPath); if (fetchWikidata) { stats.time("wikidata", () -> Wikidata.fetch(osmInputFile, wikidataNamesFile, config, profile, stats)); @@ -99,16 +102,18 @@ public class OpenMapTilesMain { LOGGER.info("Deleting node.db to make room for mbtiles"); profile.release(); - Files.delete(nodeDb); + Files.delete(nodeDbPath); stats.time("sort", featureDb::sort); - stats.time("mbtiles", () -> MbtilesWriter.writeOutput(featureMap, output, profile, config, stats)); + stats.time("mbtiles", () -> MbtilesWriter.writeOutput(featureMap, mbtilesOutputPath, profile, config, stats)); overallTimer.stop(); LOGGER.info("FINISHED!"); stats.printSummary(); + + stats.close(); } } diff --git a/src/main/java/com/onthegomap/flatmap/Wikidata.java b/src/main/java/com/onthegomap/flatmap/Wikidata.java index 0bb25f22..51ef1e10 100644 --- a/src/main/java/com/onthegomap/flatmap/Wikidata.java +++ b/src/main/java/com/onthegomap/flatmap/Wikidata.java @@ -132,7 +132,7 @@ public class Wikidata { fetcher.loadExisting(oldMappings); var topology = Topology.start("wikidata", stats) - .fromGenerator("pbf", infile.read(readerThreads)) + .fromGenerator("pbf", infile.read("pbfwikidata", readerThreads)) .addBuffer("reader_queue", 50_000, 10_000) .addWorker("filter", processThreads, fetcher::filter) .addBuffer("fetch_queue", 50_000) diff --git a/src/main/java/com/onthegomap/flatmap/monitoring/ProcessInfo.java b/src/main/java/com/onthegomap/flatmap/monitoring/ProcessInfo.java index 476372c2..116b54c8 100644 --- a/src/main/java/com/onthegomap/flatmap/monitoring/ProcessInfo.java +++ b/src/main/java/com/onthegomap/flatmap/monitoring/ProcessInfo.java @@ -57,9 +57,9 @@ public class ProcessInfo { } - public static record ThreadState(String name, long cpuTimeNanos, long id) { + public static record ThreadState(String name, long cpuTimeNanos, long userTimeNanos, long id) { - public static final ThreadState DEFAULT = new ThreadState("", 0, -1); + public static final ThreadState DEFAULT = new ThreadState("", 0, 0, -1); } @@ -77,8 +77,12 @@ public class ProcessInfo { ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); for (ThreadInfo thread : threadMXBean.dumpAllThreads(false, false)) { threadState.put(thread.getThreadId(), - new ThreadState(thread.getThreadName(), threadMXBean.getThreadCpuTime(thread.getThreadId()), - thread.getThreadId())); + new ThreadState( + thread.getThreadName(), + threadMXBean.getThreadCpuTime(thread.getThreadId()), + threadMXBean.getThreadUserTime(thread.getThreadId()), + thread.getThreadId() + )); } return threadState; } diff --git a/src/main/java/com/onthegomap/flatmap/monitoring/PrometheusStats.java b/src/main/java/com/onthegomap/flatmap/monitoring/PrometheusStats.java new file mode 100644 index 00000000..1da35469 --- /dev/null +++ b/src/main/java/com/onthegomap/flatmap/monitoring/PrometheusStats.java @@ -0,0 +1,265 @@ +package com.onthegomap.flatmap.monitoring; + +import com.onthegomap.flatmap.FileUtils; +import com.onthegomap.flatmap.MemoryEstimator; +import io.prometheus.client.Collector; +import io.prometheus.client.CollectorRegistry; +import io.prometheus.client.CounterMetricFamily; +import io.prometheus.client.GaugeMetricFamily; +import io.prometheus.client.exporter.BasicAuthHttpConnectionFactory; +import io.prometheus.client.exporter.PushGateway; +import io.prometheus.client.hotspot.DefaultExports; +import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.lang.management.OperatingSystemMXBean; +import java.net.URL; +import java.nio.file.FileStore; +import java.nio.file.Files; +import java.nio.file.Path; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PrometheusStats implements Stats { + + private static final Logger LOGGER = LoggerFactory.getLogger(PrometheusStats.class); + + private final CollectorRegistry registry = new CollectorRegistry(); + private final Timers timers = new Timers(); + private static final String BASE = "flatmap_"; + private final PushGateway pg; + private final ScheduledExecutorService executor; + private final String job; + private final Map filesToMonitor = Collections.synchronizedMap(new LinkedHashMap<>()); + private final Map heapObjectsToMonitor = Collections + .synchronizedMap(new LinkedHashMap<>()); + + public PrometheusStats(String destination, String job, Duration interval) { + this.job = job; + try { + DefaultExports.register(registry); + new ThreadDetailsExports().register(registry); + new InProgressTasks().register(registry); + new FileSizeCollector().register(registry); + new HeapObjectSizeCollector().register(registry); + + URL url = new URL(destination); + pg = new PushGateway(url); + if (url.getUserInfo() != null) { + String[] parts = url.getUserInfo().split(":"); + if (parts.length == 2) { + pg.setConnectionFactory(new BasicAuthHttpConnectionFactory(parts[0], parts[1])); + } + } + pg.pushAdd(registry, job); + executor = Executors.newScheduledThreadPool(1, r -> { + Thread thread = new Thread(r); + thread.setDaemon(true); + thread.setName("prometheus-pusher"); + return thread; + }); + executor.scheduleAtFixedRate(this::push, 0, Math.max(interval.getSeconds(), 5), TimeUnit.SECONDS); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private void push() { + try { + pg.push(registry, job); + } catch (IOException e) { + LOGGER.error("Error pushing stats to prometheus", e); + } + } + + @Override + public void time(String name, Runnable task) { + timers.time(name, task); + } + + @Override + public Timers.Finishable startTimer(String name) { + return timers.startTimer(name); + } + + @Override + public void gauge(String name, Supplier value) { + new Collector() { + @Override + public List collect() { + return List.of(new GaugeMetricFamily(BASE + sanitizeMetricName(name), "", value.get().doubleValue())); + } + }.register(registry); + } + + @Override + public void emittedFeature(int z, String layer, int coveringTiles) { + + } + + @Override + public void encodedTile(int zoom, int length) { + + } + + @Override + public void wroteTile(int zoom, int bytes) { + + } + + @Override + public Timers timers() { + return timers; + } + + @Override + public void monitorFile(String name, Path path) { + filesToMonitor.put(name, path); + } + + @Override + public void monitorInMemoryObject(String name, MemoryEstimator.HasEstimate heapObject) { + heapObjectsToMonitor.put(name, heapObject); + } + + @Override + public void counter(String name, Supplier supplier) { + new Collector() { + @Override + public List collect() { + return List.of(new GaugeMetricFamily(BASE + sanitizeMetricName(name), "", supplier.get().doubleValue())); + } + }.register(registry); + } + + @Override + public void close() throws Exception { + executor.shutdown(); + push(); + } + + private static CounterMetricFamily counterMetric(String name, double value) { + return new CounterMetricFamily(BASE + name, BASE + name + " value", value); + } + + private static GaugeMetricFamily gaugeMetric(String name, double value) { + return new GaugeMetricFamily(BASE + name, BASE + name + " value", value); + } + + private class InProgressTasks extends Collector { + + @Override + public List collect() { + List result = new ArrayList<>(); + for (var entry : timers.all().entrySet()) { + String name = entry.getKey(); + Timer timer = entry.getValue(); + result.add(gaugeMetric(name + "_running", timer.running() ? 1 : 0)); + ProcessTime time = timer.elapsed(); + result.add(gaugeMetric(name + "_elapsed_time_seconds", time.wall().toNanos() / NANOSECONDS_PER_SECOND)); + result.add(gaugeMetric(name + "_cpu_time_seconds", + time.cpu().orElse(Duration.ZERO).toNanos() / NANOSECONDS_PER_SECOND)); + } + return result; + } + } + + private class FileSizeCollector extends Collector { + + private boolean logged = false; + + @Override + public List collect() { + List results = new ArrayList<>(); + for (var file : filesToMonitor.entrySet()) { + String name = sanitizeMetricName(file.getKey()); + Path path = file.getValue(); + results.add(new GaugeMetricFamily(BASE + "file_" + name + "_size_bytes", "Size of " + name + " in bytes", + FileUtils.size(path))); + if (Files.exists(path)) { + try { + FileStore fileStore = Files.getFileStore(path); + results + .add(new GaugeMetricFamily(BASE + "file_" + name + "_total_space_bytes", "Total space available on disk", + fileStore.getTotalSpace())); + results.add( + new GaugeMetricFamily(BASE + "file_" + name + "_unallocated_space_bytes", "Unallocated space on disk", + fileStore.getUnallocatedSpace())); + results + .add(new GaugeMetricFamily(BASE + "file_" + name + "_usable_space_bytes", "Usable space on disk", + fileStore.getUsableSpace())); + } catch (IOException e) { + // let the user know once + if (!logged) { + LOGGER.warn("unable to get usable space on device", e); + logged = true; + } + } + } + } + return results; + } + } + + private class HeapObjectSizeCollector extends Collector { + + @Override + public List collect() { + List results = new ArrayList<>(); + for (var entry : heapObjectsToMonitor.entrySet()) { + String name = sanitizeMetricName(entry.getKey()); + MemoryEstimator.HasEstimate heapObject = entry.getValue(); + results + .add(new GaugeMetricFamily(BASE + "heap_object_" + name + "_size_bytes", "Bytes of memory used by " + name, + heapObject.estimateMemoryUsageBytes())); + } + return results; + } + } + + private static class ThreadDetailsExports extends Collector { + + private final OperatingSystemMXBean osBean; + + public ThreadDetailsExports() { + this.osBean = ManagementFactory.getOperatingSystemMXBean(); + } + + private Map threads = Collections.synchronizedMap(new TreeMap<>()); + + public List collect() { + + List mfs = new ArrayList<>(List.of( + new GaugeMetricFamily("jvm_available_processors", "Result of Runtime.getRuntime().availableProcessors()", + Runtime.getRuntime().availableProcessors()), + new GaugeMetricFamily("jvm_system_load_avg", "Result of OperatingSystemMXBean.getSystemLoadAverage()", + osBean.getSystemLoadAverage()) + )); + + CounterMetricFamily threadCpuTimes = new CounterMetricFamily("jvm_thread_cpu_time_seconds", + "CPU time used by each thread", List.of("name", "id")); + mfs.add(threadCpuTimes); + CounterMetricFamily threadUserTimes = new CounterMetricFamily("jvm_thread_user_time_seconds", + "User time used by each thread", List.of("name", "id")); + mfs.add(threadUserTimes); + threads.putAll(ProcessInfo.getThreadStats()); + for (ProcessInfo.ThreadState thread : threads.values()) { + var labels = List.of(thread.name(), Long.toString(thread.id())); + threadUserTimes.addMetric(labels, thread.userTimeNanos() / NANOSECONDS_PER_SECOND); + threadCpuTimes.addMetric(labels, thread.cpuTimeNanos() / NANOSECONDS_PER_SECOND); + } + + return mfs; + } + } +} diff --git a/src/main/java/com/onthegomap/flatmap/monitoring/Stats.java b/src/main/java/com/onthegomap/flatmap/monitoring/Stats.java index 55428189..722fef73 100644 --- a/src/main/java/com/onthegomap/flatmap/monitoring/Stats.java +++ b/src/main/java/com/onthegomap/flatmap/monitoring/Stats.java @@ -1,6 +1,13 @@ package com.onthegomap.flatmap.monitoring; -public interface Stats { +import static io.prometheus.client.Collector.NANOSECONDS_PER_SECOND; + +import com.onthegomap.flatmap.MemoryEstimator; +import java.nio.file.Path; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Supplier; + +public interface Stats extends AutoCloseable { void time(String name, Runnable task); @@ -10,7 +17,11 @@ public interface Stats { Timers.Finishable startTimer(String name); - void gauge(String name, int value); + default void gauge(String name, Number value) { + gauge(name, () -> value); + } + + void gauge(String name, Supplier value); void emittedFeature(int z, String layer, int coveringTiles); @@ -20,8 +31,57 @@ public interface Stats { Timers timers(); + void monitorFile(String features, Path featureDbPath); + + void monitorInMemoryObject(String name, MemoryEstimator.HasEstimate heapObject); + + void counter(String name, Supplier supplier); + + default StatCounter longCounter(String name) { + StatCounter.AtomicCounter counter = new StatCounter.AtomicCounter(); + counter(name, counter::get); + return counter; + } + + default StatCounter nanoCounter(String name) { + StatCounter.AtomicCounter counter = new StatCounter.AtomicCounter(); + counter(name, () -> counter.get() / NANOSECONDS_PER_SECOND); + return counter; + } + + interface StatCounter { + + void inc(long v); + + default void inc() { + inc(1); + } + + class NoopCounter implements StatCounter { + + @Override + public void inc(long v) { + } + } + + class AtomicCounter implements StatCounter { + + private final AtomicLong counter = new AtomicLong(0); + + @Override + public void inc(long v) { + counter.addAndGet(v); + } + + public long get() { + return counter.get(); + } + } + } + class InMemory implements Stats { + private static final StatCounter NOOP_COUNTER = new StatCounter.NoopCounter(); private final Timers timers = new Timers(); @Override @@ -49,12 +109,38 @@ public interface Stats { } @Override - public void gauge(String name, int value) { + public void monitorFile(String features, Path featureDbPath) { + } + @Override + public void monitorInMemoryObject(String name, MemoryEstimator.HasEstimate heapObject) { + } + + @Override + public void counter(String name, Supplier supplier) { + } + + @Override + public StatCounter longCounter(String name) { + return NOOP_COUNTER; + } + + @Override + public StatCounter nanoCounter(String name) { + return NOOP_COUNTER; + } + + @Override + public void gauge(String name, Supplier value) { } @Override public void emittedFeature(int z, String layer, int coveringTiles) { } + + @Override + public void close() throws Exception { + + } } } diff --git a/src/main/java/com/onthegomap/flatmap/monitoring/Timer.java b/src/main/java/com/onthegomap/flatmap/monitoring/Timer.java index c87581c9..8c9da60f 100644 --- a/src/main/java/com/onthegomap/flatmap/monitoring/Timer.java +++ b/src/main/java/com/onthegomap/flatmap/monitoring/Timer.java @@ -14,6 +14,10 @@ public class Timer { return this; } + public boolean running() { + return end == null; + } + public ProcessTime elapsed() { return (end == null ? ProcessTime.now() : end).minus(start); } diff --git a/src/main/java/com/onthegomap/flatmap/monitoring/Timers.java b/src/main/java/com/onthegomap/flatmap/monitoring/Timers.java index 2cdad362..4bcd09bb 100644 --- a/src/main/java/com/onthegomap/flatmap/monitoring/Timers.java +++ b/src/main/java/com/onthegomap/flatmap/monitoring/Timers.java @@ -1,6 +1,7 @@ package com.onthegomap.flatmap.monitoring; import com.onthegomap.flatmap.Format; +import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import org.slf4j.Logger; @@ -9,7 +10,7 @@ import org.slf4j.LoggerFactory; public class Timers { private static final Logger LOGGER = LoggerFactory.getLogger(Stats.InMemory.class); - private final Map timers = new LinkedHashMap<>(); + private final Map timers = Collections.synchronizedMap(new LinkedHashMap<>()); public void time(String name, Runnable task) { Finishable timer = startTimer(name); @@ -32,6 +33,10 @@ public class Timers { return () -> LOGGER.info("[" + name + "] Finished in " + timers.get(name).stop()); } + public Map all() { + return new LinkedHashMap<>(timers); + } + public interface Finishable { void stop(); diff --git a/src/main/java/com/onthegomap/flatmap/read/OpenStreetMapReader.java b/src/main/java/com/onthegomap/flatmap/read/OpenStreetMapReader.java index c1eef15f..cc63ddf9 100644 --- a/src/main/java/com/onthegomap/flatmap/read/OpenStreetMapReader.java +++ b/src/main/java/com/onthegomap/flatmap/read/OpenStreetMapReader.java @@ -79,11 +79,12 @@ public class OpenStreetMapReader implements Closeable, MemoryEstimator.HasEstima this.nodeDb = nodeDb; this.stats = stats; this.profile = profile; + stats.monitorInMemoryObject("osm_relations", this); } public void pass1(CommonParams config) { var topology = Topology.start("osm_pass1", stats) - .fromGenerator("pbf", osmInputFile.read(config.threads() - 1)) + .fromGenerator("pbf", osmInputFile.read("pbfpass1", config.threads() - 1)) .addBuffer("reader_queue", 50_000, 10_000) .sinkToConsumer("process", 1, this::processPass1); @@ -138,7 +139,7 @@ public class OpenStreetMapReader implements Closeable, MemoryEstimator.HasEstima CountDownLatch waysDone = new CountDownLatch(processThreads); var topology = Topology.start("osm_pass2", stats) - .fromGenerator("pbf", osmInputFile.read(readerThreads)) + .fromGenerator("pbf", osmInputFile.read("pbfpass2", readerThreads)) .addBuffer("reader_queue", 50_000, 1_000) .addWorker("process", processThreads, (prev, next) -> { ReaderElement readerElement; diff --git a/src/main/java/com/onthegomap/flatmap/read/OsmInputFile.java b/src/main/java/com/onthegomap/flatmap/read/OsmInputFile.java index 6bf69d13..4072bd0c 100644 --- a/src/main/java/com/onthegomap/flatmap/read/OsmInputFile.java +++ b/src/main/java/com/onthegomap/flatmap/read/OsmInputFile.java @@ -14,6 +14,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; import java.util.function.Consumer; import java.util.zip.DataFormatException; import java.util.zip.Inflater; @@ -71,8 +72,13 @@ public class OsmInputFile implements BoundsProvider, OsmSource { } } - public void readTo(Consumer next, int threads) throws IOException { - ExecutorService executorService = Executors.newFixedThreadPool(threads); + public void readTo(Consumer next, String poolName, int threads) throws IOException { + ThreadFactory threadFactory = Executors.defaultThreadFactory(); + ExecutorService executorService = Executors.newFixedThreadPool(threads, (runnable) -> { + Thread thread = threadFactory.newThread(runnable); + thread.setName(poolName + "-" + thread.getName()); + return thread; + }); try (var stream = new BufferedInputStream(Files.newInputStream(path), 50_000)) { PbfStreamSplitter streamSplitter = new PbfStreamSplitter(new DataInputStream(stream)); var sink = new ReaderElementSink(next); @@ -84,8 +90,8 @@ public class OsmInputFile implements BoundsProvider, OsmSource { } @Override - public Topology.SourceStep read(int threads) { - return next -> readTo(next, threads); + public Topology.SourceStep read(String poolName, int threads) { + return next -> readTo(next, poolName, threads); } private static record ReaderElementSink(Consumer queue) implements Sink { diff --git a/src/main/java/com/onthegomap/flatmap/read/OsmSource.java b/src/main/java/com/onthegomap/flatmap/read/OsmSource.java index 757b06be..cd3d0531 100644 --- a/src/main/java/com/onthegomap/flatmap/read/OsmSource.java +++ b/src/main/java/com/onthegomap/flatmap/read/OsmSource.java @@ -5,5 +5,5 @@ import com.onthegomap.flatmap.worker.Topology; public interface OsmSource { - Topology.SourceStep read(int threads); + Topology.SourceStep read(String poolName, int threads); } diff --git a/src/main/java/com/onthegomap/flatmap/worker/WorkQueue.java b/src/main/java/com/onthegomap/flatmap/worker/WorkQueue.java index 7d24002e..5228b12c 100644 --- a/src/main/java/com/onthegomap/flatmap/worker/WorkQueue.java +++ b/src/main/java/com/onthegomap/flatmap/worker/WorkQueue.java @@ -19,6 +19,10 @@ public class WorkQueue implements AutoCloseable, Supplier, Consumer { private final int batchSize; private final ConcurrentHashMap> queues = new ConcurrentHashMap<>(); private final int pendingBatchesCapacity; + private final Stats.StatCounter enqueueCountStat; + private final Stats.StatCounter enqueueBlockTimeNanos; + private final Stats.StatCounter dequeueCountStat; + private final Stats.StatCounter dequeueBlockTimeNanos; private volatile boolean hasIncomingData = true; private final AtomicInteger pendingCount = new AtomicInteger(0); @@ -26,6 +30,16 @@ public class WorkQueue implements AutoCloseable, Supplier, Consumer { this.pendingBatchesCapacity = capacity / maxBatch; this.batchSize = maxBatch; itemQueue = new ArrayBlockingQueue<>(pendingBatchesCapacity); + + stats.gauge(name + "_blocking_queue_capacity", () -> pendingBatchesCapacity); + stats.gauge(name + "_blocking_queue_size", itemQueue::size); + stats.gauge(name + "_capacity", this::getCapacity); + stats.gauge(name + "_size", this::getPending); + + this.enqueueCountStat = stats.longCounter(name + "_enqueue_count"); + this.enqueueBlockTimeNanos = stats.nanoCounter(name + "_enqueue_block_time_seconds"); + this.dequeueCountStat = stats.longCounter(name + "_dequeue_count"); + this.dequeueBlockTimeNanos = stats.nanoCounter(name + "_dequeue_block_time_seconds"); } @Override @@ -58,6 +72,7 @@ public class WorkQueue implements AutoCloseable, Supplier, Consumer { if (writeBatch.size() >= batchSize) { flushWrites(); } + enqueueCountStat.inc(); } private void flushWrites() { @@ -68,7 +83,9 @@ public class WorkQueue implements AutoCloseable, Supplier, Consumer { queues.remove(Thread.currentThread().getId()); // blocks if full if (!itemQueue.offer(writeBatch)) { + long start = System.nanoTime(); itemQueue.put(writeBatch); + enqueueBlockTimeNanos.inc(System.nanoTime() - start); } } catch (InterruptedException ex) { throw new RuntimeException(ex); @@ -81,6 +98,7 @@ public class WorkQueue implements AutoCloseable, Supplier, Consumer { Queue itemBatch = itemReadBatchProvider.get(); if (itemBatch == null || itemBatch.isEmpty()) { + long start = System.nanoTime(); do { if (!hasIncomingData && itemQueue.isEmpty()) { break; @@ -99,12 +117,14 @@ public class WorkQueue implements AutoCloseable, Supplier, Consumer { } } while (itemBatch == null); itemReadBatchProvider.set(itemBatch); + dequeueBlockTimeNanos.inc(System.nanoTime() - start); } T result = itemBatch == null ? null : itemBatch.poll(); if (result != null) { pendingCount.decrementAndGet(); } + dequeueCountStat.inc(); return result; } diff --git a/src/test/java/com/onthegomap/flatmap/FlatMapTest.java b/src/test/java/com/onthegomap/flatmap/FlatMapTest.java index 4752ea55..c99ec4c3 100644 --- a/src/test/java/com/onthegomap/flatmap/FlatMapTest.java +++ b/src/test/java/com/onthegomap/flatmap/FlatMapTest.java @@ -90,7 +90,7 @@ public class FlatMapTest { private void processOsmFeatures(FeatureGroup featureGroup, Profile profile, CommonParams config, List osmElements) throws IOException { - OsmSource elems = threads -> next -> { + OsmSource elems = (name, threads) -> next -> { // process the same order they come in from an OSM file osmElements.stream().filter(e -> e.getType() == ReaderElement.FILEHEADER).forEachOrdered(next); osmElements.stream().filter(e -> e.getType() == ReaderElement.NODE).forEachOrdered(next); diff --git a/src/test/java/com/onthegomap/flatmap/read/OpenStreetMapReaderTest.java b/src/test/java/com/onthegomap/flatmap/read/OpenStreetMapReaderTest.java index 4f4b4b1f..06573f8f 100644 --- a/src/test/java/com/onthegomap/flatmap/read/OpenStreetMapReaderTest.java +++ b/src/test/java/com/onthegomap/flatmap/read/OpenStreetMapReaderTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test; public class OpenStreetMapReaderTest { - public final OsmSource osmSource = threads -> next -> { + public final OsmSource osmSource = (name, threads) -> next -> { }; private final Stats stats = new Stats.InMemory(); private final Profile profile = new Profile.NullProfile(); diff --git a/src/test/java/com/onthegomap/flatmap/read/OsmInputFileTest.java b/src/test/java/com/onthegomap/flatmap/read/OsmInputFileTest.java index df50d294..ff478f5e 100644 --- a/src/test/java/com/onthegomap/flatmap/read/OsmInputFileTest.java +++ b/src/test/java/com/onthegomap/flatmap/read/OsmInputFileTest.java @@ -28,7 +28,7 @@ public class OsmInputFileTest { AtomicInteger ways = new AtomicInteger(0); AtomicInteger rels = new AtomicInteger(0); Topology.start("test", new Stats.InMemory()) - .fromGenerator("pbf", file.read(2)) + .fromGenerator("pbf", file.read("test", 2)) .addBuffer("reader_queue", 1_000, 100) .sinkToConsumer("counter", 1, elem -> { switch (elem.getType()) {