diff --git a/src/domains/fdr-app/00_monitor.tf b/src/domains/fdr-app/00_monitor.tf index 7a9fa24b11..e0a77366a1 100644 --- a/src/domains/fdr-app/00_monitor.tf +++ b/src/domains/fdr-app/00_monitor.tf @@ -27,3 +27,16 @@ data "azurerm_monitor_action_group" "opsgenie" { resource_group_name = var.monitor_resource_group_name name = local.monitor_action_group_opsgenie_name } + +resource "azurerm_portal_dashboard" "fdr-soap-dashboard" { + name = "FdR-SOAP" + resource_group_name = var.monitor_resource_group_name + location = var.location + tags = { + source = "terraform" + } + dashboard_properties = templatefile("dashboard/dash-fdr-soap.tpl", { + subscription_id = data.azurerm_subscription.current.subscription_id, + env_short = var.env_short + }) +} diff --git a/src/domains/fdr-app/README.md b/src/domains/fdr-app/README.md index 7f78829eee..3a39237b3b 100644 --- a/src/domains/fdr-app/README.md +++ b/src/domains/fdr-app/README.md @@ -70,6 +70,7 @@ | [azurerm_monitor_scheduled_query_rules_alert.alert_fdr_xmltojson_appexception](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource | | [azurerm_monitor_scheduled_query_rules_alert.alert_fdr_xmltojson_appexception_lastretry](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource | | [azurerm_monitor_scheduled_query_rules_alert.pagopa-fdr-nodo-rest-availability](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_scheduled_query_rules_alert) | resource | +| [azurerm_portal_dashboard.fdr-soap-dashboard](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/portal_dashboard) | resource | | [azurerm_resource_group.reporting_fdr_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource | | [helm_release.cert_mounter](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | | [helm_release.reloader](https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release) | resource | diff --git a/src/domains/fdr-app/dashboard/dash-fdr-soap.tpl b/src/domains/fdr-app/dashboard/dash-fdr-soap.tpl new file mode 100644 index 0000000000..c921ee72b9 --- /dev/null +++ b/src/domains/fdr-app/dashboard/dash-fdr-soap.tpl @@ -0,0 +1,1233 @@ +{ + "lenses": { + "0": { + "order": 0, + "parts": { + "0": { + "position": { + "x": 0, + "y": 0, + "colSpan": 6, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "resourceTypeMode", + "isOptional": true + }, + { + "name": "ComponentId", + "isOptional": true + }, + { + "name": "Scope", + "value": { + "resourceIds": [ + "/subscriptions/${subscription_id}/resourceGroups/pagopa-${env_short}-api-rg/providers/Microsoft.ApiManagement/service/pagopa-${env_short}-apim" + ] + }, + "isOptional": true + }, + { + "name": "PartId", + "value": "11ec1765-14e7-4e02-8049-c7bfa170fcdc", + "isOptional": true + }, + { + "name": "Version", + "value": "2.0", + "isOptional": true + }, + { + "name": "TimeRange", + "isOptional": true + }, + { + "name": "DashboardId", + "isOptional": true + }, + { + "name": "DraftRequestParameters", + "value": { + "scope": "hierarchy" + }, + "isOptional": true + }, + { + "name": "Query", + "value": "let threshold = 0.99;\nAzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/node-for-psp\" or url_s matches regex \"/nodo/nodo-per-psp\"\n| where operationId_s in ('63b6e2da2a92e811a8f33901', '63ff4f22aca2fd18dcc4a6f7', '61e9633eea7c4a07cc7d4811')\n| summarize\n Total=count(),\n Success=count(responseCode_d < 500)\n by bin(TimeGenerated, 5m)\n| extend availability=toreal(Success) / Total\n| project TimeGenerated, availability, watermark=threshold\n| render timechart with (xtitle = \"time\", ytitle= \"availability(%)\")\n", + "isOptional": true + }, + { + "name": "ControlType", + "value": "FrameControlChart", + "isOptional": true + }, + { + "name": "SpecificChart", + "value": "Line", + "isOptional": true + }, + { + "name": "PartTitle", + "value": "Analytics", + "isOptional": true + }, + { + "name": "PartSubTitle", + "value": "pagopa-${env_short}-apim", + "isOptional": true + }, + { + "name": "Dimensions", + "value": { + "xAxis": { + "name": "TimeGenerated", + "type": "datetime" + }, + "yAxis": [ + { + "name": "availability", + "type": "real" + }, + { + "name": "watermark", + "type": "real" + } + ], + "splitBy": [], + "aggregation": "Sum" + }, + "isOptional": true + }, + { + "name": "LegendOptions", + "value": { + "isEnabled": true, + "position": "Bottom" + }, + "isOptional": true + }, + { + "name": "IsQueryContainTimeRange", + "value": true, + "isOptional": true + } + ], + "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart", + "settings": {}, + "partHeader": { + "title": "Availability (5m)", + "subtitle": "nodo-invia-flusso-rendicontazione" + } + } + }, + "1": { + "position": { + "x": 6, + "y": 0, + "colSpan": 6, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "resourceTypeMode", + "isOptional": true + }, + { + "name": "ComponentId", + "isOptional": true + }, + { + "name": "Scope", + "value": { + "resourceIds": [ + "/subscriptions/${subscription_id}/resourceGroups/pagopa-${env_short}-api-rg/providers/Microsoft.ApiManagement/service/pagopa-${env_short}-apim" + ] + }, + "isOptional": true + }, + { + "name": "PartId", + "value": "155ac71b-1098-47b4-9317-0d9adb1092e0", + "isOptional": true + }, + { + "name": "Version", + "value": "2.0", + "isOptional": true + }, + { + "name": "TimeRange", + "isOptional": true + }, + { + "name": "DashboardId", + "isOptional": true + }, + { + "name": "DraftRequestParameters", + "value": { + "scope": "hierarchy" + }, + "isOptional": true + }, + { + "name": "Query", + "value": "AzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/node-for-psp\" or url_s matches regex \"/nodo/nodo-per-psp\"\n| where operationId_s in ('63b6e2da2a92e811a8f33901', '63ff4f22aca2fd18dcc4a6f7', '61e9633eea7c4a07cc7d4811')\n| extend HTTPStatus = case(\n responseCode_d between (100 .. 199), \"1XX\",\n responseCode_d between (200 .. 299), \"2XX\",\n responseCode_d between (300 .. 399), \"3XX\",\n responseCode_d between (400 .. 499), \"4XX\",\n \"5XX\")\n| summarize count() by HTTPStatus, bin(TimeGenerated, 5m)\n| render areachart with (xtitle = \"time\", ytitle= \"count\")\n\n", + "isOptional": true + }, + { + "name": "ControlType", + "value": "FrameControlChart", + "isOptional": true + }, + { + "name": "SpecificChart", + "value": "StackedArea", + "isOptional": true + }, + { + "name": "PartTitle", + "value": "Analytics", + "isOptional": true + }, + { + "name": "PartSubTitle", + "value": "pagopa-${env_short}-apim", + "isOptional": true + }, + { + "name": "Dimensions", + "value": { + "xAxis": { + "name": "TimeGenerated", + "type": "datetime" + }, + "yAxis": [ + { + "name": "count_", + "type": "long" + } + ], + "splitBy": [ + { + "name": "HTTPStatus", + "type": "string" + } + ], + "aggregation": "Sum" + }, + "isOptional": true + }, + { + "name": "LegendOptions", + "value": { + "isEnabled": true, + "position": "Bottom" + }, + "isOptional": true + }, + { + "name": "IsQueryContainTimeRange", + "value": true, + "isOptional": true + } + ], + "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart", + "settings": {}, + "partHeader": { + "title": "Response Codes (5m)", + "subtitle": "nodo-invia-flusso-rendicontazione" + } + } + }, + "2": { + "position": { + "x": 12, + "y": 0, + "colSpan": 6, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "resourceTypeMode", + "isOptional": true + }, + { + "name": "ComponentId", + "isOptional": true + }, + { + "name": "Scope", + "value": { + "resourceIds": [ + "/subscriptions/${subscription_id}/resourceGroups/pagopa-${env_short}-api-rg/providers/Microsoft.ApiManagement/service/pagopa-${env_short}-apim" + ] + }, + "isOptional": true + }, + { + "name": "PartId", + "value": "64d98666-5737-43ff-9a01-bd5f14116680", + "isOptional": true + }, + { + "name": "Version", + "value": "2.0", + "isOptional": true + }, + { + "name": "TimeRange", + "isOptional": true + }, + { + "name": "DashboardId", + "isOptional": true + }, + { + "name": "DraftRequestParameters", + "value": { + "scope": "hierarchy" + }, + "isOptional": true + }, + { + "name": "Query", + "value": "let threshold = 1;\nAzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/node-for-psp\" or url_s matches regex \"/nodo/nodo-per-psp\"\n| where operationId_s in ('63b6e2da2a92e811a8f33901', '63ff4f22aca2fd18dcc4a6f7', '61e9633eea7c4a07cc7d4811')\n| summarize\n watermark=threshold,\n duration_percentile_95=percentiles(DurationMs / 100.0, 95) by bin(TimeGenerated, 5m)\n| render timechart with (xtitle = \"time\", ytitle= \"response time(s)\")\n\n", + "isOptional": true + }, + { + "name": "ControlType", + "value": "FrameControlChart", + "isOptional": true + }, + { + "name": "SpecificChart", + "value": "Line", + "isOptional": true + }, + { + "name": "PartTitle", + "value": "Analytics", + "isOptional": true + }, + { + "name": "PartSubTitle", + "value": "pagopa-${env_short}-apim", + "isOptional": true + }, + { + "name": "Dimensions", + "value": { + "xAxis": { + "name": "TimeGenerated", + "type": "datetime" + }, + "yAxis": [ + { + "name": "watermark", + "type": "long" + }, + { + "name": "duration_percentile_95", + "type": "real" + } + ], + "splitBy": [], + "aggregation": "Sum" + }, + "isOptional": true + }, + { + "name": "LegendOptions", + "value": { + "isEnabled": true, + "position": "Bottom" + }, + "isOptional": true + }, + { + "name": "IsQueryContainTimeRange", + "value": true, + "isOptional": true + } + ], + "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart", + "settings": {}, + "partHeader": { + "title": "Percentile Response Time (5m)", + "subtitle": "nodo-invia-flusso-rendicontazione" + } + } + }, + "3": { + "position": { + "x": 0, + "y": 4, + "colSpan": 6, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "resourceTypeMode", + "isOptional": true + }, + { + "name": "ComponentId", + "isOptional": true + }, + { + "name": "Scope", + "value": { + "resourceIds": [ + "/subscriptions/${subscription_id}/resourceGroups/pagopa-${env_short}-api-rg/providers/Microsoft.ApiManagement/service/pagopa-${env_short}-apim" + ] + }, + "isOptional": true + }, + { + "name": "PartId", + "value": "32efaec6-c726-4315-a604-98be3123592f", + "isOptional": true + }, + { + "name": "Version", + "value": "2.0", + "isOptional": true + }, + { + "name": "TimeRange", + "isOptional": true + }, + { + "name": "DashboardId", + "isOptional": true + }, + { + "name": "DraftRequestParameters", + "value": { + "scope": "hierarchy" + }, + "isOptional": true + }, + { + "name": "Query", + "value": "let threshold = 0.99;\nAzureDiagnostics\n| where TimeGenerated > ago(10m)\n| where url_s matches regex \"/nodo-auth/node-for-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3b', '63b6e2da2a92e811a8f338f9', '61e9633dea7c4a07cc7d480e')\n| summarize\n Total=count(),\n Success=count(responseCode_d < 500)\n by bin(TimeGenerated, 5m)\n| extend availability=toreal(Success) / Total\n\n", + "isOptional": true + }, + { + "name": "ControlType", + "value": "AnalyticsGrid", + "isOptional": true + }, + { + "name": "SpecificChart", + "isOptional": true + }, + { + "name": "PartTitle", + "value": "Analytics", + "isOptional": true + }, + { + "name": "PartSubTitle", + "value": "pagopa-${env_short}-apim", + "isOptional": true + }, + { + "name": "Dimensions", + "isOptional": true + }, + { + "name": "LegendOptions", + "isOptional": true + }, + { + "name": "IsQueryContainTimeRange", + "value": true, + "isOptional": true + } + ], + "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart", + "settings": { + "content": { + "Query": "let threshold = 0.99;\nAzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/node-for-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3b', '63b6e2da2a92e811a8f338f9', '61e9633dea7c4a07cc7d480e')\n| summarize\n Total=count(),\n Success=count(responseCode_d < 500)\n by bin(TimeGenerated, 5m)\n| extend availability=toreal(Success) / Total\n| project TimeGenerated, availability, watermark=threshold\n| render timechart with (xtitle = \"time\", ytitle= \"availability(%)\")\n\n", + "ControlType": "FrameControlChart", + "SpecificChart": "Line", + "Dimensions": { + "xAxis": { + "name": "TimeGenerated", + "type": "datetime" + }, + "yAxis": [ + { + "name": "availability", + "type": "real" + }, + { + "name": "watermark", + "type": "real" + } + ], + "splitBy": [], + "aggregation": "Sum" + }, + "LegendOptions": { + "isEnabled": true, + "position": "Bottom" + } + } + }, + "partHeader": { + "title": "Availability (5m)", + "subtitle": "nodo-chiedi-flusso-rendicontazione" + } + } + }, + "4": { + "position": { + "x": 6, + "y": 4, + "colSpan": 6, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "resourceTypeMode", + "isOptional": true + }, + { + "name": "ComponentId", + "isOptional": true + }, + { + "name": "Scope", + "value": { + "resourceIds": [ + "/subscriptions/${subscription_id}/resourceGroups/pagopa-${env_short}-api-rg/providers/Microsoft.ApiManagement/service/pagopa-${env_short}-apim" + ] + }, + "isOptional": true + }, + { + "name": "PartId", + "value": "2d77ab68-e36d-422a-834c-b0050971c0ab", + "isOptional": true + }, + { + "name": "Version", + "value": "2.0", + "isOptional": true + }, + { + "name": "TimeRange", + "isOptional": true + }, + { + "name": "DashboardId", + "isOptional": true + }, + { + "name": "DraftRequestParameters", + "value": { + "scope": "hierarchy" + }, + "isOptional": true + }, + { + "name": "Query", + "value": "AzureDiagnostics\n| where TimeGenerated > ago(1200m)\n| where url_s matches regex \"/nodo-auth/node-for-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3b', '63b6e2da2a92e811a8f338f9', '61e9633dea7c4a07cc7d480e')\n| extend HTTPStatus = case(\n responseCode_d between (100 .. 199), \"1XX\",\n responseCode_d between (200 .. 299), \"2XX\",\n responseCode_d between (300 .. 399), \"3XX\",\n responseCode_d between (400 .. 499), \"4XX\",\n \"5XX\")\n| summarize count() by HTTPStatus, bin(TimeGenerated, 5m)\n| render areachart with (xtitle = \"time\", ytitle= \"count\")\n", + "isOptional": true + }, + { + "name": "ControlType", + "value": "FrameControlChart", + "isOptional": true + }, + { + "name": "SpecificChart", + "value": "StackedArea", + "isOptional": true + }, + { + "name": "PartTitle", + "value": "Analytics", + "isOptional": true + }, + { + "name": "PartSubTitle", + "value": "pagopa-${env_short}-apim", + "isOptional": true + }, + { + "name": "Dimensions", + "value": { + "xAxis": { + "name": "TimeGenerated", + "type": "datetime" + }, + "yAxis": [ + { + "name": "count_", + "type": "long" + } + ], + "splitBy": [ + { + "name": "HTTPStatus", + "type": "string" + } + ], + "aggregation": "Sum" + }, + "isOptional": true + }, + { + "name": "LegendOptions", + "value": { + "isEnabled": true, + "position": "Bottom" + }, + "isOptional": true + }, + { + "name": "IsQueryContainTimeRange", + "value": true, + "isOptional": true + } + ], + "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart", + "settings": { + "content": { + "Query": "AzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/nodo-per-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3b', '63b6e2da2a92e811a8f338f9', '61e9633dea7c4a07cc7d480e')\n| extend HTTPStatus = case(\n responseCode_d between (100 .. 199), \"1XX\",\n responseCode_d between (200 .. 299), \"2XX\",\n responseCode_d between (300 .. 399), \"3XX\",\n responseCode_d between (400 .. 499), \"4XX\",\n \"5XX\")\n| summarize count() by HTTPStatus, bin(TimeGenerated, 5m)\n| render areachart with (xtitle = \"time\", ytitle= \"count\")\n\n" + } + }, + "partHeader": { + "title": "Response Codes (5m)", + "subtitle": "nodo-chiedi-flusso-rendicontazione" + } + } + }, + "5": { + "position": { + "x": 12, + "y": 4, + "colSpan": 6, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "resourceTypeMode", + "isOptional": true + }, + { + "name": "ComponentId", + "isOptional": true + }, + { + "name": "Scope", + "value": { + "resourceIds": [ + "/subscriptions/${subscription_id}/resourceGroups/pagopa-${env_short}-api-rg/providers/Microsoft.ApiManagement/service/pagopa-${env_short}-apim" + ] + }, + "isOptional": true + }, + { + "name": "PartId", + "value": "15a5095a-1132-4a30-ba85-ab51b274fa68", + "isOptional": true + }, + { + "name": "Version", + "value": "2.0", + "isOptional": true + }, + { + "name": "TimeRange", + "isOptional": true + }, + { + "name": "DashboardId", + "isOptional": true + }, + { + "name": "DraftRequestParameters", + "value": { + "scope": "hierarchy" + }, + "isOptional": true + }, + { + "name": "Query", + "value": "let threshold = 1;\nAzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/node-for-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3b', '63b6e2da2a92e811a8f338f9', '61e9633dea7c4a07cc7d480e')\n| summarize\n watermark=threshold,\n duration_percentile_95=percentiles(DurationMs / 100, 95) by bin(TimeGenerated, 5m)\n| render timechart with (xtitle = \"time\", ytitle= \"response time(s)\")\n", + "isOptional": true + }, + { + "name": "ControlType", + "value": "FrameControlChart", + "isOptional": true + }, + { + "name": "SpecificChart", + "value": "Line", + "isOptional": true + }, + { + "name": "PartTitle", + "value": "Analytics", + "isOptional": true + }, + { + "name": "PartSubTitle", + "value": "pagopa-${env_short}-apim", + "isOptional": true + }, + { + "name": "Dimensions", + "value": { + "xAxis": { + "name": "TimeGenerated", + "type": "datetime" + }, + "yAxis": [ + { + "name": "watermark", + "type": "long" + }, + { + "name": "duration_percentile_95", + "type": "long" + } + ], + "splitBy": [], + "aggregation": "Sum" + }, + "isOptional": true + }, + { + "name": "LegendOptions", + "value": { + "isEnabled": true, + "position": "Bottom" + }, + "isOptional": true + }, + { + "name": "IsQueryContainTimeRange", + "value": true, + "isOptional": true + } + ], + "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart", + "settings": { + "content": { + "Query": "let threshold = 1;\nAzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/nodo-per-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3b', '63b6e2da2a92e811a8f338f9', '61e9633dea7c4a07cc7d480e')\n| summarize\n watermark=threshold,\n duration_percentile_95=percentiles(DurationMs / 100.0, 95) by bin(TimeGenerated, 5m)\n| render timechart with (xtitle = \"time\", ytitle= \"response time(s)\")\n\n", + "Dimensions": { + "xAxis": { + "name": "TimeGenerated", + "type": "datetime" + }, + "yAxis": [ + { + "name": "watermark", + "type": "long" + }, + { + "name": "duration_percentile_95", + "type": "real" + } + ], + "splitBy": [], + "aggregation": "Sum" + } + } + }, + "partHeader": { + "title": "Percentile Response Time (5m)", + "subtitle": "nodo-chiedi-flusso-rendicontazione" + } + } + }, + "6": { + "position": { + "x": 0, + "y": 8, + "colSpan": 6, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "resourceTypeMode", + "isOptional": true + }, + { + "name": "ComponentId", + "isOptional": true + }, + { + "name": "Scope", + "value": { + "resourceIds": [ + "/subscriptions/${subscription_id}/resourceGroups/pagopa-${env_short}-api-rg/providers/Microsoft.ApiManagement/service/pagopa-${env_short}-apim" + ] + }, + "isOptional": true + }, + { + "name": "PartId", + "value": "1422e1d9-1359-415f-add1-159c5d951477", + "isOptional": true + }, + { + "name": "Version", + "value": "2.0", + "isOptional": true + }, + { + "name": "TimeRange", + "isOptional": true + }, + { + "name": "DashboardId", + "isOptional": true + }, + { + "name": "DraftRequestParameters", + "value": { + "scope": "hierarchy" + }, + "isOptional": true + }, + { + "name": "Query", + "value": "let threshold = 0.99;\nAzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/node-for-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3b', '63b6e2da2a92e811a8f338f9', '61e9633dea7c4a07cc7d480e')\n| summarize\n Total=count(),\n Success=count(responseCode_d < 500)\n by bin(TimeGenerated, 5m)\n| extend availability=toreal(Success) / Total\n| project TimeGenerated, availability, watermark=threshold\n| render timechart with (xtitle = \"time\", ytitle= \"availability(%)\")\n\n", + "isOptional": true + }, + { + "name": "ControlType", + "value": "FrameControlChart", + "isOptional": true + }, + { + "name": "SpecificChart", + "value": "Line", + "isOptional": true + }, + { + "name": "PartTitle", + "value": "Analytics", + "isOptional": true + }, + { + "name": "PartSubTitle", + "value": "pagopa-${env_short}-apim", + "isOptional": true + }, + { + "name": "Dimensions", + "value": { + "xAxis": { + "name": "TimeGenerated", + "type": "datetime" + }, + "yAxis": [ + { + "name": "availability", + "type": "real" + }, + { + "name": "watermark", + "type": "real" + } + ], + "splitBy": [], + "aggregation": "Sum" + }, + "isOptional": true + }, + { + "name": "LegendOptions", + "value": { + "isEnabled": true, + "position": "Bottom" + }, + "isOptional": true + }, + { + "name": "IsQueryContainTimeRange", + "value": true, + "isOptional": true + } + ], + "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart", + "settings": { + "content": { + "Query": "let threshold = 0.99;\nAzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/node-for-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3a', '63b6e2da2a92e811a8f338f8', '61e9633dea7c4a07cc7d480d')\n| summarize\n Total=count(),\n Success=count(responseCode_d < 500)\n by bin(TimeGenerated, 5m)\n| extend availability=toreal(Success) / Total\n| project TimeGenerated, availability, watermark=threshold\n| render timechart with (xtitle = \"time\", ytitle= \"availability(%)\")\n\n" + } + }, + "partHeader": { + "title": "Availability (5m)", + "subtitle": "nodo-chiedi-elenco-flussi-rendicontazioni" + } + } + }, + "7": { + "position": { + "x": 6, + "y": 8, + "colSpan": 6, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "resourceTypeMode", + "isOptional": true + }, + { + "name": "ComponentId", + "isOptional": true + }, + { + "name": "Scope", + "value": { + "resourceIds": [ + "/subscriptions/${subscription_id}/resourceGroups/pagopa-${env_short}-api-rg/providers/Microsoft.ApiManagement/service/pagopa-${env_short}-apim" + ] + }, + "isOptional": true + }, + { + "name": "PartId", + "value": "9de90707-16cf-4fed-84cf-b48c411214bf", + "isOptional": true + }, + { + "name": "Version", + "value": "2.0", + "isOptional": true + }, + { + "name": "TimeRange", + "isOptional": true + }, + { + "name": "DashboardId", + "isOptional": true + }, + { + "name": "DraftRequestParameters", + "value": { + "scope": "hierarchy" + }, + "isOptional": true + }, + { + "name": "Query", + "value": "AzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/node-for-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3a', '63b6e2da2a92e811a8f338f8', '61e9633dea7c4a07cc7d480d')\n| extend HTTPStatus = case(\n responseCode_d between (100 .. 199), \"1XX\",\n responseCode_d between (200 .. 299), \"2XX\",\n responseCode_d between (300 .. 399), \"3XX\",\n responseCode_d between (400 .. 499), \"4XX\",\n \"5XX\")\n| summarize count() by HTTPStatus, bin(TimeGenerated, 5m)\n| render areachart with (xtitle = \"time\", ytitle= \"count\")\n\n", + "isOptional": true + }, + { + "name": "ControlType", + "value": "FrameControlChart", + "isOptional": true + }, + { + "name": "SpecificChart", + "value": "StackedArea", + "isOptional": true + }, + { + "name": "PartTitle", + "value": "Analytics", + "isOptional": true + }, + { + "name": "PartSubTitle", + "value": "pagopa-${env_short}-apim", + "isOptional": true + }, + { + "name": "Dimensions", + "value": { + "xAxis": { + "name": "TimeGenerated", + "type": "datetime" + }, + "yAxis": [ + { + "name": "count_", + "type": "long" + } + ], + "splitBy": [ + { + "name": "HTTPStatus", + "type": "string" + } + ], + "aggregation": "Sum" + }, + "isOptional": true + }, + { + "name": "LegendOptions", + "value": { + "isEnabled": true, + "position": "Bottom" + }, + "isOptional": true + }, + { + "name": "IsQueryContainTimeRange", + "value": true, + "isOptional": true + } + ], + "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart", + "settings": { + "content": { + "Query": "AzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/nodo-per-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3a', '63b6e2da2a92e811a8f338f8', '61e9633dea7c4a07cc7d480d')\n| extend HTTPStatus = case(\n responseCode_d between (100 .. 199), \"1XX\",\n responseCode_d between (200 .. 299), \"2XX\",\n responseCode_d between (300 .. 399), \"3XX\",\n responseCode_d between (400 .. 499), \"4XX\",\n \"5XX\")\n| summarize count() by HTTPStatus, bin(TimeGenerated, 5m)\n| render areachart with (xtitle = \"time\", ytitle= \"count\")\n\n" + } + }, + "partHeader": { + "title": "Response Codes (5m)", + "subtitle": "nodo-chiedi-elenco-flussi-rendicontazioni" + } + } + }, + "8": { + "position": { + "x": 12, + "y": 8, + "colSpan": 6, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "resourceTypeMode", + "isOptional": true + }, + { + "name": "ComponentId", + "isOptional": true + }, + { + "name": "Scope", + "value": { + "resourceIds": [ + "/subscriptions/${subscription_id}/resourceGroups/pagopa-${env_short}-api-rg/providers/Microsoft.ApiManagement/service/pagopa-${env_short}-apim" + ] + }, + "isOptional": true + }, + { + "name": "PartId", + "value": "2f288b5d-b17f-4a08-812b-3e13b81563a4", + "isOptional": true + }, + { + "name": "Version", + "value": "2.0", + "isOptional": true + }, + { + "name": "TimeRange", + "isOptional": true + }, + { + "name": "DashboardId", + "isOptional": true + }, + { + "name": "DraftRequestParameters", + "value": { + "scope": "hierarchy" + }, + "isOptional": true + }, + { + "name": "Query", + "value": "let threshold = 1;\nAzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/node-for-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3a', '63b6e2da2a92e811a8f338f8', '61e9633dea7c4a07cc7d480d')\n| summarize\n watermark=threshold,\n duration_percentile_95=percentiles(DurationMs / 100.0, 95) by bin(TimeGenerated, 5m)\n| render timechart with (xtitle = \"time\", ytitle= \"response time(s)\")\n\n", + "isOptional": true + }, + { + "name": "ControlType", + "value": "FrameControlChart", + "isOptional": true + }, + { + "name": "SpecificChart", + "value": "Line", + "isOptional": true + }, + { + "name": "PartTitle", + "value": "Analytics", + "isOptional": true + }, + { + "name": "PartSubTitle", + "value": "pagopa-${env_short}-apim", + "isOptional": true + }, + { + "name": "Dimensions", + "value": { + "xAxis": { + "name": "TimeGenerated", + "type": "datetime" + }, + "yAxis": [ + { + "name": "watermark", + "type": "long" + }, + { + "name": "duration_percentile_95", + "type": "real" + } + ], + "splitBy": [], + "aggregation": "Sum" + }, + "isOptional": true + }, + { + "name": "LegendOptions", + "value": { + "isEnabled": true, + "position": "Bottom" + }, + "isOptional": true + }, + { + "name": "IsQueryContainTimeRange", + "value": true, + "isOptional": true + } + ], + "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart", + "settings": { + "content": { + "Query": "let threshold = 1;\nAzureDiagnostics\n| where TimeGenerated > ago(30m)\n| where url_s matches regex \"/nodo-auth/nodo-per-pa\" or url_s matches regex \"/nodo/nodo-per-pa\"\n| where operationId_s in ('63ff73adea7c4a1860530e3a', '63b6e2da2a92e811a8f338f8', '61e9633dea7c4a07cc7d480d')\n| summarize\n watermark=threshold,\n duration_percentile_95=percentiles(DurationMs / 100.0, 95) by bin(TimeGenerated, 5m)\n| render timechart with (xtitle = \"time\", ytitle= \"response time(s)\")\n\n" + } + }, + "partHeader": { + "title": "Percentile Response Time (5m)", + "subtitle": "nodo-chiedi-elenco-flussi-rendicontazioni" + } + } + }, + "9": { + "position": { + "x": 0, + "y": 12, + "colSpan": 6, + "rowSpan": 4 + }, + "metadata": { + "inputs": [ + { + "name": "resourceTypeMode", + "isOptional": true + }, + { + "name": "ComponentId", + "isOptional": true + }, + { + "name": "Scope", + "value": { + "resourceIds": [ + "/subscriptions/${subscription_id}/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/components/pagopa-p-appinsights" + ] + }, + "isOptional": true + }, + { + "name": "PartId", + "value": "2e43414e-25fd-4fd3-814e-d08be212561b", + "isOptional": true + }, + { + "name": "Version", + "value": "2.0", + "isOptional": true + }, + { + "name": "TimeRange", + "isOptional": true + }, + { + "name": "DashboardId", + "isOptional": true + }, + { + "name": "DraftRequestParameters", + "isOptional": true + }, + { + "name": "Query", + "value": "requests\n| where timestamp > ago(30m)\n| where tostring(customDimensions[\"Request-Body\"]) contains 'nodoInviaFlussoRendicontazione'\n| extend esito = extract(\"(.*?)\", 1, tostring(customDimensions[\"Response-Body\"]))\n| summarize Count = count() by esito\n| order by Count desc\n\n", + "isOptional": true + }, + { + "name": "ControlType", + "value": "AnalyticsGrid", + "isOptional": true + }, + { + "name": "SpecificChart", + "isOptional": true + }, + { + "name": "PartTitle", + "value": "Analytics", + "isOptional": true + }, + { + "name": "PartSubTitle", + "value": "pagopa-p-appinsights", + "isOptional": true + }, + { + "name": "Dimensions", + "isOptional": true + }, + { + "name": "LegendOptions", + "isOptional": true + }, + { + "name": "IsQueryContainTimeRange", + "value": true, + "isOptional": true + } + ], + "type": "Extension/Microsoft_OperationsManagementSuite_Workspace/PartType/LogsDashboardPart", + "settings": { + "content": { + "Query": "requests\n| where timestamp > ago(30m)\n| where name matches regex \"nodo(-auth){0,1}/((nodo-per-psp))\" or name matches regex \"nodo(-auth){0,1}/((node-for-psp))\"\n| where tostring(customDimensions[\"Request-Body\"]) contains 'nodoInviaFlussoRendicontazione'\n| extend esito = extract(\"(.*?)\", 1, tostring(customDimensions[\"Response-Body\"]))\n| summarize Count = count() by esito\n| order by Count desc\n\n" + } + }, + "partHeader": { + "title": "Summary Esito", + "subtitle": "nodo-invia-flusso-rendicontazione" + } + } + } + } + } + } +} diff --git a/src/elk-monitoring/05_elastic_stack.tf b/src/elk-monitoring/05_elastic_stack.tf index 77794226df..0cddb2e4dd 100644 --- a/src/elk-monitoring/05_elastic_stack.tf +++ b/src/elk-monitoring/05_elastic_stack.tf @@ -97,7 +97,8 @@ module "elastic_stack" { /* apiconfig */ "pagopaapiconfig-postgresql", "pagopaapiconfig-oracle", "apiconfig-selfcare-integration-microservice-chart", "cache-oracle", "cache-postgresql", "cache-replica-oracle", "cache-replica-postgresql", /* ecommerce */ "pagopaecommerceeventdispatcherservice-microservice-chart", "pagopaecommercepaymentmethodsservice-microservice-chart", "pagopaecommercepaymentrequestsservice-microservice-chart", "pagopaecommercetransactionsservice-microservice-chart", "pagopaecommercetxschedulerservice-microservice-chart", "pagopanotificationsservice-microservice-chart", /* selfcare */ "pagopaselfcaremsbackofficebackend-microservice-chart", "backoffice-external", - /* gps */ "gpd-core-microservice-chart", "pagopagpdpayments-microservice-chart", "pagopareportingorgsenrollment-microservice-chart", "pagopaspontaneouspayments-microservice-chart", "gpd-payments-pull", "gpd-upload-microservice-chart", "pagopapagopagpdingestionmanager-microservice-chart" + /* gps */ "gpd-core-microservice-chart", "pagopagpdpayments-microservice-chart", "pagopareportingorgsenrollment-microservice-chart", "pagopaspontaneouspayments-microservice-chart", "gpd-payments-pull", "gpd-upload-microservice-chart", "pagopapagopagpdingestionmanager-microservice-chart", + /* fdr */ "fdr-nodo-fdrnodo", "pagopafdr-microservice-chart", "fdr-technicalsupport-microservice-chart", "pagopa-fdr-2-event-hub" ] eck_license = file("${path.module}/env/eck_license/pagopa-spa-4a1285e5-9c2c-4f9f-948a-9600095edc2f-orchestration.json") diff --git a/src/elk-monitoring/05_kibana_dashboard_pagopafdr.tf b/src/elk-monitoring/05_kibana_dashboard_pagopafdr.tf index 41dd76f826..d3a1342226 100644 --- a/src/elk-monitoring/05_kibana_dashboard_pagopafdr.tf +++ b/src/elk-monitoring/05_kibana_dashboard_pagopafdr.tf @@ -1,10 +1,10 @@ #################################### [FDRNODO] #################################### locals { - fdrnodo_dashboard_path = "${path.module}/${local.fdr_space_name}/${local.pagopafdrnodo_key}/dashboard/*.ndjson" + fdrnodo_dashboard_path = "${path.module}/${local.fdr_space_name}/${local.pagopafdr_key}/dashboard/*.ndjson" } resource "null_resource" "pagopafdrnodo_upload_dashboard" { - depends_on = [null_resource.pagopafdrnodo_kibana_data_view] + depends_on = [null_resource.pagopafdr_kibana_data_view] triggers = { always_run = "${timestamp()}" diff --git a/src/elk-monitoring/05_kibana_log_pagopafdr.tf b/src/elk-monitoring/05_kibana_log_pagopafdr.tf index 0b14d21598..1b88183acc 100644 --- a/src/elk-monitoring/05_kibana_log_pagopafdr.tf +++ b/src/elk-monitoring/05_kibana_log_pagopafdr.tf @@ -1,87 +1,35 @@ -#################################### [FDR] #################################### +#################################### [PAGOPA FDR] #################################### locals { ## space fdr_space_name = "fdr" - fdr_space = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/space.json", { + fdr_space = replace(trimsuffix(trimprefix(templatefile("${path.module}/pagopa/fdr/space.json", { name = "${local.fdr_space_name}" }), "\""), "\""), "'", "'\\''") - ## fdr-nodo - pagopafdrnodo_key = "pagopafdrnodo" + pagopafdr_key = "pagopafdr" + log_fdr_index_pattern = "logs*fdr*" # all fdr log files - pagopafdrnodo_ingest_pipeline = replace(trimsuffix(trimprefix(file("${path.module}/fdr/${local.pagopafdrnodo_key}/ingest-pipeline.json"), "\""), "\""), "'", "'\\''") - pagopafdrnodo_ilm_policy = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/ilm-policy.json", { - name = local.pagopafdrnodo_key, - managed = false, - policy_name = local.default_snapshot_policy_key - }), "\""), "\""), "'", "'\\''") - pagopafdrnodo_component_template_package = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/component@package.json", { - name = local.pagopafdrnodo_key - }), "\""), "\""), "'", "'\\''") - pagopafdrnodo_component_template_custom = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/component@custom.json", { - name = local.pagopafdrnodo_key - }), "\""), "\""), "'", "'\\''") - pagopafdrnodo_index_template = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/index-template.json", { - name = local.pagopafdrnodo_key - component_template_package = "${local.pagopafdrnodo_key}@package" - component_template_custom = "${local.pagopafdrnodo_key}@custom" - }), "\""), "\""), "'", "'\\''") - - - pagopafdrnodo_data_view = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/data-view.json", { - name = local.pagopafdrnodo_key - }), "\""), "\""), "'", "'\\''") - - ## fdr-nodo-cron - pagopafdrnodocron_key = "pagopafdrnodocron" - - pagopafdrnodocron_ingest_pipeline = replace(trimsuffix(trimprefix(file("${path.module}/fdr/${local.pagopafdrnodocron_key}/ingest-pipeline.json"), "\""), "\""), "'", "'\\''") - pagopafdrnodocron_ilm_policy = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/ilm-policy.json", { - name = local.pagopafdrnodocron_key, - managed = false, - policy_name = local.default_snapshot_policy_key - }), "\""), "\""), "'", "'\\''") - pagopafdrnodocron_component_template_package = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/component@package.json", { - name = local.pagopafdrnodocron_key - }), "\""), "\""), "'", "'\\''") - pagopafdrnodocron_component_template_custom = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/component@custom.json", { - name = local.pagopafdrnodocron_key - }), "\""), "\""), "'", "'\\''") - pagopafdrnodocron_index_template = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/index-template.json", { - name = local.pagopafdrnodocron_key - component_template_package = "${local.pagopafdrnodocron_key}@package" - component_template_custom = "${local.pagopafdrnodocron_key}@custom" - }), "\""), "\""), "'", "'\\''") - - - pagopafdrnodocron_data_view = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/data-view.json", { - name = local.pagopafdrnodocron_key - }), "\""), "\""), "'", "'\\''") - - ## fdr - pagopafdr_key = "pagopafdr" - - pagopafdr_ingest_pipeline = replace(trimsuffix(trimprefix(file("${path.module}/log-template/ingest-pipeline.json"), "\""), "\""), "'", "'\\''") - pagopafdr_ilm_policy = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/ilm-policy.json", { + pagopafdr_ingest_pipeline = replace(trimsuffix(trimprefix(file("${path.module}/pagopa/fdr/ingest-pipeline.json"), "\""), "\""), "'", "'\\''") + pagopafdr_ilm_policy = replace(trimsuffix(trimprefix(templatefile("${path.module}/pagopa/fdr/ilm-policy.json", { name = local.pagopafdr_key, managed = false, - policy_name = local.default_snapshot_policy_key + policy_name = "fdr-nightly-snapshots" }), "\""), "\""), "'", "'\\''") - pagopafdr_component_template_package = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/component@package.json", { - name = local.pagopafdr_key + pagopafdr_component_template_custom = replace(trimsuffix(trimprefix(templatefile("${path.module}/pagopa/fdr/component@custom.json", { + pipeline = local.pagopafdr_key + lifecycle = local.pagopafdr_key }), "\""), "\""), "'", "'\\''") - pagopafdr_component_template_custom = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/component@custom.json", { - name = local.pagopafdr_key + pagopafdr_index_template = replace(trimsuffix(trimprefix(templatefile("${path.module}/pagopa/fdr/index-template.json", { + name = "fdr" + component_template_custom = "${local.pagopafdr_key}@custom" + index = local.log_fdr_index_pattern }), "\""), "\""), "'", "'\\''") - pagopafdr_index_template = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/index-template.json", { - name = local.pagopafdr_key - component_template_package = "${local.pagopafdr_key}@package" - component_template_custom = "${local.pagopafdr_key}@custom" - }), "\""), "\""), "'", "'\\''") - - pagopafdr_data_view = replace(trimsuffix(trimprefix(templatefile("${path.module}/log-template/data-view.json", { - name = local.pagopafdr_key + # FDR + pagopafdr_data_view = replace(trimsuffix(trimprefix(templatefile("${path.module}/pagopa/fdr/data-view.json", { + key = local.pagopafdr_key + name = "Dominio fdr" + index = local.log_fdr_index_pattern }), "\""), "\""), "'", "'\\''") } @@ -104,8 +52,7 @@ resource "null_resource" "fdr_kibana_space" { } } -## fdr-nodo -resource "null_resource" "pagopafdrnodo_ingest_pipeline" { +resource "null_resource" "pagofdr_ingest_pipeline" { depends_on = [null_resource.fdr_kibana_space] triggers = { @@ -114,17 +61,17 @@ resource "null_resource" "pagopafdrnodo_ingest_pipeline" { provisioner "local-exec" { command = <