├── .env.tpl ├── .gitignore ├── Makefile ├── README.md ├── audit ├── grafana │ └── provisioning │ │ ├── dashboards │ │ ├── aidbox.json │ │ ├── default.yaml │ │ └── perftest-aidbox.json │ │ └── datasources │ │ └── all.yaml ├── kibana │ └── kibana.yml └── prometheus │ └── prometheus.yml ├── docker-compose.yaml └── logging.md /.env.tpl: -------------------------------------------------------------------------------- 1 | # postgres image to run 2 | PGIMAGE=healthsamurai/aidboxdb:13.2 3 | 4 | # aidbox image to run 5 | # AIDBOX_IMAGE=healthsamurai/devbox:stable 6 | AIDBOX_IMAGE=healthsamurai/devbox:edge 7 | 8 | # license details 9 | 10 | AIDBOX_LICENSE= 11 | 12 | # Client to create on start up 13 | AIDBOX_CLIENT_ID=root 14 | AIDBOX_CLIENT_SECRET=secret 15 | 16 | # root user to create on start up 17 | 18 | AIDBOX_ADMIN_ID=admin 19 | AIDBOX_ADMIN_PASSWORD=secret 20 | 21 | # port to run webserver at 22 | AIDBOX_PORT=8888 23 | 24 | AIDBOX_FHIR_VERSION=4.0.0 25 | 26 | # db connection params 27 | PGPORT=5432 28 | PGHOSTPORT=5437 29 | PGUSER=postgres 30 | PGPASSWORD=postgres 31 | PGDATABASE=devbox 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | pgdata 2 | pgdata_bk 3 | static 4 | backup 5 | node_modules 6 | .env 7 | .esdata 8 | .grafana 9 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .EXPORT_ALL_VARIABLES: 2 | 3 | up: 4 | docker-compose up -d 5 | 6 | update: 7 | docker-compose pull 8 | docker-compose up -d 9 | 10 | down: 11 | docker-compose down 12 | 13 | stop: 14 | docker-compose stop 15 | 16 | restart: 17 | docker-compose restart 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deprecated. Moved to https://github.com/Aidbox/aidbox-docker-compose 2 | 3 | ## Aidbox.Dev - Aidbox Developer Version (aka Devbox) 4 | 5 | This repository contains auxiliary files to help you quickly run 6 | Aidbox.Dev on your local workstation and start creating your first FHIR 7 | application. 8 | 9 | ## Installation manual 10 | 11 | - Clone the repository 12 | - Copy `.env.tpl` file to `.env` and fill in your `AIDBOX_LICENSE_ID` and `AIDBOX_LICENSE_KEY`. Follow the [instruction](https://docs.aidbox.app/installation/setup-aidbox.dev) to get a license 13 | - Start docker containers 14 | ```bash 15 | $ docker compose up 16 | ``` 17 | 18 | ## Performance tests 19 | 20 | - Download [infrabox jar](https://storage.googleapis.com/libox/infrabox/genops.jar). 21 | - Run performance test: 22 | ``` 23 | $ java -cp '/path/to/genops.jar' perfbox.core http://localhost:8888 root secret 24 | ``` 25 | - Go to 'Performance test (Aidbox)' Grafana dashboard on http://localhost:3000 26 | 27 | Now you should see performance graphs. 28 | 29 | ### How testing works 30 | 31 | #### On start-up 32 | 33 | Test suite truncates `Patient` and `Encounter` tables then creates set of search parameters indexes 34 | 35 | - `Patient.name` 36 | - `Patient.name.family` 37 | - `Patient.birthDate` 38 | 39 | #### Testing 40 | 41 | This performance tests run test suit on 2, 4, 8, and 16 threads. Each thread executes test 5000 times. 42 | Each test does the following: 43 | 1. Creates Patient resource 44 | 2. Reads Patient by id 45 | 3. Creates Encounter resource 46 | 4. Reads Encounter by id 47 | 5. Searches count of Patients by name and birthDate 48 | 6. Searches count of Patients by family 49 | 50 | 51 | ## Sample Grafana dashboard 52 | 53 | ![image](https://user-images.githubusercontent.com/9136211/147488532-78e744b1-f51f-478f-8953-657a5f93ed0b.png) 54 | 55 | ![image](https://user-images.githubusercontent.com/9136211/147488586-f19b4173-07e4-4d9a-bc70-fbc0100c5bc4.png) 56 | -------------------------------------------------------------------------------- /audit/grafana/provisioning/dashboards/aidbox.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": { 3 | "list": [ 4 | { 5 | "builtIn": 1, 6 | "datasource": "-- Grafana --", 7 | "enable": true, 8 | "hide": true, 9 | "iconColor": "rgba(0, 211, 255, 1)", 10 | "name": "Annotations & Alerts", 11 | "type": "dashboard" 12 | } 13 | ] 14 | }, 15 | "editable": true, 16 | "gnetId": null, 17 | "graphTooltip": 0, 18 | "links": [], 19 | "panels": [ 20 | { 21 | "datasource": "aidbox-logs", 22 | "fieldConfig": { 23 | "defaults": { 24 | "color": { 25 | "mode": "palette-classic" 26 | }, 27 | "custom": { 28 | "axisLabel": "", 29 | "axisPlacement": "auto", 30 | "barAlignment": 0, 31 | "drawStyle": "line", 32 | "fillOpacity": 0, 33 | "gradientMode": "none", 34 | "hideFrom": { 35 | "legend": false, 36 | "tooltip": false, 37 | "viz": false 38 | }, 39 | "lineInterpolation": "linear", 40 | "lineWidth": 1, 41 | "pointSize": 5, 42 | "scaleDistribution": { 43 | "type": "linear" 44 | }, 45 | "showPoints": "auto", 46 | "spanNulls": false, 47 | "stacking": { 48 | "group": "A", 49 | "mode": "none" 50 | }, 51 | "thresholdsStyle": { 52 | "mode": "off" 53 | } 54 | }, 55 | "mappings": [], 56 | "thresholds": { 57 | "mode": "absolute", 58 | "steps": [ 59 | { 60 | "color": "green", 61 | "value": null 62 | }, 63 | { 64 | "color": "red", 65 | "value": 80 66 | } 67 | ] 68 | } 69 | }, 70 | "overrides": [] 71 | }, 72 | "gridPos": { 73 | "h": 7, 74 | "w": 12, 75 | "x": 0, 76 | "y": 0 77 | }, 78 | "id": 2, 79 | "options": { 80 | "legend": { 81 | "calcs": [], 82 | "displayMode": "list", 83 | "placement": "bottom" 84 | }, 85 | "tooltip": { 86 | "mode": "single" 87 | } 88 | }, 89 | "targets": [ 90 | { 91 | "alias": "", 92 | "bucketAggs": [ 93 | { 94 | "field": "ts", 95 | "id": "2", 96 | "settings": { 97 | "interval": "1m" 98 | }, 99 | "type": "date_histogram" 100 | } 101 | ], 102 | "metrics": [ 103 | { 104 | "id": "1", 105 | "type": "count" 106 | } 107 | ], 108 | "query": "ev:\"w/resp\"", 109 | "queryType": "randomWalk", 110 | "refId": "A", 111 | "timeField": "ts" 112 | } 113 | ], 114 | "title": "Requests per minute (rpm)", 115 | "type": "timeseries" 116 | }, 117 | { 118 | "datasource": "aidbox-logs", 119 | "fieldConfig": { 120 | "defaults": { 121 | "color": { 122 | "mode": "thresholds" 123 | }, 124 | "mappings": [], 125 | "thresholds": { 126 | "mode": "absolute", 127 | "steps": [ 128 | { 129 | "color": "green", 130 | "value": null 131 | }, 132 | { 133 | "color": "red", 134 | "value": 80 135 | } 136 | ] 137 | } 138 | }, 139 | "overrides": [] 140 | }, 141 | "gridPos": { 142 | "h": 4, 143 | "w": 3, 144 | "x": 12, 145 | "y": 0 146 | }, 147 | "id": 18, 148 | "options": { 149 | "colorMode": "value", 150 | "graphMode": "area", 151 | "justifyMode": "auto", 152 | "orientation": "auto", 153 | "reduceOptions": { 154 | "calcs": [ 155 | "lastNotNull" 156 | ], 157 | "fields": "", 158 | "values": false 159 | }, 160 | "text": {}, 161 | "textMode": "auto" 162 | }, 163 | "pluginVersion": "8.0.5", 164 | "targets": [ 165 | { 166 | "alias": "", 167 | "bucketAggs": [ 168 | { 169 | "field": "ts", 170 | "id": "2", 171 | "settings": { 172 | "interval": "1d" 173 | }, 174 | "type": "date_histogram" 175 | } 176 | ], 177 | "metrics": [ 178 | { 179 | "id": "1", 180 | "type": "count" 181 | } 182 | ], 183 | "query": "ev:\"w/resp\"", 184 | "queryType": "randomWalk", 185 | "refId": "A", 186 | "timeField": "ts" 187 | } 188 | ], 189 | "title": "Request Per Day", 190 | "type": "stat" 191 | }, 192 | { 193 | "datasource": "aidbox-logs", 194 | "fieldConfig": { 195 | "defaults": { 196 | "color": { 197 | "mode": "palette-classic" 198 | }, 199 | "custom": { 200 | "hideFrom": { 201 | "legend": false, 202 | "tooltip": false, 203 | "viz": false 204 | } 205 | }, 206 | "mappings": [] 207 | }, 208 | "overrides": [] 209 | }, 210 | "gridPos": { 211 | "h": 4, 212 | "w": 3, 213 | "x": 15, 214 | "y": 0 215 | }, 216 | "id": 16, 217 | "options": { 218 | "legend": { 219 | "displayMode": "list", 220 | "placement": "bottom" 221 | }, 222 | "pieType": "pie", 223 | "reduceOptions": { 224 | "calcs": [ 225 | "lastNotNull" 226 | ], 227 | "fields": "", 228 | "values": false 229 | }, 230 | "tooltip": { 231 | "mode": "single" 232 | } 233 | }, 234 | "targets": [ 235 | { 236 | "alias": "", 237 | "bucketAggs": [ 238 | { 239 | "field": "w_m.keyword", 240 | "id": "2", 241 | "settings": { 242 | "min_doc_count": "0", 243 | "order": "desc", 244 | "orderBy": "_term", 245 | "size": "10" 246 | }, 247 | "type": "terms" 248 | } 249 | ], 250 | "metrics": [ 251 | { 252 | "id": "1", 253 | "type": "count" 254 | } 255 | ], 256 | "query": "", 257 | "queryType": "randomWalk", 258 | "refId": "A", 259 | "timeField": "ts" 260 | } 261 | ], 262 | "title": "Request Methods", 263 | "type": "piechart" 264 | }, 265 | { 266 | "datasource": "aidbox-logs", 267 | "fieldConfig": { 268 | "defaults": { 269 | "color": { 270 | "mode": "thresholds" 271 | }, 272 | "mappings": [], 273 | "thresholds": { 274 | "mode": "absolute", 275 | "steps": [ 276 | { 277 | "color": "green", 278 | "value": null 279 | }, 280 | { 281 | "color": "red", 282 | "value": 80 283 | } 284 | ] 285 | } 286 | }, 287 | "overrides": [] 288 | }, 289 | "gridPos": { 290 | "h": 4, 291 | "w": 3, 292 | "x": 18, 293 | "y": 0 294 | }, 295 | "id": 14, 296 | "options": { 297 | "colorMode": "value", 298 | "graphMode": "area", 299 | "justifyMode": "auto", 300 | "orientation": "auto", 301 | "reduceOptions": { 302 | "calcs": [ 303 | "lastNotNull" 304 | ], 305 | "fields": "", 306 | "values": false 307 | }, 308 | "text": {}, 309 | "textMode": "auto" 310 | }, 311 | "pluginVersion": "8.0.5", 312 | "targets": [ 313 | { 314 | "alias": "", 315 | "bucketAggs": [ 316 | { 317 | "field": "ts", 318 | "id": "2", 319 | "settings": { 320 | "interval": "1d" 321 | }, 322 | "type": "date_histogram" 323 | } 324 | ], 325 | "metrics": [ 326 | { 327 | "id": "1", 328 | "type": "count" 329 | } 330 | ], 331 | "query": "lvl.keyword:\"error\"", 332 | "queryType": "randomWalk", 333 | "refId": "A", 334 | "timeField": "ts" 335 | } 336 | ], 337 | "title": "Errors", 338 | "type": "stat" 339 | }, 340 | { 341 | "datasource": "aidbox-logs", 342 | "fieldConfig": { 343 | "defaults": { 344 | "color": { 345 | "mode": "thresholds" 346 | }, 347 | "custom": { 348 | "align": "auto", 349 | "displayMode": "auto" 350 | }, 351 | "mappings": [], 352 | "thresholds": { 353 | "mode": "absolute", 354 | "steps": [ 355 | { 356 | "color": "green", 357 | "value": null 358 | }, 359 | { 360 | "color": "red", 361 | "value": 80 362 | } 363 | ] 364 | }, 365 | "unit": "ms" 366 | }, 367 | "overrides": [ 368 | { 369 | "matcher": { 370 | "id": "byName", 371 | "options": "Count" 372 | }, 373 | "properties": [ 374 | { 375 | "id": "custom.displayMode", 376 | "value": "auto" 377 | }, 378 | { 379 | "id": "unit" 380 | } 381 | ] 382 | } 383 | ] 384 | }, 385 | "gridPos": { 386 | "h": 8, 387 | "w": 12, 388 | "x": 12, 389 | "y": 4 390 | }, 391 | "id": 8, 392 | "options": { 393 | "showHeader": true 394 | }, 395 | "pluginVersion": "8.0.5", 396 | "targets": [ 397 | { 398 | "alias": "", 399 | "bucketAggs": [ 400 | { 401 | "field": "w_url.keyword", 402 | "id": "2", 403 | "settings": { 404 | "min_doc_count": "3", 405 | "order": "desc", 406 | "orderBy": "_term", 407 | "size": "0" 408 | }, 409 | "type": "terms" 410 | } 411 | ], 412 | "metrics": [ 413 | { 414 | "id": "1", 415 | "type": "count" 416 | }, 417 | { 418 | "field": "d", 419 | "id": "3", 420 | "type": "sum" 421 | }, 422 | { 423 | "field": "d", 424 | "id": "4", 425 | "type": "avg" 426 | }, 427 | { 428 | "field": "d", 429 | "id": "5", 430 | "type": "max" 431 | }, 432 | { 433 | "field": "d", 434 | "id": "6", 435 | "type": "min" 436 | } 437 | ], 438 | "query": "ev:\"w/resp\" AND NOT w_url:\"/_health\"", 439 | "queryType": "randomWalk", 440 | "refId": "A", 441 | "timeField": "ts" 442 | } 443 | ], 444 | "title": "Response Time", 445 | "transformations": [ 446 | { 447 | "id": "organize", 448 | "options": { 449 | "excludeByName": {}, 450 | "indexByName": {}, 451 | "renameByName": { 452 | "Sum": "" 453 | } 454 | } 455 | } 456 | ], 457 | "type": "table" 458 | }, 459 | { 460 | "cards": { 461 | "cardPadding": null, 462 | "cardRound": null 463 | }, 464 | "color": { 465 | "cardColor": "#b4ff00", 466 | "colorScale": "sqrt", 467 | "colorScheme": "interpolateOranges", 468 | "exponent": 0.5, 469 | "mode": "spectrum" 470 | }, 471 | "dataFormat": "timeseries", 472 | "datasource": "aidbox-logs", 473 | "gridPos": { 474 | "h": 7, 475 | "w": 12, 476 | "x": 0, 477 | "y": 7 478 | }, 479 | "heatmap": {}, 480 | "hideZeroBuckets": false, 481 | "highlightCards": true, 482 | "id": 4, 483 | "legend": { 484 | "show": false 485 | }, 486 | "reverseYBuckets": false, 487 | "targets": [ 488 | { 489 | "alias": "", 490 | "bucketAggs": [ 491 | { 492 | "field": "d", 493 | "id": "2", 494 | "settings": { 495 | "interval": "1000" 496 | }, 497 | "type": "histogram" 498 | }, 499 | { 500 | "field": "ts", 501 | "id": "3", 502 | "settings": { 503 | "interval": "auto", 504 | "min_doc_count": "0", 505 | "trimEdges": "0" 506 | }, 507 | "type": "date_histogram" 508 | } 509 | ], 510 | "metrics": [ 511 | { 512 | "id": "1", 513 | "type": "count" 514 | } 515 | ], 516 | "query": "ev:\"w/resp\"", 517 | "queryType": "randomWalk", 518 | "refId": "A", 519 | "timeField": "ts" 520 | } 521 | ], 522 | "title": "Request's Duration Heatmap", 523 | "tooltip": { 524 | "show": true, 525 | "showHistogram": true 526 | }, 527 | "type": "heatmap", 528 | "xAxis": { 529 | "show": true 530 | }, 531 | "xBucketNumber": null, 532 | "xBucketSize": null, 533 | "yAxis": { 534 | "decimals": null, 535 | "format": "ms", 536 | "logBase": 1, 537 | "max": null, 538 | "min": null, 539 | "show": true, 540 | "splitFactor": null 541 | }, 542 | "yBucketBound": "auto", 543 | "yBucketNumber": null, 544 | "yBucketSize": null 545 | }, 546 | { 547 | "datasource": "aidbox-logs", 548 | "fieldConfig": { 549 | "defaults": { 550 | "color": { 551 | "mode": "thresholds" 552 | }, 553 | "custom": { 554 | "align": "auto", 555 | "displayMode": "auto", 556 | "filterable": false 557 | }, 558 | "mappings": [], 559 | "thresholds": { 560 | "mode": "absolute", 561 | "steps": [ 562 | { 563 | "color": "green", 564 | "value": null 565 | }, 566 | { 567 | "color": "red", 568 | "value": 80 569 | } 570 | ] 571 | } 572 | }, 573 | "overrides": [ 574 | { 575 | "matcher": { 576 | "id": "byName", 577 | "options": "ts" 578 | }, 579 | "properties": [ 580 | { 581 | "id": "custom.width", 582 | "value": 0 583 | } 584 | ] 585 | }, 586 | { 587 | "matcher": { 588 | "id": "byName", 589 | "options": "sql" 590 | }, 591 | "properties": [ 592 | { 593 | "id": "custom.width", 594 | "value": 1155 595 | } 596 | ] 597 | }, 598 | { 599 | "matcher": { 600 | "id": "byName", 601 | "options": "tn" 602 | }, 603 | "properties": [ 604 | { 605 | "id": "custom.width", 606 | "value": 119 607 | } 608 | ] 609 | }, 610 | { 611 | "matcher": { 612 | "id": "byName", 613 | "options": "d" 614 | }, 615 | "properties": [ 616 | { 617 | "id": "custom.width", 618 | "value": 64 619 | } 620 | ] 621 | }, 622 | { 623 | "matcher": { 624 | "id": "byName", 625 | "options": "d (max)" 626 | }, 627 | "properties": [ 628 | { 629 | "id": "custom.width", 630 | "value": 69 631 | } 632 | ] 633 | }, 634 | { 635 | "matcher": { 636 | "id": "byName", 637 | "options": "d (mean)" 638 | }, 639 | "properties": [ 640 | { 641 | "id": "custom.width", 642 | "value": 96 643 | } 644 | ] 645 | }, 646 | { 647 | "matcher": { 648 | "id": "byName", 649 | "options": "d (sum)" 650 | }, 651 | "properties": [ 652 | { 653 | "id": "custom.width", 654 | "value": 84 655 | } 656 | ] 657 | } 658 | ] 659 | }, 660 | "gridPos": { 661 | "h": 8, 662 | "w": 12, 663 | "x": 12, 664 | "y": 12 665 | }, 666 | "id": 6, 667 | "options": { 668 | "showHeader": true, 669 | "sortBy": [ 670 | { 671 | "desc": true, 672 | "displayName": "d (max)" 673 | } 674 | ] 675 | }, 676 | "pluginVersion": "8.0.5", 677 | "targets": [ 678 | { 679 | "alias": "", 680 | "bucketAggs": [], 681 | "metrics": [ 682 | { 683 | "id": "1", 684 | "settings": { 685 | "size": "100" 686 | }, 687 | "type": "raw_data" 688 | } 689 | ], 690 | "query": "ev:\"db/q\"", 691 | "queryType": "randomWalk", 692 | "refId": "A", 693 | "timeField": "ts" 694 | } 695 | ], 696 | "title": "Slow Queries", 697 | "transformations": [ 698 | { 699 | "id": "organize", 700 | "options": { 701 | "excludeByName": { 702 | "_id": true, 703 | "_index": true, 704 | "_type": true, 705 | "ctx": true, 706 | "ev": true, 707 | "highlight": true, 708 | "op": true, 709 | "sort": true, 710 | "tn": false, 711 | "ts": true, 712 | "w": true 713 | }, 714 | "indexByName": { 715 | "_id": 1, 716 | "_index": 2, 717 | "_type": 3, 718 | "ctx": 4, 719 | "d": 5, 720 | "ev": 8, 721 | "highlight": 9, 722 | "op": 10, 723 | "sort": 11, 724 | "sql": 6, 725 | "tn": 7, 726 | "ts": 0, 727 | "w": 12 728 | }, 729 | "renameByName": { 730 | "d": "", 731 | "tn": "box" 732 | } 733 | } 734 | }, 735 | { 736 | "id": "groupBy", 737 | "options": { 738 | "fields": { 739 | "box": { 740 | "aggregations": [], 741 | "operation": "groupby" 742 | }, 743 | "d": { 744 | "aggregations": [ 745 | "max", 746 | "mean", 747 | "sum" 748 | ], 749 | "operation": "aggregate" 750 | }, 751 | "sql": { 752 | "aggregations": [], 753 | "operation": "groupby" 754 | } 755 | } 756 | } 757 | }, 758 | { 759 | "id": "organize", 760 | "options": { 761 | "excludeByName": {}, 762 | "indexByName": { 763 | "box": 4, 764 | "d (max)": 0, 765 | "d (mean)": 1, 766 | "d (sum)": 2, 767 | "sql": 3 768 | }, 769 | "renameByName": {} 770 | } 771 | } 772 | ], 773 | "type": "table" 774 | }, 775 | { 776 | "datasource": "aidbox-logs", 777 | "fieldConfig": { 778 | "defaults": { 779 | "color": { 780 | "mode": "palette-classic" 781 | }, 782 | "custom": { 783 | "axisLabel": "", 784 | "axisPlacement": "auto", 785 | "barAlignment": 0, 786 | "drawStyle": "line", 787 | "fillOpacity": 10, 788 | "gradientMode": "none", 789 | "hideFrom": { 790 | "legend": false, 791 | "tooltip": false, 792 | "viz": false 793 | }, 794 | "lineInterpolation": "smooth", 795 | "lineWidth": 1, 796 | "pointSize": 5, 797 | "scaleDistribution": { 798 | "type": "linear" 799 | }, 800 | "showPoints": "never", 801 | "spanNulls": true, 802 | "stacking": { 803 | "group": "A", 804 | "mode": "none" 805 | }, 806 | "thresholdsStyle": { 807 | "mode": "off" 808 | } 809 | }, 810 | "mappings": [], 811 | "thresholds": { 812 | "mode": "absolute", 813 | "steps": [ 814 | { 815 | "color": "green", 816 | "value": null 817 | }, 818 | { 819 | "color": "red", 820 | "value": 80 821 | } 822 | ] 823 | }, 824 | "unit": "short" 825 | }, 826 | "overrides": [] 827 | }, 828 | "gridPos": { 829 | "h": 8, 830 | "w": 12, 831 | "x": 0, 832 | "y": 14 833 | }, 834 | "id": 12, 835 | "options": { 836 | "legend": { 837 | "calcs": [], 838 | "displayMode": "list", 839 | "placement": "bottom" 840 | }, 841 | "tooltip": { 842 | "mode": "single" 843 | } 844 | }, 845 | "pluginVersion": "8.0.5", 846 | "targets": [ 847 | { 848 | "alias": "http", 849 | "bucketAggs": [ 850 | { 851 | "field": "ts", 852 | "id": "2", 853 | "settings": { 854 | "interval": "auto" 855 | }, 856 | "type": "date_histogram" 857 | } 858 | ], 859 | "metrics": [ 860 | { 861 | "field": "d", 862 | "id": "1", 863 | "type": "avg" 864 | } 865 | ], 866 | "query": "ev:\"w/resp\"", 867 | "queryType": "randomWalk", 868 | "refId": "A", 869 | "timeField": "ts" 870 | }, 871 | { 872 | "alias": "db", 873 | "bucketAggs": [ 874 | { 875 | "field": "ts", 876 | "id": "2", 877 | "settings": { 878 | "interval": "auto" 879 | }, 880 | "type": "date_histogram" 881 | } 882 | ], 883 | "hide": false, 884 | "metrics": [ 885 | { 886 | "field": "d", 887 | "id": "1", 888 | "type": "avg" 889 | } 890 | ], 891 | "query": "ev:\"db/q\" AND ctx:*", 892 | "refId": "B", 893 | "timeField": "ts" 894 | } 895 | ], 896 | "title": "Mean request http/db", 897 | "type": "timeseries" 898 | }, 899 | { 900 | "datasource": "aidbox-logs", 901 | "fieldConfig": { 902 | "defaults": { 903 | "color": { 904 | "mode": "palette-classic" 905 | }, 906 | "custom": { 907 | "axisLabel": "", 908 | "axisPlacement": "auto", 909 | "barAlignment": 0, 910 | "drawStyle": "line", 911 | "fillOpacity": 0, 912 | "gradientMode": "none", 913 | "hideFrom": { 914 | "legend": false, 915 | "tooltip": false, 916 | "viz": false 917 | }, 918 | "lineInterpolation": "linear", 919 | "lineWidth": 1, 920 | "pointSize": 5, 921 | "scaleDistribution": { 922 | "type": "linear" 923 | }, 924 | "showPoints": "auto", 925 | "spanNulls": false, 926 | "stacking": { 927 | "group": "A", 928 | "mode": "none" 929 | }, 930 | "thresholdsStyle": { 931 | "mode": "off" 932 | } 933 | }, 934 | "mappings": [], 935 | "thresholds": { 936 | "mode": "absolute", 937 | "steps": [ 938 | { 939 | "color": "green", 940 | "value": null 941 | }, 942 | { 943 | "color": "red", 944 | "value": 80 945 | } 946 | ] 947 | } 948 | }, 949 | "overrides": [] 950 | }, 951 | "gridPos": { 952 | "h": 5, 953 | "w": 12, 954 | "x": 12, 955 | "y": 20 956 | }, 957 | "id": 10, 958 | "options": { 959 | "legend": { 960 | "calcs": [], 961 | "displayMode": "list", 962 | "placement": "bottom" 963 | }, 964 | "tooltip": { 965 | "mode": "single" 966 | } 967 | }, 968 | "targets": [ 969 | { 970 | "alias": "Users", 971 | "bucketAggs": [ 972 | { 973 | "field": "ts", 974 | "id": "2", 975 | "settings": { 976 | "interval": "5m" 977 | }, 978 | "type": "date_histogram" 979 | } 980 | ], 981 | "metrics": [ 982 | { 983 | "field": "w_uid.keyword", 984 | "id": "1", 985 | "type": "cardinality" 986 | } 987 | ], 988 | "query": "", 989 | "queryType": "randomWalk", 990 | "refId": "A", 991 | "timeField": "ts" 992 | }, 993 | { 994 | "alias": "Cliets", 995 | "bucketAggs": [ 996 | { 997 | "field": "ts", 998 | "id": "2", 999 | "settings": { 1000 | "interval": "5m" 1001 | }, 1002 | "type": "date_histogram" 1003 | } 1004 | ], 1005 | "hide": false, 1006 | "metrics": [ 1007 | { 1008 | "field": "w_cid.keyword", 1009 | "id": "1", 1010 | "type": "cardinality" 1011 | } 1012 | ], 1013 | "query": "", 1014 | "refId": "B", 1015 | "timeField": "ts" 1016 | } 1017 | ], 1018 | "title": "Users/Clients Online", 1019 | "type": "timeseries" 1020 | } 1021 | ], 1022 | "refresh": false, 1023 | "schemaVersion": 30, 1024 | "style": "dark", 1025 | "tags": [], 1026 | "templating": { 1027 | "list": [] 1028 | }, 1029 | "time": { 1030 | "from": "now-6h", 1031 | "to": "now" 1032 | }, 1033 | "timepicker": {}, 1034 | "timezone": "", 1035 | "title": "Aidbox", 1036 | "uid": "u2worNmnk", 1037 | "version": 3 1038 | } 1039 | 1040 | -------------------------------------------------------------------------------- /audit/grafana/provisioning/dashboards/default.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: Aidbox 5 | folder: API 6 | type: file 7 | options: 8 | path: /etc/grafana/provisioning/dashboards/aidbox.json 9 | - name: Performance test (Aidbox) 10 | folder: Performance 11 | type: file 12 | options: 13 | path: /etc/grafana/provisioning/dashboards/perftest-aidbox.json 14 | -------------------------------------------------------------------------------- /audit/grafana/provisioning/dashboards/perftest-aidbox.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": { 3 | "list": [ 4 | { 5 | "builtIn": 1, 6 | "datasource": "-- Grafana --", 7 | "enable": true, 8 | "hide": true, 9 | "iconColor": "rgba(0, 211, 255, 1)", 10 | "name": "Annotations & Alerts", 11 | "target": { 12 | "limit": 100, 13 | "matchAny": false, 14 | "tags": [], 15 | "type": "dashboard" 16 | }, 17 | "type": "dashboard" 18 | } 19 | ] 20 | }, 21 | "editable": true, 22 | "fiscalYearStartMonth": 0, 23 | "graphTooltip": 0, 24 | "id": 13, 25 | "links": [], 26 | "liveNow": false, 27 | "panels": [ 28 | { 29 | "datasource": { 30 | "type": "prometheus", 31 | "uid": "PBFA97CFB590B2093" 32 | }, 33 | "fieldConfig": { 34 | "defaults": { 35 | "color": { 36 | "mode": "thresholds" 37 | }, 38 | "mappings": [], 39 | "thresholds": { 40 | "mode": "absolute", 41 | "steps": [ 42 | { 43 | "color": "green", 44 | "value": null 45 | } 46 | ] 47 | }, 48 | "unit": "reqps" 49 | }, 50 | "overrides": [] 51 | }, 52 | "gridPos": { 53 | "h": 3, 54 | "w": 12, 55 | "x": 0, 56 | "y": 0 57 | }, 58 | "id": 76, 59 | "options": { 60 | "colorMode": "value", 61 | "graphMode": "area", 62 | "justifyMode": "auto", 63 | "orientation": "auto", 64 | "reduceOptions": { 65 | "calcs": [ 66 | "lastNotNull" 67 | ], 68 | "fields": "", 69 | "values": false 70 | }, 71 | "textMode": "auto" 72 | }, 73 | "pluginVersion": "8.3.0", 74 | "targets": [ 75 | { 76 | "datasource": { 77 | "type": "prometheus", 78 | "uid": "PBFA97CFB590B2093" 79 | }, 80 | "exemplar": true, 81 | "expr": "max_over_time(sum(rate(perf_request_count{threads='2'}[$__rate_interval])) [15m:])", 82 | "interval": "", 83 | "legendFormat": "2 threads", 84 | "refId": "A" 85 | }, 86 | { 87 | "datasource": { 88 | "type": "prometheus", 89 | "uid": "PBFA97CFB590B2093" 90 | }, 91 | "exemplar": true, 92 | "expr": "max_over_time(sum(rate(perf_request_count{threads='4'}[$__rate_interval])) [15m:])", 93 | "hide": false, 94 | "interval": "", 95 | "legendFormat": "4 threads", 96 | "refId": "B" 97 | }, 98 | { 99 | "datasource": { 100 | "type": "prometheus", 101 | "uid": "PBFA97CFB590B2093" 102 | }, 103 | "exemplar": true, 104 | "expr": "max_over_time(sum(rate(perf_request_count{threads='8'}[$__rate_interval])) [15m:])", 105 | "hide": false, 106 | "interval": "", 107 | "legendFormat": "8 threads", 108 | "refId": "C" 109 | }, 110 | { 111 | "datasource": { 112 | "type": "prometheus", 113 | "uid": "PBFA97CFB590B2093" 114 | }, 115 | "exemplar": true, 116 | "expr": "max_over_time(sum(rate(perf_request_count{threads='16'}[$__rate_interval])) [15m:])", 117 | "hide": false, 118 | "interval": "", 119 | "legendFormat": "16 threads", 120 | "refId": "D" 121 | } 122 | ], 123 | "type": "stat" 124 | }, 125 | { 126 | "datasource": { 127 | "type": "prometheus", 128 | "uid": "PBFA97CFB590B2093" 129 | }, 130 | "fieldConfig": { 131 | "defaults": { 132 | "color": { 133 | "mode": "thresholds" 134 | }, 135 | "mappings": [], 136 | "thresholds": { 137 | "mode": "absolute", 138 | "steps": [ 139 | { 140 | "color": "green", 141 | "value": null 142 | } 143 | ] 144 | }, 145 | "unit": "reqps" 146 | }, 147 | "overrides": [] 148 | }, 149 | "gridPos": { 150 | "h": 3, 151 | "w": 2, 152 | "x": 12, 153 | "y": 0 154 | }, 155 | "id": 78, 156 | "options": { 157 | "colorMode": "value", 158 | "graphMode": "area", 159 | "justifyMode": "auto", 160 | "orientation": "auto", 161 | "reduceOptions": { 162 | "calcs": [ 163 | "lastNotNull" 164 | ], 165 | "fields": "", 166 | "values": false 167 | }, 168 | "textMode": "auto" 169 | }, 170 | "pluginVersion": "8.3.0", 171 | "targets": [ 172 | { 173 | "datasource": { 174 | "type": "prometheus", 175 | "uid": "PBFA97CFB590B2093" 176 | }, 177 | "exemplar": true, 178 | "expr": " max_over_time(sum(rate(aidbox_http_request_duration_seconds_count[$__rate_interval])) [5m:])", 179 | "interval": "", 180 | "legendFormat": "aidbox max rps", 181 | "refId": "A" 182 | } 183 | ], 184 | "type": "stat" 185 | }, 186 | { 187 | "datasource": { 188 | "type": "prometheus", 189 | "uid": "PBFA97CFB590B2093" 190 | }, 191 | "fieldConfig": { 192 | "defaults": { 193 | "color": { 194 | "mode": "palette-classic" 195 | }, 196 | "custom": { 197 | "axisLabel": "", 198 | "axisPlacement": "auto", 199 | "barAlignment": 0, 200 | "drawStyle": "line", 201 | "fillOpacity": 17, 202 | "gradientMode": "none", 203 | "hideFrom": { 204 | "legend": false, 205 | "tooltip": false, 206 | "viz": false 207 | }, 208 | "lineInterpolation": "linear", 209 | "lineWidth": 1, 210 | "pointSize": 5, 211 | "scaleDistribution": { 212 | "type": "linear" 213 | }, 214 | "showPoints": "never", 215 | "spanNulls": false, 216 | "stacking": { 217 | "group": "A", 218 | "mode": "none" 219 | }, 220 | "thresholdsStyle": { 221 | "mode": "off" 222 | } 223 | }, 224 | "mappings": [], 225 | "thresholds": { 226 | "mode": "absolute", 227 | "steps": [ 228 | { 229 | "color": "green", 230 | "value": null 231 | }, 232 | { 233 | "color": "red", 234 | "value": 80 235 | } 236 | ] 237 | }, 238 | "unit": "reqps" 239 | }, 240 | "overrides": [] 241 | }, 242 | "gridPos": { 243 | "h": 6, 244 | "w": 12, 245 | "x": 0, 246 | "y": 3 247 | }, 248 | "id": 74, 249 | "options": { 250 | "legend": { 251 | "calcs": [ 252 | "lastNotNull" 253 | ], 254 | "displayMode": "table", 255 | "placement": "right" 256 | }, 257 | "tooltip": { 258 | "mode": "single" 259 | } 260 | }, 261 | "targets": [ 262 | { 263 | "alias": "", 264 | "bucketAggs": [ 265 | { 266 | "field": "ts", 267 | "id": "2", 268 | "settings": { 269 | "interval": "auto" 270 | }, 271 | "type": "date_histogram" 272 | } 273 | ], 274 | "datasource": { 275 | "type": "prometheus", 276 | "uid": "PBFA97CFB590B2093" 277 | }, 278 | "exemplar": true, 279 | "expr": "sum(rate(perf_request_count[$__rate_interval])) by (threads)", 280 | "interval": "", 281 | "legendFormat": "{{threads}}", 282 | "metrics": [ 283 | { 284 | "id": "1", 285 | "type": "count" 286 | } 287 | ], 288 | "query": "", 289 | "refId": "A", 290 | "timeField": "ts" 291 | } 292 | ], 293 | "title": "Perf Test", 294 | "type": "timeseries" 295 | }, 296 | { 297 | "datasource": { 298 | "type": "prometheus", 299 | "uid": "PBFA97CFB590B2093" 300 | }, 301 | "fieldConfig": { 302 | "defaults": { 303 | "color": { 304 | "mode": "palette-classic" 305 | }, 306 | "custom": { 307 | "axisLabel": "", 308 | "axisPlacement": "auto", 309 | "barAlignment": 0, 310 | "drawStyle": "line", 311 | "fillOpacity": 22, 312 | "gradientMode": "none", 313 | "hideFrom": { 314 | "legend": false, 315 | "tooltip": false, 316 | "viz": false 317 | }, 318 | "lineInterpolation": "linear", 319 | "lineWidth": 1, 320 | "pointSize": 5, 321 | "scaleDistribution": { 322 | "type": "linear" 323 | }, 324 | "showPoints": "never", 325 | "spanNulls": false, 326 | "stacking": { 327 | "group": "A", 328 | "mode": "none" 329 | }, 330 | "thresholdsStyle": { 331 | "mode": "off" 332 | } 333 | }, 334 | "mappings": [], 335 | "thresholds": { 336 | "mode": "absolute", 337 | "steps": [ 338 | { 339 | "color": "green", 340 | "value": null 341 | }, 342 | { 343 | "color": "red", 344 | "value": 80 345 | } 346 | ] 347 | }, 348 | "unit": "reqps" 349 | }, 350 | "overrides": [] 351 | }, 352 | "gridPos": { 353 | "h": 6, 354 | "w": 12, 355 | "x": 12, 356 | "y": 3 357 | }, 358 | "id": 28, 359 | "options": { 360 | "legend": { 361 | "calcs": [ 362 | "lastNotNull" 363 | ], 364 | "displayMode": "table", 365 | "placement": "right" 366 | }, 367 | "tooltip": { 368 | "mode": "single" 369 | } 370 | }, 371 | "targets": [ 372 | { 373 | "datasource": { 374 | "type": "prometheus", 375 | "uid": "PBFA97CFB590B2093" 376 | }, 377 | "exemplar": true, 378 | "expr": "sum(rate(aidbox_http_request_duration_seconds_count[$__rate_interval]))", 379 | "instant": false, 380 | "interval": "", 381 | "legendFormat": "box req", 382 | "refId": "A" 383 | }, 384 | { 385 | "datasource": { 386 | "type": "prometheus", 387 | "uid": "PBFA97CFB590B2093" 388 | }, 389 | "exemplar": true, 390 | "expr": "sum(rate(aidbox_http_request_duration_seconds_bucket{le=\"+Inf\"} [$__rate_interval])) - sum(rate(aidbox_http_request_duration_seconds_bucket{le=\"0.5\"} [$__rate_interval]))", 391 | "hide": false, 392 | "instant": false, 393 | "interval": "", 394 | "legendFormat": "> 0.5 sec", 395 | "refId": "B" 396 | }, 397 | { 398 | "datasource": { 399 | "type": "prometheus", 400 | "uid": "PBFA97CFB590B2093" 401 | }, 402 | "exemplar": true, 403 | "expr": "rate(pg_requests_total[$__rate_interval])", 404 | "hide": false, 405 | "interval": "", 406 | "legendFormat": "db req", 407 | "refId": "C" 408 | } 409 | ], 410 | "title": "requests", 411 | "type": "timeseries" 412 | }, 413 | { 414 | "datasource": { 415 | "type": "prometheus", 416 | "uid": "PBFA97CFB590B2093" 417 | }, 418 | "fieldConfig": { 419 | "defaults": { 420 | "color": { 421 | "mode": "palette-classic" 422 | }, 423 | "custom": { 424 | "axisLabel": "", 425 | "axisPlacement": "auto", 426 | "barAlignment": 0, 427 | "drawStyle": "line", 428 | "fillOpacity": 15, 429 | "gradientMode": "none", 430 | "hideFrom": { 431 | "legend": false, 432 | "tooltip": false, 433 | "viz": false 434 | }, 435 | "lineInterpolation": "linear", 436 | "lineWidth": 1, 437 | "pointSize": 5, 438 | "scaleDistribution": { 439 | "type": "linear" 440 | }, 441 | "showPoints": "never", 442 | "spanNulls": false, 443 | "stacking": { 444 | "group": "A", 445 | "mode": "none" 446 | }, 447 | "thresholdsStyle": { 448 | "mode": "off" 449 | } 450 | }, 451 | "mappings": [], 452 | "thresholds": { 453 | "mode": "absolute", 454 | "steps": [ 455 | { 456 | "color": "green", 457 | "value": null 458 | }, 459 | { 460 | "color": "red", 461 | "value": 1 462 | } 463 | ] 464 | }, 465 | "unit": "s" 466 | }, 467 | "overrides": [] 468 | }, 469 | "gridPos": { 470 | "h": 6, 471 | "w": 12, 472 | "x": 0, 473 | "y": 9 474 | }, 475 | "id": 77, 476 | "options": { 477 | "legend": { 478 | "calcs": [ 479 | "lastNotNull" 480 | ], 481 | "displayMode": "table", 482 | "placement": "right" 483 | }, 484 | "tooltip": { 485 | "mode": "single" 486 | } 487 | }, 488 | "targets": [ 489 | { 490 | "datasource": { 491 | "type": "prometheus", 492 | "uid": "PBFA97CFB590B2093" 493 | }, 494 | "exemplar": true, 495 | "expr": "histogram_quantile(0.99, sum(rate(perf_request_duration_bucket[$__rate_interval])) by (le))", 496 | "interval": "", 497 | "legendFormat": "99", 498 | "refId": "A" 499 | }, 500 | { 501 | "datasource": { 502 | "type": "prometheus", 503 | "uid": "PBFA97CFB590B2093" 504 | }, 505 | "exemplar": true, 506 | "expr": "histogram_quantile(0.95, sum(rate(perf_request_duration_bucket[$__rate_interval])) by (le))", 507 | "hide": false, 508 | "interval": "", 509 | "legendFormat": "95", 510 | "refId": "D" 511 | }, 512 | { 513 | "datasource": { 514 | "type": "prometheus", 515 | "uid": "PBFA97CFB590B2093" 516 | }, 517 | "exemplar": true, 518 | "expr": "histogram_quantile(0.75, sum(rate(perf_request_duration_bucket[$__rate_interval])) by (le))", 519 | "hide": false, 520 | "interval": "", 521 | "legendFormat": "75", 522 | "refId": "C" 523 | }, 524 | { 525 | "datasource": { 526 | "type": "prometheus", 527 | "uid": "PBFA97CFB590B2093" 528 | }, 529 | "exemplar": true, 530 | "expr": "sum(rate(perf_request_duration_sum[$__rate_interval]))/sum(rate(perf_request_duration_count[$__rate_interval]))", 531 | "hide": false, 532 | "interval": "", 533 | "legendFormat": "avg", 534 | "refId": "E" 535 | } 536 | ], 537 | "title": "Perf Test Duration", 538 | "type": "timeseries" 539 | }, 540 | { 541 | "datasource": { 542 | "type": "prometheus", 543 | "uid": "PBFA97CFB590B2093" 544 | }, 545 | "fieldConfig": { 546 | "defaults": { 547 | "color": { 548 | "mode": "palette-classic" 549 | }, 550 | "custom": { 551 | "axisLabel": "", 552 | "axisPlacement": "auto", 553 | "barAlignment": 0, 554 | "drawStyle": "line", 555 | "fillOpacity": 15, 556 | "gradientMode": "none", 557 | "hideFrom": { 558 | "legend": false, 559 | "tooltip": false, 560 | "viz": false 561 | }, 562 | "lineInterpolation": "linear", 563 | "lineWidth": 1, 564 | "pointSize": 5, 565 | "scaleDistribution": { 566 | "type": "linear" 567 | }, 568 | "showPoints": "never", 569 | "spanNulls": false, 570 | "stacking": { 571 | "group": "A", 572 | "mode": "none" 573 | }, 574 | "thresholdsStyle": { 575 | "mode": "off" 576 | } 577 | }, 578 | "mappings": [], 579 | "thresholds": { 580 | "mode": "absolute", 581 | "steps": [ 582 | { 583 | "color": "green", 584 | "value": null 585 | }, 586 | { 587 | "color": "red", 588 | "value": 1 589 | } 590 | ] 591 | }, 592 | "unit": "s" 593 | }, 594 | "overrides": [] 595 | }, 596 | "gridPos": { 597 | "h": 6, 598 | "w": 12, 599 | "x": 12, 600 | "y": 9 601 | }, 602 | "id": 30, 603 | "options": { 604 | "legend": { 605 | "calcs": [ 606 | "lastNotNull" 607 | ], 608 | "displayMode": "table", 609 | "placement": "right" 610 | }, 611 | "tooltip": { 612 | "mode": "single" 613 | } 614 | }, 615 | "targets": [ 616 | { 617 | "exemplar": true, 618 | "expr": "histogram_quantile(0.99, sum(rate(aidbox_http_request_duration_seconds_bucket[1m])) by (le))", 619 | "interval": "", 620 | "legendFormat": "99", 621 | "refId": "A" 622 | }, 623 | { 624 | "exemplar": true, 625 | "expr": "histogram_quantile(0.95, sum(rate(aidbox_http_request_duration_seconds_bucket[1m])) by (le))", 626 | "hide": true, 627 | "interval": "", 628 | "legendFormat": "95", 629 | "refId": "D" 630 | }, 631 | { 632 | "exemplar": true, 633 | "expr": "histogram_quantile(0.75, sum(rate(aidbox_http_request_duration_seconds_bucket[1m])) by (le))", 634 | "hide": true, 635 | "interval": "", 636 | "legendFormat": "75", 637 | "refId": "C" 638 | }, 639 | { 640 | "exemplar": true, 641 | "expr": "histogram_quantile(0.50, sum(rate(aidbox_http_request_duration_seconds_bucket[1m])) by (le))", 642 | "hide": true, 643 | "interval": "", 644 | "legendFormat": "50", 645 | "refId": "B" 646 | }, 647 | { 648 | "exemplar": true, 649 | "expr": "sum(rate(aidbox_http_request_duration_seconds_sum[1m]))/sum(rate(aidbox_http_request_duration_seconds_count[1m]))", 650 | "hide": false, 651 | "interval": "", 652 | "legendFormat": "box avg", 653 | "refId": "E" 654 | }, 655 | { 656 | "exemplar": true, 657 | "expr": "rate(pg_requests_duration_seconds_sum[1m])/rate(pg_requests_total[1m])", 658 | "hide": false, 659 | "interval": "", 660 | "legendFormat": "db avg", 661 | "refId": "F" 662 | }, 663 | { 664 | "exemplar": true, 665 | "expr": "histogram_quantile(0.99, sum(rate(aidbox_http_request_wait_seconds_bucket[1m])) by (le))", 666 | "hide": false, 667 | "interval": "", 668 | "legendFormat": "wait99", 669 | "refId": "G" 670 | }, 671 | { 672 | "exemplar": true, 673 | "expr": "histogram_quantile(0.75, sum(rate(aidbox_http_request_wait_seconds_bucket[1m])) by (le))", 674 | "hide": false, 675 | "interval": "", 676 | "legendFormat": "wait75", 677 | "refId": "H" 678 | }, 679 | { 680 | "exemplar": true, 681 | "expr": "rate(hikari_acquire_wait_seconds_sum[1m])/rate(hikari_acquire_wait_seconds_count[1m])", 682 | "hide": false, 683 | "interval": "", 684 | "legendFormat": "hikari wait", 685 | "refId": "I" 686 | } 687 | ], 688 | "title": "duration", 689 | "type": "timeseries" 690 | }, 691 | { 692 | "datasource": { 693 | "type": "prometheus", 694 | "uid": "PBFA97CFB590B2093" 695 | }, 696 | "fieldConfig": { 697 | "defaults": { 698 | "color": { 699 | "mode": "palette-classic" 700 | }, 701 | "custom": { 702 | "axisLabel": "", 703 | "axisPlacement": "auto", 704 | "barAlignment": 0, 705 | "drawStyle": "line", 706 | "fillOpacity": 10, 707 | "gradientMode": "none", 708 | "hideFrom": { 709 | "legend": false, 710 | "tooltip": false, 711 | "viz": false 712 | }, 713 | "lineInterpolation": "linear", 714 | "lineWidth": 1, 715 | "pointSize": 5, 716 | "scaleDistribution": { 717 | "type": "linear" 718 | }, 719 | "showPoints": "never", 720 | "spanNulls": false, 721 | "stacking": { 722 | "group": "A", 723 | "mode": "none" 724 | }, 725 | "thresholdsStyle": { 726 | "mode": "off" 727 | } 728 | }, 729 | "mappings": [], 730 | "thresholds": { 731 | "mode": "absolute", 732 | "steps": [ 733 | { 734 | "color": "green", 735 | "value": null 736 | }, 737 | { 738 | "color": "red", 739 | "value": 80 740 | } 741 | ] 742 | }, 743 | "unit": "reqps" 744 | }, 745 | "overrides": [] 746 | }, 747 | "gridPos": { 748 | "h": 5, 749 | "w": 12, 750 | "x": 0, 751 | "y": 15 752 | }, 753 | "id": 80, 754 | "options": { 755 | "legend": { 756 | "calcs": [], 757 | "displayMode": "table", 758 | "placement": "right" 759 | }, 760 | "tooltip": { 761 | "mode": "single" 762 | } 763 | }, 764 | "targets": [ 765 | { 766 | "datasource": { 767 | "type": "prometheus", 768 | "uid": "PBFA97CFB590B2093" 769 | }, 770 | "exemplar": true, 771 | "expr": "sum(rate(perf_request_duration_count{status!~'2..'}[$__range])) by (status)", 772 | "interval": "", 773 | "legendFormat": "{{status}}", 774 | "refId": "A" 775 | } 776 | ], 777 | "title": "Perf Errors", 778 | "type": "timeseries" 779 | }, 780 | { 781 | "datasource": { 782 | "type": "prometheus", 783 | "uid": "PBFA97CFB590B2093" 784 | }, 785 | "fieldConfig": { 786 | "defaults": { 787 | "color": { 788 | "mode": "palette-classic" 789 | }, 790 | "custom": { 791 | "axisLabel": "", 792 | "axisPlacement": "auto", 793 | "barAlignment": 0, 794 | "drawStyle": "line", 795 | "fillOpacity": 17, 796 | "gradientMode": "none", 797 | "hideFrom": { 798 | "legend": false, 799 | "tooltip": false, 800 | "viz": false 801 | }, 802 | "lineInterpolation": "linear", 803 | "lineWidth": 1, 804 | "pointSize": 5, 805 | "scaleDistribution": { 806 | "type": "linear" 807 | }, 808 | "showPoints": "never", 809 | "spanNulls": false, 810 | "stacking": { 811 | "group": "A", 812 | "mode": "none" 813 | }, 814 | "thresholdsStyle": { 815 | "mode": "off" 816 | } 817 | }, 818 | "mappings": [], 819 | "thresholds": { 820 | "mode": "absolute", 821 | "steps": [ 822 | { 823 | "color": "dark-red", 824 | "value": null 825 | }, 826 | { 827 | "color": "red", 828 | "value": 10 829 | } 830 | ] 831 | } 832 | }, 833 | "overrides": [] 834 | }, 835 | "gridPos": { 836 | "h": 5, 837 | "w": 12, 838 | "x": 12, 839 | "y": 15 840 | }, 841 | "id": 36, 842 | "options": { 843 | "legend": { 844 | "calcs": [ 845 | "lastNotNull" 846 | ], 847 | "displayMode": "table", 848 | "placement": "right" 849 | }, 850 | "tooltip": { 851 | "mode": "single" 852 | } 853 | }, 854 | "targets": [ 855 | { 856 | "exemplar": true, 857 | "expr": "sum(rate(aidbox_http_request_duration_seconds_count{status=~\"4..\"}[5m]))", 858 | "hide": true, 859 | "interval": "", 860 | "legendFormat": "4xx", 861 | "refId": "A" 862 | }, 863 | { 864 | "exemplar": true, 865 | "expr": "sum(rate(aidbox_http_request_duration_seconds_count{status=~\"5..\"}[5m]))", 866 | "hide": false, 867 | "interval": "", 868 | "legendFormat": "5xx", 869 | "refId": "B" 870 | }, 871 | { 872 | "exemplar": true, 873 | "expr": "rate(hikari_timeout_total[5m])", 874 | "hide": false, 875 | "interval": "", 876 | "legendFormat": "db conn err", 877 | "refId": "C" 878 | }, 879 | { 880 | "hide": false, 881 | "refId": "D" 882 | } 883 | ], 884 | "title": "errors", 885 | "type": "timeseries" 886 | }, 887 | { 888 | "datasource": { 889 | "type": "prometheus", 890 | "uid": "PBFA97CFB590B2093" 891 | }, 892 | "fieldConfig": { 893 | "defaults": { 894 | "color": { 895 | "mode": "palette-classic" 896 | }, 897 | "custom": { 898 | "hideFrom": { 899 | "legend": false, 900 | "tooltip": false, 901 | "viz": false 902 | } 903 | }, 904 | "mappings": [], 905 | "unit": "s" 906 | }, 907 | "overrides": [] 908 | }, 909 | "gridPos": { 910 | "h": 5, 911 | "w": 6, 912 | "x": 0, 913 | "y": 20 914 | }, 915 | "id": 81, 916 | "options": { 917 | "legend": { 918 | "displayMode": "table", 919 | "placement": "right", 920 | "values": [ 921 | "percent", 922 | "value" 923 | ] 924 | }, 925 | "pieType": "donut", 926 | "reduceOptions": { 927 | "calcs": [ 928 | "lastNotNull" 929 | ], 930 | "fields": "", 931 | "values": false 932 | }, 933 | "tooltip": { 934 | "mode": "single" 935 | } 936 | }, 937 | "targets": [ 938 | { 939 | "datasource": { 940 | "type": "prometheus", 941 | "uid": "PBFA97CFB590B2093" 942 | }, 943 | "exemplar": true, 944 | "expr": "topk(10, rate( perf_request_duration_sum{acount=~'.+'}[$__interval])/rate( perf_request_duration_count [$__interval]))", 945 | "interval": "", 946 | "legendFormat": "{{acount}}", 947 | "refId": "A" 948 | } 949 | ], 950 | "title": "req mean dist", 951 | "type": "piechart" 952 | }, 953 | { 954 | "datasource": { 955 | "type": "prometheus", 956 | "uid": "PBFA97CFB590B2093" 957 | }, 958 | "fieldConfig": { 959 | "defaults": { 960 | "color": { 961 | "mode": "palette-classic" 962 | }, 963 | "custom": { 964 | "hideFrom": { 965 | "legend": false, 966 | "tooltip": false, 967 | "viz": false 968 | } 969 | }, 970 | "mappings": [] 971 | }, 972 | "overrides": [] 973 | }, 974 | "gridPos": { 975 | "h": 5, 976 | "w": 6, 977 | "x": 6, 978 | "y": 20 979 | }, 980 | "id": 82, 981 | "options": { 982 | "legend": { 983 | "displayMode": "list", 984 | "placement": "right", 985 | "values": [ 986 | "percent" 987 | ] 988 | }, 989 | "pieType": "donut", 990 | "reduceOptions": { 991 | "calcs": [ 992 | "lastNotNull" 993 | ], 994 | "fields": "", 995 | "values": false 996 | }, 997 | "tooltip": { 998 | "mode": "single" 999 | } 1000 | }, 1001 | "targets": [ 1002 | { 1003 | "datasource": { 1004 | "type": "prometheus", 1005 | "uid": "PBFA97CFB590B2093" 1006 | }, 1007 | "exemplar": true, 1008 | "expr": "topk(30, rate( perf_request_duration_sum [$__range]))", 1009 | "interval": "", 1010 | "legendFormat": "{{acount}}", 1011 | "refId": "A" 1012 | } 1013 | ], 1014 | "title": "request dist", 1015 | "type": "piechart" 1016 | }, 1017 | { 1018 | "datasource": { 1019 | "type": "prometheus", 1020 | "uid": "PBFA97CFB590B2093" 1021 | }, 1022 | "fieldConfig": { 1023 | "defaults": { 1024 | "color": { 1025 | "mode": "palette-classic" 1026 | }, 1027 | "custom": { 1028 | "hideFrom": { 1029 | "legend": false, 1030 | "tooltip": false, 1031 | "viz": false 1032 | } 1033 | }, 1034 | "mappings": [], 1035 | "unit": "s" 1036 | }, 1037 | "overrides": [] 1038 | }, 1039 | "gridPos": { 1040 | "h": 5, 1041 | "w": 5, 1042 | "x": 12, 1043 | "y": 20 1044 | }, 1045 | "id": 70, 1046 | "options": { 1047 | "legend": { 1048 | "displayMode": "table", 1049 | "placement": "right", 1050 | "values": [ 1051 | "percent", 1052 | "value" 1053 | ] 1054 | }, 1055 | "pieType": "donut", 1056 | "reduceOptions": { 1057 | "calcs": [ 1058 | "lastNotNull" 1059 | ], 1060 | "fields": "", 1061 | "values": false 1062 | }, 1063 | "tooltip": { 1064 | "mode": "single" 1065 | } 1066 | }, 1067 | "targets": [ 1068 | { 1069 | "datasource": { 1070 | "type": "prometheus", 1071 | "uid": "PBFA97CFB590B2093" 1072 | }, 1073 | "exemplar": true, 1074 | "expr": "topk(10, rate(aidbox_http_request_duration_seconds_sum[$__interval])/rate(aidbox_http_request_duration_seconds_count[$__interval]))", 1075 | "interval": "", 1076 | "legendFormat": "{{route}}", 1077 | "refId": "A" 1078 | } 1079 | ], 1080 | "title": "req mean dist", 1081 | "type": "piechart" 1082 | }, 1083 | { 1084 | "datasource": { 1085 | "type": "prometheus", 1086 | "uid": "PBFA97CFB590B2093" 1087 | }, 1088 | "fieldConfig": { 1089 | "defaults": { 1090 | "color": { 1091 | "mode": "palette-classic" 1092 | }, 1093 | "custom": { 1094 | "hideFrom": { 1095 | "legend": false, 1096 | "tooltip": false, 1097 | "viz": false 1098 | } 1099 | }, 1100 | "mappings": [] 1101 | }, 1102 | "overrides": [] 1103 | }, 1104 | "gridPos": { 1105 | "h": 5, 1106 | "w": 4, 1107 | "x": 17, 1108 | "y": 20 1109 | }, 1110 | "id": 68, 1111 | "options": { 1112 | "legend": { 1113 | "displayMode": "list", 1114 | "placement": "right", 1115 | "values": [ 1116 | "percent" 1117 | ] 1118 | }, 1119 | "pieType": "donut", 1120 | "reduceOptions": { 1121 | "calcs": [ 1122 | "lastNotNull" 1123 | ], 1124 | "fields": "", 1125 | "values": false 1126 | }, 1127 | "tooltip": { 1128 | "mode": "single" 1129 | } 1130 | }, 1131 | "targets": [ 1132 | { 1133 | "datasource": { 1134 | "type": "prometheus", 1135 | "uid": "PBFA97CFB590B2093" 1136 | }, 1137 | "exemplar": true, 1138 | "expr": "topk(30, rate(aidbox_http_request_duration_seconds_sum[$__range]))", 1139 | "interval": "", 1140 | "legendFormat": "{{route}}", 1141 | "refId": "A" 1142 | } 1143 | ], 1144 | "title": "request dist", 1145 | "type": "piechart" 1146 | }, 1147 | { 1148 | "datasource": { 1149 | "type": "prometheus", 1150 | "uid": "PBFA97CFB590B2093" 1151 | }, 1152 | "fieldConfig": { 1153 | "defaults": { 1154 | "color": { 1155 | "mode": "palette-classic" 1156 | }, 1157 | "custom": { 1158 | "hideFrom": { 1159 | "legend": false, 1160 | "tooltip": false, 1161 | "viz": false 1162 | } 1163 | }, 1164 | "mappings": [] 1165 | }, 1166 | "overrides": [] 1167 | }, 1168 | "gridPos": { 1169 | "h": 5, 1170 | "w": 3, 1171 | "x": 21, 1172 | "y": 20 1173 | }, 1174 | "id": 72, 1175 | "options": { 1176 | "legend": { 1177 | "displayMode": "table", 1178 | "placement": "right", 1179 | "values": [ 1180 | "percent" 1181 | ] 1182 | }, 1183 | "pieType": "donut", 1184 | "reduceOptions": { 1185 | "calcs": [ 1186 | "lastNotNull" 1187 | ], 1188 | "fields": "", 1189 | "values": false 1190 | }, 1191 | "tooltip": { 1192 | "mode": "single" 1193 | } 1194 | }, 1195 | "targets": [ 1196 | { 1197 | "exemplar": true, 1198 | "expr": "sum(rate(aidbox_http_request_duration_seconds_count[30m])) by (status)", 1199 | "interval": "", 1200 | "legendFormat": "{{status}}", 1201 | "refId": "A" 1202 | } 1203 | ], 1204 | "title": "resp statuses", 1205 | "type": "piechart" 1206 | }, 1207 | { 1208 | "datasource": { 1209 | "type": "prometheus", 1210 | "uid": "PBFA97CFB590B2093" 1211 | }, 1212 | "fieldConfig": { 1213 | "defaults": { 1214 | "color": { 1215 | "mode": "palette-classic" 1216 | }, 1217 | "custom": { 1218 | "axisLabel": "", 1219 | "axisPlacement": "auto", 1220 | "barAlignment": 0, 1221 | "drawStyle": "line", 1222 | "fillOpacity": 26, 1223 | "gradientMode": "none", 1224 | "hideFrom": { 1225 | "legend": false, 1226 | "tooltip": false, 1227 | "viz": false 1228 | }, 1229 | "lineInterpolation": "linear", 1230 | "lineWidth": 1, 1231 | "pointSize": 5, 1232 | "scaleDistribution": { 1233 | "type": "linear" 1234 | }, 1235 | "showPoints": "never", 1236 | "spanNulls": false, 1237 | "stacking": { 1238 | "group": "A", 1239 | "mode": "none" 1240 | }, 1241 | "thresholdsStyle": { 1242 | "mode": "off" 1243 | } 1244 | }, 1245 | "mappings": [], 1246 | "thresholds": { 1247 | "mode": "absolute", 1248 | "steps": [ 1249 | { 1250 | "color": "green", 1251 | "value": null 1252 | }, 1253 | { 1254 | "color": "red", 1255 | "value": 80 1256 | } 1257 | ] 1258 | } 1259 | }, 1260 | "overrides": [] 1261 | }, 1262 | "gridPos": { 1263 | "h": 5, 1264 | "w": 4, 1265 | "x": 12, 1266 | "y": 25 1267 | }, 1268 | "id": 24, 1269 | "options": { 1270 | "legend": { 1271 | "calcs": [ 1272 | "lastNotNull" 1273 | ], 1274 | "displayMode": "table", 1275 | "placement": "right" 1276 | }, 1277 | "tooltip": { 1278 | "mode": "single" 1279 | } 1280 | }, 1281 | "targets": [ 1282 | { 1283 | "exemplar": true, 1284 | "expr": "jvm_thread_count", 1285 | "interval": "", 1286 | "legendFormat": "threads", 1287 | "refId": "A" 1288 | }, 1289 | { 1290 | "exemplar": true, 1291 | "expr": "jvm_thread_peak_count", 1292 | "hide": false, 1293 | "instant": false, 1294 | "interval": "", 1295 | "intervalFactor": 1, 1296 | "legendFormat": "threads peak", 1297 | "refId": "B" 1298 | }, 1299 | { 1300 | "exemplar": true, 1301 | "expr": "jvm_thread_daemon_count", 1302 | "hide": false, 1303 | "interval": "", 1304 | "legendFormat": "daemon", 1305 | "refId": "C" 1306 | } 1307 | ], 1308 | "title": "jvm threads", 1309 | "type": "timeseries" 1310 | }, 1311 | { 1312 | "datasource": { 1313 | "type": "prometheus", 1314 | "uid": "PBFA97CFB590B2093" 1315 | }, 1316 | "fieldConfig": { 1317 | "defaults": { 1318 | "color": { 1319 | "mode": "palette-classic" 1320 | }, 1321 | "custom": { 1322 | "axisLabel": "", 1323 | "axisPlacement": "auto", 1324 | "barAlignment": 0, 1325 | "drawStyle": "line", 1326 | "fillOpacity": 22, 1327 | "gradientMode": "none", 1328 | "hideFrom": { 1329 | "legend": false, 1330 | "tooltip": false, 1331 | "viz": false 1332 | }, 1333 | "lineInterpolation": "linear", 1334 | "lineWidth": 1, 1335 | "pointSize": 5, 1336 | "scaleDistribution": { 1337 | "type": "linear" 1338 | }, 1339 | "showPoints": "never", 1340 | "spanNulls": false, 1341 | "stacking": { 1342 | "group": "A", 1343 | "mode": "none" 1344 | }, 1345 | "thresholdsStyle": { 1346 | "mode": "off" 1347 | } 1348 | }, 1349 | "mappings": [], 1350 | "thresholds": { 1351 | "mode": "absolute", 1352 | "steps": [ 1353 | { 1354 | "color": "green", 1355 | "value": null 1356 | }, 1357 | { 1358 | "color": "red", 1359 | "value": 80 1360 | } 1361 | ] 1362 | }, 1363 | "unit": "bytes" 1364 | }, 1365 | "overrides": [] 1366 | }, 1367 | "gridPos": { 1368 | "h": 5, 1369 | "w": 5, 1370 | "x": 16, 1371 | "y": 25 1372 | }, 1373 | "id": 2, 1374 | "options": { 1375 | "legend": { 1376 | "calcs": [ 1377 | "lastNotNull" 1378 | ], 1379 | "displayMode": "table", 1380 | "placement": "right" 1381 | }, 1382 | "tooltip": { 1383 | "mode": "single" 1384 | } 1385 | }, 1386 | "targets": [ 1387 | { 1388 | "exemplar": true, 1389 | "expr": "jvm_heap_memory", 1390 | "interval": "", 1391 | "legendFormat": "heap", 1392 | "refId": "A" 1393 | }, 1394 | { 1395 | "exemplar": true, 1396 | "expr": "jvm_non_heap_memory", 1397 | "hide": false, 1398 | "interval": "", 1399 | "legendFormat": "non-heap", 1400 | "refId": "B" 1401 | } 1402 | ], 1403 | "title": "JVM Memory", 1404 | "type": "timeseries" 1405 | } 1406 | ], 1407 | "refresh": "5s", 1408 | "schemaVersion": 33, 1409 | "style": "dark", 1410 | "tags": [], 1411 | "templating": { 1412 | "list": [] 1413 | }, 1414 | "time": { 1415 | "from": "now-30m", 1416 | "to": "now" 1417 | }, 1418 | "timepicker": {}, 1419 | "timezone": "", 1420 | "title": "Performance Metrics (Aidbox)", 1421 | "uid": "aidbox-perf-test-aidbox", 1422 | "version": 3, 1423 | "weekStart": "" 1424 | } 1425 | -------------------------------------------------------------------------------- /audit/grafana/provisioning/datasources/all.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | datasources: 4 | - name: aidbox-logs 5 | type: elasticsearch 6 | access: proxy 7 | database: "*" 8 | url: http://es:9200 9 | jsonData: 10 | interval: Daily 11 | timeField: "ts" 12 | esVersion: "7.0.0" 13 | logMessageField: message 14 | logLevelField: fields.level 15 | - name: Prometheus 16 | # uid: prom 17 | type: prometheus 18 | access: proxy 19 | database: "*" 20 | url: http://prometheus:9090 21 | -------------------------------------------------------------------------------- /audit/kibana/kibana.yml: -------------------------------------------------------------------------------- 1 | # Kibana is served by a back end server. This setting specifies the port to use. 2 | # server.port: 5601 3 | 4 | # Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values. 5 | # The default is 'localhost', which usually means remote machines will not be able to connect. 6 | # To allow connections from remote users, set this parameter to a non-loopback address. 7 | #server.host: "localhost" 8 | 9 | # Enables you to specify a path to mount Kibana at if you are running behind a proxy. 10 | # Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath 11 | # from requests it receives, and to prevent a deprecation warning at startup. 12 | # This setting cannot end in a slash. 13 | #server.basePath: "" 14 | 15 | # Specifies whether Kibana should rewrite requests that are prefixed with 16 | # `server.basePath` or require that they are rewritten by your reverse proxy. 17 | # This setting was effectively always `false` before Kibana 6.3 and will 18 | # default to `true` starting in Kibana 7.0. 19 | #server.rewriteBasePath: false 20 | 21 | # Specifies the public URL at which Kibana is available for end users. If 22 | # `server.basePath` is configured this URL should end with the same basePath. 23 | #server.publicBaseUrl: "" 24 | 25 | # The maximum payload size in bytes for incoming server requests. 26 | #server.maxPayload: 1048576 27 | 28 | # The Kibana server's name. This is used for display purposes. 29 | server.name: "aidbox" 30 | 31 | # The URLs of the Elasticsearch instances to use for all your queries. 32 | elasticsearch.hosts: ["http://elasticsearch:9200"] 33 | 34 | # Kibana uses an index in Elasticsearch to store saved searches, visualizations and 35 | # dashboards. Kibana creates a new index if the index doesn't already exist. 36 | #kibana.index: ".kibana" 37 | 38 | # If your Elasticsearch is protected with basic authentication, these settings provide 39 | # the username and password that the Kibana server uses to perform maintenance on the Kibana 40 | # index at startup. Your Kibana users still need to authenticate with Elasticsearch, which 41 | # is proxied through the Kibana server. 42 | #elasticsearch.username: "kibana_system" 43 | #elasticsearch.password: "pass" 44 | 45 | # Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively. 46 | # These settings enable SSL for outgoing requests from the Kibana server to the browser. 47 | #server.ssl.enabled: false 48 | #server.ssl.certificate: /path/to/your/server.crt 49 | #server.ssl.key: /path/to/your/server.key 50 | 51 | # Optional settings that provide the paths to the PEM-format SSL certificate and key files. 52 | # These files are used to verify the identity of Kibana to Elasticsearch and are required when 53 | # xpack.security.http.ssl.client_authentication in Elasticsearch is set to required. 54 | #elasticsearch.ssl.certificate: /path/to/your/client.crt 55 | #elasticsearch.ssl.key: /path/to/your/client.key 56 | 57 | # Optional setting that enables you to specify a path to the PEM file for the certificate 58 | # authority for your Elasticsearch instance. 59 | #elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ] 60 | 61 | # To disregard the validity of SSL certificates, change this setting's value to 'none'. 62 | #elasticsearch.ssl.verificationMode: full 63 | 64 | # Time in milliseconds to wait for Elasticsearch to respond to pings. Defaults to the value of 65 | # the elasticsearch.requestTimeout setting. 66 | #elasticsearch.pingTimeout: 1500 67 | 68 | # Time in milliseconds to wait for responses from the back end or Elasticsearch. This value 69 | # must be a positive integer. 70 | #elasticsearch.requestTimeout: 30000 71 | 72 | # List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side 73 | # headers, set this value to [] (an empty list). 74 | #elasticsearch.requestHeadersWhitelist: [ authorization ] 75 | 76 | # Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten 77 | # by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration. 78 | #elasticsearch.customHeaders: {} 79 | 80 | # Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable. 81 | #elasticsearch.shardTimeout: 30000 82 | 83 | # Logs queries sent to Elasticsearch. Requires logging.verbose set to true. 84 | #elasticsearch.logQueries: false 85 | 86 | # Specifies the path where Kibana creates the process ID file. 87 | #pid.file: /run/kibana/kibana.pid 88 | 89 | # Enables you to specify a file where Kibana stores log output. 90 | #logging.dest: stdout 91 | 92 | # Set the value of this setting to true to suppress all logging output. 93 | #logging.silent: false 94 | 95 | # Set the value of this setting to true to suppress all logging output other than error messages. 96 | #logging.quiet: false 97 | 98 | # Set the value of this setting to true to log all events, including system usage information 99 | # and all requests. 100 | #logging.verbose: false 101 | 102 | # Set the interval in milliseconds to sample system and process performance 103 | # metrics. Minimum is 100ms. Defaults to 5000. 104 | #ops.interval: 5000 105 | 106 | # Specifies locale to be used for all localizable strings, dates and number formats. 107 | # Supported languages are the following: English - en , by default , Chinese - zh-CN . 108 | #i18n.locale: "en" 109 | -------------------------------------------------------------------------------- /audit/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 15s # By default, scrape targets every 15 seconds. 3 | evaluation_interval: 15s # By default, scrape targets every 15 seconds. 4 | # scrape_timeout is set to the global default (10s). 5 | 6 | # Attach these labels to any time series or alerts when communicating with 7 | # external systems (federation, remote storage, Alertmanager). 8 | external_labels: 9 | monitor: 'aidbox' 10 | 11 | # A scrape configuration containing exactly one endpoint to scrape: 12 | # Here it's Prometheus itself. 13 | scrape_configs: 14 | # The job name is added as a label `job=` to any timeseries scraped from this config. 15 | 16 | - job_name: 'prometheus' 17 | 18 | # Override the global default and scrape targets from this job every 5 seconds. 19 | scrape_interval: 5s 20 | 21 | static_configs: 22 | - targets: [ 'localhost:9090' ] 23 | 24 | - job_name: pushgateway 25 | scrape_interval: 5s 26 | honor_labels: true 27 | static_configs: 28 | - targets: ['pushgateway:9091'] 29 | 30 | - job_name: aidbox 31 | scrape_interval: 5s 32 | metrics_path: /metrics 33 | static_configs: 34 | - targets: [ 'devbox:8889' ] 35 | 36 | - job_name: aidbox-minutes 37 | scrape_interval: 30s 38 | metrics_path: /metrics/minutes 39 | static_configs: 40 | - targets: [ 'devbox:8889' ] 41 | 42 | - job_name: aidbox-hours 43 | scrape_interval: 1m 44 | metrics_path: /metrics/hours 45 | static_configs: 46 | - targets: [ 'devbox:8889' ] 47 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.7' 2 | volumes: 3 | elastic-data: 4 | prometheus-data: 5 | grafana-data: 6 | 7 | services: 8 | devbox-db: 9 | image: "${PGIMAGE}" 10 | ports: 11 | - "${PGHOSTPORT}:${PGPORT}" 12 | volumes: 13 | - "./pgdata:/data" 14 | environment: 15 | POSTGRES_USER: "${PGUSER}" 16 | POSTGRES_PASSWORD: "${PGPASSWORD}" 17 | POSTGRES_DB: "${PGDATABASE}" 18 | 19 | devbox: 20 | image: "${AIDBOX_IMAGE}" 21 | depends_on: ["devbox-db", "es", "apm-server"] 22 | links: 23 | - "devbox-db:database" 24 | - es:es 25 | ports: 26 | - "${AIDBOX_PORT}:${AIDBOX_PORT}" 27 | env_file: 28 | - .env 29 | environment: 30 | PGHOST: database 31 | AIDBOX_ES_URL: "http://es:9200/" 32 | AIDBOX_ES_BATCH_SIZE: 10 33 | AIDBOX_ES_BATCH_TIMEOUT: 5000 34 | AIDBOX_ES_INDEX_PAT: "'aidbox-logs'-yyyy-MM-dd" 35 | BOX_METRICS_PORT: 8889 36 | ELASTIC_APM_SERVER_URLS: "http://apm-server:8200" 37 | 38 | pushgateway: 39 | image: prom/pushgateway 40 | restart: unless-stopped 41 | ports: 42 | - 9091:9091 43 | 44 | prometheus: 45 | image: prom/prometheus:v2.30.3 46 | env_file: 47 | - .env 48 | environment: 49 | V: 'v5' 50 | ports: 51 | - 9090:9090 52 | volumes: 53 | - ./audit/prometheus/:/etc/prometheus/:cached 54 | - prometheus-data:/prometheus 55 | command: 56 | - '--config.file=/etc/prometheus/prometheus.yml' 57 | - '--storage.tsdb.path=/prometheus' 58 | - '--web.enable-lifecycle' 59 | - '--web.console.libraries=/usr/share/prometheus/console_libraries' 60 | - '--web.console.templates=/usr/share/prometheus/consoles' 61 | depends_on: 62 | - pushgateway 63 | 64 | es: 65 | image: "docker.elastic.co/elasticsearch/elasticsearch:7.13.2" 66 | volumes: 67 | - "elastic-data:/usr/share/elasticsearch/data" 68 | environment: 69 | - cluster.name=aidbox 70 | - bootstrap.memory_lock=true 71 | - "ES_JAVA_OPTS=-Xms512m -Xmx512m" 72 | - discovery.type=single-node 73 | ulimits: 74 | memlock: 75 | soft: -1 76 | hard: -1 77 | ports: 78 | - "9200:9200" 79 | 80 | kibana: 81 | depends_on: 82 | - "es" 83 | links: 84 | - "es:es" 85 | image: "docker.elastic.co/kibana/kibana:7.13.2" 86 | ports: 87 | - "5601:5601" 88 | environment: 89 | ELASTICSEARCH_HOSTS: "http://es:9200" 90 | 91 | grafana: 92 | depends_on: 93 | - "es" 94 | links: 95 | - "es:es" 96 | environment: 97 | V: "v5" 98 | volumes: 99 | - "grafana-data:/var/lib/grafana" 100 | - "./audit/grafana/provisioning:/etc/grafana/provisioning" 101 | image: grafana/grafana:8.3.0 102 | ports: 103 | - 3000:3000 104 | user: "104" 105 | 106 | apm-server: 107 | image: docker.elastic.co/apm/apm-server:7.13.4 108 | depends_on: ['es', 'kibana' ] 109 | cap_add: ["CHOWN", "DAC_OVERRIDE", "SETGID", "SETUID"] 110 | cap_drop: ["ALL"] 111 | ports: 112 | - 8200:8200 113 | links: 114 | - "es:es" 115 | command: > 116 | apm-server -e 117 | -E setup.kibana.host=kibana:5601 118 | -E setup.template.settings.index.number_of_replicas=0 119 | -E apm-server.kibana.enabled=true 120 | -E apm-server.kibana.host=kibana:5601 121 | -E output.elasticsearch.hosts=["es:9200"] 122 | -------------------------------------------------------------------------------- /logging.md: -------------------------------------------------------------------------------- 1 | # Monitoring & Audit in Aidbox 2 | 3 | ## Intro 4 | 5 | * logs -> audit & monitoring 6 | 7 | ## Installation 8 | 9 | * aidbox devbox install tut 10 | * devbox repository 11 | * compose 12 | * grafana audit 13 | * make up 14 | * open aidbox 15 | * open kibana (add indexes) 16 | * open grafana 17 | * Read logs 18 | * logs schema (doc) 19 | * REST - w/req & w/resp (doc) 20 | * meaning of w_m w_url w_r w_st 21 | * looking into logs 22 | * w_uid & w_cid 23 | * d 24 | * ctx 25 | * search in logs 26 | * url 27 | * users 28 | * ctx 29 | * Grafana dashboard 30 | * walk thro panels 31 | * rpm 32 | * slow queries 33 | --------------------------------------------------------------------------------