@pagopa/opex-dashboard 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -193,6 +193,7 @@ action_groups: string[] # Array of Azure Action Group IDs
193
193
 
194
194
  # Optional fields (with defaults)
195
195
  resource_type: app-gateway | api-management # Default: app-gateway
196
+ resource_group: string # Default: dashboards (Azure resource group for dashboard and alerts)
196
197
  timespan: string # Default: 5m
197
198
  evaluation_frequency: integer # Default: 10 (minutes)
198
199
  evaluation_time_window: integer # Default: 20 (minutes)
package/bin/index.js CHANGED
@@ -759,6 +759,7 @@ var AzDashboardRawBuilder = class extends Builder {
759
759
  location: options.location,
760
760
  name: options.name,
761
761
  queries: options.queries,
762
+ resource_group: options.resourceGroup,
762
763
  resource_type: options.resourceType,
763
764
  response_time_threshold: options.responseTimeThreshold,
764
765
  time_window: options.evaluationTimeWindow,
@@ -792,6 +793,19 @@ var AzDashboardRawBuilder = class extends Builder {
792
793
  import { mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
793
794
  import * as path3 from "path";
794
795
 
796
+ // src/core/config/defaults.ts
797
+ var DEFAULT_TIMESPAN = "5m";
798
+ var DEFAULT_RESOURCE_GROUP = "dashboards";
799
+ var DEFAULTS = {
800
+ availability_threshold: DEFAULT_AVAILABILITY_THRESHOLD,
801
+ evaluation_frequency: EVALUATION_FREQUENCY_MINUTES,
802
+ evaluation_time_window: TIME_WINDOW_MINUTES,
803
+ event_occurrences: EVENT_OCCURRENCES,
804
+ resource_group: DEFAULT_RESOURCE_GROUP,
805
+ response_time_threshold: DEFAULT_RESPONSE_TIME_THRESHOLD,
806
+ timespan: DEFAULT_TIMESPAN
807
+ };
808
+
795
809
  // src/builders/azure-dashboard/packager.ts
796
810
  import { mkdir, writeFile } from "fs/promises";
797
811
  import * as path2 from "path";
@@ -951,7 +965,7 @@ locals {
951
965
  }
952
966
 
953
967
  data "azurerm_resource_group" "this" {
954
- name = "dashboards"
968
+ name = "${context.resource_group}"
955
969
  }
956
970
 
957
971
  resource "azurerm_portal_dashboard" "this" {
@@ -1066,6 +1080,7 @@ var AzDashboardBuilder = class extends Builder {
1066
1080
  location: options.location,
1067
1081
  name: options.name.replace(/ /g, "_"),
1068
1082
  // Replace spaces with underscores for Terraform compatibility
1083
+ resource_group: options.resourceGroup ?? DEFAULTS.resource_group,
1069
1084
  resource_type: options.resourceType,
1070
1085
  time_window: options.evaluationTimeWindow,
1071
1086
  timespan: options.timespan
@@ -1121,6 +1136,7 @@ async function createAzureRawBuilder(params) {
1121
1136
  name: params.name,
1122
1137
  oa3Spec,
1123
1138
  queries: params.queries,
1139
+ resourceGroup: params.resource_group,
1124
1140
  resources: params.resources,
1125
1141
  resourceType: params.resource_type,
1126
1142
  responseTimeThreshold: params.response_time_threshold,
@@ -1138,6 +1154,7 @@ async function createAzureTerraformBuilder(params) {
1138
1154
  eventOccurrences: params.event_occurrences,
1139
1155
  location: params.location,
1140
1156
  name: params.name,
1157
+ resourceGroup: params.resource_group,
1141
1158
  resourceType: params.resource_type,
1142
1159
  terraformConfig: params.terraform,
1143
1160
  timespan: params.timespan
@@ -1173,17 +1190,6 @@ var QueryConfigSchema = z3.object({
1173
1190
  status_code_categories: z3.array(z3.string()).default(["1XX", "2XX", "3XX", "4XX", "5XX"]).describe("HTTP status code categories for response codes queries")
1174
1191
  });
1175
1192
 
1176
- // src/core/config/defaults.ts
1177
- var DEFAULT_TIMESPAN = "5m";
1178
- var DEFAULTS = {
1179
- availability_threshold: DEFAULT_AVAILABILITY_THRESHOLD,
1180
- evaluation_frequency: EVALUATION_FREQUENCY_MINUTES,
1181
- evaluation_time_window: TIME_WINDOW_MINUTES,
1182
- event_occurrences: EVENT_OCCURRENCES,
1183
- response_time_threshold: DEFAULT_RESPONSE_TIME_THRESHOLD,
1184
- timespan: DEFAULT_TIMESPAN
1185
- };
1186
-
1187
1193
  // src/core/config/config.schema.ts
1188
1194
  var EndpointOverrideSchema = EndpointOverridePropertiesSchema.extend({
1189
1195
  availability_evaluation_frequency: z4.number().optional().describe(
@@ -1270,6 +1276,9 @@ var ConfigSchema = z4.object({
1270
1276
  queries: QueryConfigSchema.optional().describe(
1271
1277
  "Optional global query configuration overrides"
1272
1278
  ),
1279
+ resource_group: z4.string().optional().default(DEFAULTS.resource_group).describe(
1280
+ "Azure resource group name where dashboard and alerts will be created. Default: dashboards"
1281
+ ),
1273
1282
  resource_type: z4.enum(["app-gateway", "api-management"]).optional().default("app-gateway").describe(
1274
1283
  "Type of Azure resource to monitor: app-gateway (Application Gateway) or api-management (API Management). Default: app-gateway"
1275
1284
  ),
@@ -1441,6 +1450,7 @@ async function generateHandler(options) {
1441
1450
  name: config.name,
1442
1451
  queries: config.queries || config.overrides?.queries,
1443
1452
  resolver,
1453
+ resource_group: config.resource_group,
1444
1454
  resource_type: config.resource_type,
1445
1455
  resources: [config.data_source],
1446
1456
  response_time_threshold: config.response_time_threshold,
@@ -1472,5 +1482,5 @@ async function generateHandler(options) {
1472
1482
  // src/cli/index.ts
1473
1483
  var program = new Command2();
1474
1484
  program.name("opex_dashboard").description("Generate operational dashboards from OpenAPI 3 specifications");
1475
- program.addCommand(createGenerateCommand()).version("0.1.0");
1485
+ program.addCommand(createGenerateCommand()).version("0.2.0");
1476
1486
  program.parse(process.argv);
@@ -3,7 +3,7 @@
3
3
  "$schema": "https://json-schema.org/draft/2020-12/schema",
4
4
  "description": "Configuration schema for generating operational dashboards from OpenAPI specifications",
5
5
  "title": "OpEx Dashboard Configuration",
6
- "version": "0.1.0",
6
+ "version": "0.2.0",
7
7
  "type": "object",
8
8
  "properties": {
9
9
  "action_groups": {
@@ -168,6 +168,11 @@
168
168
  ],
169
169
  "additionalProperties": false
170
170
  },
171
+ "resource_group": {
172
+ "description": "Azure resource group name where dashboard and alerts will be created. Default: dashboards",
173
+ "default": "dashboards",
174
+ "type": "string"
175
+ },
171
176
  "resource_type": {
172
177
  "description": "Type of Azure resource to monitor: app-gateway (Application Gateway) or api-management (API Management). Default: app-gateway",
173
178
  "default": "app-gateway",
@@ -410,7 +415,8 @@
410
415
  "data_source",
411
416
  "location",
412
417
  "name",
413
- "oa3_spec"
418
+ "oa3_spec",
419
+ "resource_group"
414
420
  ],
415
421
  "additionalProperties": false
416
422
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+https://github.com/pagopa/dx.git",
6
6
  "directory": "apps/opex-dashboard"
7
7
  },
8
- "version": "0.1.0",
8
+ "version": "0.2.0",
9
9
  "description": "Generate operational dashboards from OpenAPI specifications",
10
10
  "main": "dist/index.js",
11
11
  "bin": {