Skip to content

Commit e9d19fd

Browse files
committed
feat: добавить security-панели 401/403/429 в Grafana
Что сделано: - добавлен график Security сигналов по кодам 401/403/429 за 5 минут - добавлены отдельные stat-панели для 401, 403 и 429 - в запросах использован increase(...[5m]) для явных счётчиков событий - добавлен fallback or vector(0), чтобы при отсутствии событий отображался ноль
1 parent 93fe57c commit e9d19fd

1 file changed

Lines changed: 299 additions & 1 deletion

File tree

monitoring/grafana/provisioning/dashboards/json/task-manager-observability.json

Lines changed: 299 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,304 @@
731731
],
732732
"title": "Топ эндпоинтов по нагрузке",
733733
"type": "timeseries"
734+
},
735+
{
736+
"datasource": {
737+
"type": "prometheus",
738+
"uid": "prometheus"
739+
},
740+
"fieldConfig": {
741+
"defaults": {
742+
"color": {
743+
"mode": "palette-classic"
744+
},
745+
"custom": {
746+
"axisBorderShow": false,
747+
"axisCenteredZero": false,
748+
"axisColorMode": "text",
749+
"axisLabel": "",
750+
"axisPlacement": "auto",
751+
"barAlignment": 0,
752+
"drawStyle": "line",
753+
"fillOpacity": 10,
754+
"gradientMode": "none",
755+
"hideFrom": {
756+
"legend": false,
757+
"tooltip": false,
758+
"viz": false
759+
},
760+
"insertNulls": false,
761+
"lineInterpolation": "linear",
762+
"lineWidth": 2,
763+
"pointSize": 4,
764+
"scaleDistribution": {
765+
"type": "linear"
766+
},
767+
"showPoints": "never",
768+
"spanNulls": false,
769+
"stacking": {
770+
"group": "A",
771+
"mode": "none"
772+
},
773+
"thresholdsStyle": {
774+
"mode": "off"
775+
}
776+
},
777+
"mappings": [],
778+
"thresholds": {
779+
"mode": "absolute",
780+
"steps": [
781+
{
782+
"color": "green",
783+
"value": null
784+
}
785+
]
786+
},
787+
"unit": "short"
788+
},
789+
"overrides": []
790+
},
791+
"gridPos": {
792+
"h": 8,
793+
"w": 24,
794+
"x": 0,
795+
"y": 29
796+
},
797+
"id": 10,
798+
"options": {
799+
"legend": {
800+
"calcs": [
801+
"lastNotNull"
802+
],
803+
"displayMode": "table",
804+
"placement": "right",
805+
"showLegend": true
806+
},
807+
"tooltip": {
808+
"mode": "multi",
809+
"sort": "desc"
810+
}
811+
},
812+
"targets": [
813+
{
814+
"editorMode": "code",
815+
"expr": "sum(increase(http_requests_total{status=\"401\", method=~\"$method\", path=~\"$path\"}[5m])) or vector(0)",
816+
"legendFormat": "401 за 5м",
817+
"range": true,
818+
"refId": "A"
819+
},
820+
{
821+
"editorMode": "code",
822+
"expr": "sum(increase(http_requests_total{status=\"403\", method=~\"$method\", path=~\"$path\"}[5m])) or vector(0)",
823+
"legendFormat": "403 за 5м",
824+
"range": true,
825+
"refId": "B"
826+
},
827+
{
828+
"editorMode": "code",
829+
"expr": "sum(increase(http_requests_total{status=\"429\", method=~\"$method\", path=~\"$path\"}[5m])) or vector(0)",
830+
"legendFormat": "429 за 5м",
831+
"range": true,
832+
"refId": "C"
833+
}
834+
],
835+
"title": "Security сигналы: 401/403/429 (за 5 минут)",
836+
"type": "timeseries"
837+
},
838+
{
839+
"datasource": {
840+
"type": "prometheus",
841+
"uid": "prometheus"
842+
},
843+
"fieldConfig": {
844+
"defaults": {
845+
"color": {
846+
"mode": "background"
847+
},
848+
"mappings": [],
849+
"thresholds": {
850+
"mode": "absolute",
851+
"steps": [
852+
{
853+
"color": "green",
854+
"value": null
855+
},
856+
{
857+
"color": "orange",
858+
"value": 5
859+
},
860+
{
861+
"color": "red",
862+
"value": 20
863+
}
864+
]
865+
},
866+
"unit": "short"
867+
},
868+
"overrides": []
869+
},
870+
"gridPos": {
871+
"h": 6,
872+
"w": 8,
873+
"x": 0,
874+
"y": 37
875+
},
876+
"id": 11,
877+
"options": {
878+
"colorMode": "background",
879+
"graphMode": "none",
880+
"justifyMode": "auto",
881+
"orientation": "auto",
882+
"reduceOptions": {
883+
"calcs": [
884+
"lastNotNull"
885+
],
886+
"fields": "",
887+
"values": false
888+
},
889+
"textMode": "auto"
890+
},
891+
"targets": [
892+
{
893+
"editorMode": "code",
894+
"expr": "sum(increase(http_requests_total{status=\"401\", method=~\"$method\", path=~\"$path\"}[5m])) or vector(0)",
895+
"legendFormat": "",
896+
"range": true,
897+
"refId": "A"
898+
}
899+
],
900+
"title": "401 за 5 минут",
901+
"type": "stat"
902+
},
903+
{
904+
"datasource": {
905+
"type": "prometheus",
906+
"uid": "prometheus"
907+
},
908+
"fieldConfig": {
909+
"defaults": {
910+
"color": {
911+
"mode": "background"
912+
},
913+
"mappings": [],
914+
"thresholds": {
915+
"mode": "absolute",
916+
"steps": [
917+
{
918+
"color": "green",
919+
"value": null
920+
},
921+
{
922+
"color": "orange",
923+
"value": 3
924+
},
925+
{
926+
"color": "red",
927+
"value": 10
928+
}
929+
]
930+
},
931+
"unit": "short"
932+
},
933+
"overrides": []
934+
},
935+
"gridPos": {
936+
"h": 6,
937+
"w": 8,
938+
"x": 8,
939+
"y": 37
940+
},
941+
"id": 12,
942+
"options": {
943+
"colorMode": "background",
944+
"graphMode": "none",
945+
"justifyMode": "auto",
946+
"orientation": "auto",
947+
"reduceOptions": {
948+
"calcs": [
949+
"lastNotNull"
950+
],
951+
"fields": "",
952+
"values": false
953+
},
954+
"textMode": "auto"
955+
},
956+
"targets": [
957+
{
958+
"editorMode": "code",
959+
"expr": "sum(increase(http_requests_total{status=\"403\", method=~\"$method\", path=~\"$path\"}[5m])) or vector(0)",
960+
"legendFormat": "",
961+
"range": true,
962+
"refId": "A"
963+
}
964+
],
965+
"title": "403 за 5 минут",
966+
"type": "stat"
967+
},
968+
{
969+
"datasource": {
970+
"type": "prometheus",
971+
"uid": "prometheus"
972+
},
973+
"fieldConfig": {
974+
"defaults": {
975+
"color": {
976+
"mode": "background"
977+
},
978+
"mappings": [],
979+
"thresholds": {
980+
"mode": "absolute",
981+
"steps": [
982+
{
983+
"color": "green",
984+
"value": null
985+
},
986+
{
987+
"color": "orange",
988+
"value": 2
989+
},
990+
{
991+
"color": "red",
992+
"value": 5
993+
}
994+
]
995+
},
996+
"unit": "short"
997+
},
998+
"overrides": []
999+
},
1000+
"gridPos": {
1001+
"h": 6,
1002+
"w": 8,
1003+
"x": 16,
1004+
"y": 37
1005+
},
1006+
"id": 13,
1007+
"options": {
1008+
"colorMode": "background",
1009+
"graphMode": "none",
1010+
"justifyMode": "auto",
1011+
"orientation": "auto",
1012+
"reduceOptions": {
1013+
"calcs": [
1014+
"lastNotNull"
1015+
],
1016+
"fields": "",
1017+
"values": false
1018+
},
1019+
"textMode": "auto"
1020+
},
1021+
"targets": [
1022+
{
1023+
"editorMode": "code",
1024+
"expr": "sum(increase(http_requests_total{status=\"429\", method=~\"$method\", path=~\"$path\"}[5m])) or vector(0)",
1025+
"legendFormat": "",
1026+
"range": true,
1027+
"refId": "A"
1028+
}
1029+
],
1030+
"title": "429 за 5 минут",
1031+
"type": "stat"
7341032
}
7351033
],
7361034
"refresh": "5s",
@@ -808,6 +1106,6 @@
8081106
"timezone": "",
8091107
"title": "Task Manager API - Observability",
8101108
"uid": "task-manager-observability",
811-
"version": 1,
1109+
"version": 2,
8121110
"weekStart": ""
8131111
}

0 commit comments

Comments
 (0)