@red-hat-developer-hub/backstage-plugin-adoption-insights-backend 0.0.3 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @red-hat-developer-hub/backstage-plugin-adoption-insights-backend
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a66e0b0: Backstage version bump to v1.36.1
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [a66e0b0]
12
+ - @red-hat-developer-hub/backstage-plugin-adoption-insights-common@0.2.0
13
+
14
+ ## 0.0.4
15
+
16
+ ### Patch Changes
17
+
18
+ - 1e6eff6: Fix partition overlap error
19
+
3
20
  ## 0.0.3
4
21
 
5
22
  ### Patch Changes
@@ -1,16 +1,38 @@
1
1
  'use strict';
2
2
 
3
- const createPartition = async (knex, year, month) => {
4
- const startDate = `${year}-${month.toString().padStart(2, "0")}-01`;
5
- const nextMonth = new Date(year, month, 1);
6
- nextMonth.setMonth(nextMonth.getMonth() + 1);
7
- const endDate = `${nextMonth.getFullYear()}-${(nextMonth.getMonth() + 1).toString().padStart(2, "0")}-01`;
8
- const partitionName = `events_${year}_${month}`;
9
- await knex.schema.raw(`
3
+ var partition = require('../utils/partition.cjs.js');
4
+
5
+ const createPartition = async (knex, year, month, attempts = /* @__PURE__ */ new Map(), maxRetries = 1) => {
6
+ const start = new Date(year, month - 1, 1);
7
+ const end = new Date(year, month, 1);
8
+ const startDate = start.toISOString().slice(0, 10);
9
+ const endDate = end.toISOString().slice(0, 10);
10
+ const partitionName = `events_${year}_${month.toString().padStart(2, "0")}`;
11
+ const key = `${year}_${month}`;
12
+ const currentAttempt = attempts.get(key) ?? 0;
13
+ if (currentAttempt > maxRetries) {
14
+ throw new Error(`Exceeded max retries for partition ${key}`);
15
+ }
16
+ attempts.set(key, currentAttempt + 1);
17
+ try {
18
+ await knex.schema.raw(`
10
19
  CREATE TABLE IF NOT EXISTS ${partitionName}
11
20
  PARTITION OF events
12
21
  FOR VALUES FROM ('${startDate}') TO ('${endDate}');
13
22
  `);
23
+ } catch (error) {
24
+ if (partition.isPartitionOverlapError(error)) {
25
+ const overlappingPartition = partition.extractOverlappingPartition(error.message);
26
+ const { year: y, month: m } = partition.parsePartitionDate(overlappingPartition);
27
+ await knex.schema.raw(
28
+ `DROP TABLE IF EXISTS ${overlappingPartition} CASCADE`
29
+ );
30
+ await createPartition(knex, y, m, attempts, maxRetries);
31
+ await createPartition(knex, year, month, attempts, maxRetries);
32
+ } else {
33
+ throw error;
34
+ }
35
+ }
14
36
  };
15
37
  const schedulePartition = async (client, services) => {
16
38
  const { logger, scheduler } = services;
@@ -1 +1 @@
1
- {"version":3,"file":"partition.cjs.js","sources":["../../src/database/partition.ts"],"sourcesContent":["import { Knex } from 'knex';\n/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n LoggerService,\n SchedulerService,\n} from '@backstage/backend-plugin-api/index';\n\nexport const createPartition = async (\n knex: Knex,\n year: number,\n month: number,\n) => {\n const startDate = `${year}-${month.toString().padStart(2, '0')}-01`;\n const nextMonth = new Date(year, month, 1);\n nextMonth.setMonth(nextMonth.getMonth() + 1);\n const endDate = `${nextMonth.getFullYear()}-${(nextMonth.getMonth() + 1)\n .toString()\n .padStart(2, '0')}-01`;\n\n const partitionName = `events_${year}_${month}`;\n\n await knex.schema.raw(`\n CREATE TABLE IF NOT EXISTS ${partitionName} \n PARTITION OF events\n FOR VALUES FROM ('${startDate}') TO ('${endDate}');\n `);\n};\n\nexport const schedulePartition = async (\n client: Knex,\n services: {\n logger: LoggerService;\n scheduler: SchedulerService;\n },\n) => {\n const { logger, scheduler } = services;\n const partitionEventsTable = async () => {\n const year = new Date().getFullYear();\n const month = new Date().getMonth() + 1;\n logger.info(\n `Creating partition for ${year}_${month.toString().padStart(2, '0')}`,\n );\n await createPartition(client, year, month);\n };\n\n const runner = scheduler.createScheduledTaskRunner({\n frequency: { cron: '0 0 1 * *' }, // Runs at midnight on the 1st of every month\n timeout: { seconds: 30 },\n });\n\n runner.run({\n id: 'create-partition',\n fn: partitionEventsTable,\n });\n\n logger.info('[TASK] Running initial execution on startup...');\n await partitionEventsTable();\n};\n"],"names":[],"mappings":";;AAqBO,MAAM,eAAkB,GAAA,OAC7B,IACA,EAAA,IAAA,EACA,KACG,KAAA;AACH,EAAM,MAAA,SAAA,GAAY,CAAG,EAAA,IAAI,CAAI,CAAA,EAAA,KAAA,CAAM,UAAW,CAAA,QAAA,CAAS,CAAG,EAAA,GAAG,CAAC,CAAA,GAAA,CAAA;AAC9D,EAAA,MAAM,SAAY,GAAA,IAAI,IAAK,CAAA,IAAA,EAAM,OAAO,CAAC,CAAA;AACzC,EAAA,SAAA,CAAU,QAAS,CAAA,SAAA,CAAU,QAAS,EAAA,GAAI,CAAC,CAAA;AAC3C,EAAA,MAAM,OAAU,GAAA,CAAA,EAAG,SAAU,CAAA,WAAA,EAAa,CAAK,CAAA,EAAA,CAAA,SAAA,CAAU,QAAS,EAAA,GAAI,GACnE,QAAS,EAAA,CACT,QAAS,CAAA,CAAA,EAAG,GAAG,CAAC,CAAA,GAAA,CAAA;AAEnB,EAAA,MAAM,aAAgB,GAAA,CAAA,OAAA,EAAU,IAAI,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA;AAE7C,EAAM,MAAA,IAAA,CAAK,OAAO,GAAI,CAAA;AAAA,iCAAA,EACW,aAAa,CAAA;AAAA;AAAA,wBAEtB,EAAA,SAAS,WAAW,OAAO,CAAA;AAAA,IAChD,CAAA,CAAA;AACL;AAEa,MAAA,iBAAA,GAAoB,OAC/B,MAAA,EACA,QAIG,KAAA;AACH,EAAM,MAAA,EAAE,MAAQ,EAAA,SAAA,EAAc,GAAA,QAAA;AAC9B,EAAA,MAAM,uBAAuB,YAAY;AACvC,IAAA,MAAM,IAAO,GAAA,iBAAA,IAAI,IAAK,EAAA,EAAE,WAAY,EAAA;AACpC,IAAA,MAAM,KAAQ,GAAA,iBAAA,IAAI,IAAK,EAAA,EAAE,UAAa,GAAA,CAAA;AACtC,IAAO,MAAA,CAAA,IAAA;AAAA,MACL,CAAA,uBAAA,EAA0B,IAAI,CAAI,CAAA,EAAA,KAAA,CAAM,UAAW,CAAA,QAAA,CAAS,CAAG,EAAA,GAAG,CAAC,CAAA;AAAA,KACrE;AACA,IAAM,MAAA,eAAA,CAAgB,MAAQ,EAAA,IAAA,EAAM,KAAK,CAAA;AAAA,GAC3C;AAEA,EAAM,MAAA,MAAA,GAAS,UAAU,yBAA0B,CAAA;AAAA,IACjD,SAAA,EAAW,EAAE,IAAA,EAAM,WAAY,EAAA;AAAA;AAAA,IAC/B,OAAA,EAAS,EAAE,OAAA,EAAS,EAAG;AAAA,GACxB,CAAA;AAED,EAAA,MAAA,CAAO,GAAI,CAAA;AAAA,IACT,EAAI,EAAA,kBAAA;AAAA,IACJ,EAAI,EAAA;AAAA,GACL,CAAA;AAED,EAAA,MAAA,CAAO,KAAK,gDAAgD,CAAA;AAC5D,EAAA,MAAM,oBAAqB,EAAA;AAC7B;;;;;"}
1
+ {"version":3,"file":"partition.cjs.js","sources":["../../src/database/partition.ts"],"sourcesContent":["import { Knex } from 'knex';\n/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { LoggerService, SchedulerService } from '@backstage/backend-plugin-api';\nimport {\n extractOverlappingPartition,\n isPartitionOverlapError,\n parsePartitionDate,\n} from '../utils/partition';\n\ntype AttemptTracker = Map<string, number>;\n\nexport const createPartition = async (\n knex: Knex,\n year: number,\n month: number,\n attempts: AttemptTracker = new Map(),\n maxRetries = 1,\n) => {\n const start = new Date(year, month - 1, 1);\n const end = new Date(year, month, 1);\n\n const startDate = start.toISOString().slice(0, 10);\n const endDate = end.toISOString().slice(0, 10);\n\n const partitionName = `events_${year}_${month.toString().padStart(2, '0')}`;\n const key = `${year}_${month}`;\n\n // track max attempts\n const currentAttempt = attempts.get(key) ?? 0;\n if (currentAttempt > maxRetries) {\n throw new Error(`Exceeded max retries for partition ${key}`);\n }\n attempts.set(key, currentAttempt + 1);\n\n try {\n await knex.schema.raw(`\n CREATE TABLE IF NOT EXISTS ${partitionName} \n PARTITION OF events\n FOR VALUES FROM ('${startDate}') TO ('${endDate}');\n `);\n } catch (error) {\n if (isPartitionOverlapError(error)) {\n const overlappingPartition = extractOverlappingPartition(error.message);\n const { year: y, month: m } = parsePartitionDate(overlappingPartition);\n\n await knex.schema.raw(\n `DROP TABLE IF EXISTS ${overlappingPartition} CASCADE`,\n );\n\n // Recreate the dropped overlapping partition\n await createPartition(knex, y, m, attempts, maxRetries);\n\n // Retry the current one\n await createPartition(knex, year, month, attempts, maxRetries);\n } else {\n throw error;\n }\n }\n};\n\nexport const schedulePartition = async (\n client: Knex,\n services: {\n logger: LoggerService;\n scheduler: SchedulerService;\n },\n) => {\n const { logger, scheduler } = services;\n const partitionEventsTable = async () => {\n const year = new Date().getFullYear();\n const month = new Date().getMonth() + 1;\n logger.info(\n `Creating partition for ${year}_${month.toString().padStart(2, '0')}`,\n );\n await createPartition(client, year, month);\n };\n\n const runner = scheduler.createScheduledTaskRunner({\n frequency: { cron: '0 0 1 * *' }, // Runs at midnight on the 1st of every month\n timeout: { seconds: 30 },\n });\n\n runner.run({\n id: 'create-partition',\n fn: partitionEventsTable,\n });\n\n logger.info('[TASK] Running initial execution on startup...');\n await partitionEventsTable();\n};\n"],"names":["isPartitionOverlapError","extractOverlappingPartition","parsePartitionDate"],"mappings":";;;;AAyBa,MAAA,eAAA,GAAkB,OAC7B,IAAA,EACA,IACA,EAAA,KAAA,EACA,2BAA+B,IAAA,GAAA,EAC/B,EAAA,UAAA,GAAa,CACV,KAAA;AACH,EAAA,MAAM,QAAQ,IAAI,IAAA,CAAK,IAAM,EAAA,KAAA,GAAQ,GAAG,CAAC,CAAA;AACzC,EAAA,MAAM,GAAM,GAAA,IAAI,IAAK,CAAA,IAAA,EAAM,OAAO,CAAC,CAAA;AAEnC,EAAA,MAAM,YAAY,KAAM,CAAA,WAAA,EAAc,CAAA,KAAA,CAAM,GAAG,EAAE,CAAA;AACjD,EAAA,MAAM,UAAU,GAAI,CAAA,WAAA,EAAc,CAAA,KAAA,CAAM,GAAG,EAAE,CAAA;AAE7C,EAAM,MAAA,aAAA,GAAgB,CAAU,OAAA,EAAA,IAAI,CAAI,CAAA,EAAA,KAAA,CAAM,UAAW,CAAA,QAAA,CAAS,CAAG,EAAA,GAAG,CAAC,CAAA,CAAA;AACzE,EAAA,MAAM,GAAM,GAAA,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,KAAK,CAAA,CAAA;AAG5B,EAAA,MAAM,cAAiB,GAAA,QAAA,CAAS,GAAI,CAAA,GAAG,CAAK,IAAA,CAAA;AAC5C,EAAA,IAAI,iBAAiB,UAAY,EAAA;AAC/B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAsC,mCAAA,EAAA,GAAG,CAAE,CAAA,CAAA;AAAA;AAE7D,EAAS,QAAA,CAAA,GAAA,CAAI,GAAK,EAAA,cAAA,GAAiB,CAAC,CAAA;AAEpC,EAAI,IAAA;AACF,IAAM,MAAA,IAAA,CAAK,OAAO,GAAI,CAAA;AAAA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AA,MAAA,GAAS,UAAU,yBAA0B,CAAA;AAAA,IACjD,SAAA,EAAW,EAAE,IAAA,EAAM,WAAY,EAAA;AAAA;AAAA,IAC/B,OAAA,EAAS,EAAE,OAAA,EAAS,EAAG;AAAA,GACxB,CAAA;AAED,EAAA,MAAA,CAAO,GAAI,CAAA;AAAA,IACT,EAAI,EAAA,kBAAA;AAAA,IACJ,EAAI,EAAA;AAAA,GACL,CAAA;AAED,EAAA,MAAA,CAAO,KAAK,gDAAgD,CAAA;AAC5D,EAAA,MAAM,oBAAqB,EAAA;AAC7B;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EventBatchProcessor.cjs.js","sources":["../../src/domain/EventBatchProcessor.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { LoggerService } from '@backstage/backend-plugin-api/index';\nimport { EventDatabase } from '../database/event-database';\nimport { Event } from '../models/Event';\n\nexport type ProcessorConfigOptions = {\n debug?: boolean;\n batchSize?: number;\n maxRetries?: number;\n batchInterval?: number;\n};\nexport class EventBatchProcessor {\n private readonly queue: Event[];\n private processing: boolean;\n private readonly batchSize: number;\n private readonly batchInterval: number;\n private readonly maxRetries: number;\n private readonly failedEvents: any;\n private readonly database: EventDatabase;\n private readonly logger: LoggerService;\n private readonly debug: boolean;\n\n constructor(\n database: EventDatabase,\n logger: LoggerService,\n options: ProcessorConfigOptions,\n ) {\n this.queue = [];\n this.logger = logger;\n this.processing = false;\n this.database = database;\n this.failedEvents = new Map();\n this.debug = options.debug || false;\n\n const { batchSize = 5, maxRetries = 3, batchInterval = 2000 } = options;\n\n this.batchSize = batchSize;\n this.maxRetries = maxRetries;\n this.batchInterval = batchInterval;\n\n setInterval(() => this.processEvents(), this.batchInterval);\n setInterval(() => this.logQueueStats(), 5000);\n }\n\n addEvent(event: Event) {\n if (\n !this.queue.some((existingEvent: Event) => existingEvent.id === event.id)\n ) {\n this.logger.info(`[QUEUE] Event added: ${JSON.stringify(event)}`);\n this.queue.push({ ...event, toJSON: event.toJSON });\n }\n }\n\n async processEvents() {\n if (this.processing || this.queue.length === 0) return;\n this.processing = true;\n\n const batch = this.queue.splice(0, this.batchSize);\n try {\n await this.database.insertEvents(batch);\n this.logger.info(`[SUCCESS] Inserted ${batch.length} events`);\n batch.forEach((event: Event) => this.failedEvents.delete(event.id));\n } catch (error) {\n this.logger.error(`[ERROR] Batch insert failed:`, error);\n batch.forEach(event =>\n this.retryOrStoreFailedEvent(event, error.message),\n );\n }\n\n this.processing = false;\n }\n\n async retryOrStoreFailedEvent(event: Event, errorMessage: string) {\n const retries = this.failedEvents.get(event.id) || 0;\n if (retries >= this.maxRetries) {\n this.logger.error(\n `[DROPPED] Event permanently failed, storing in DB: ${JSON.stringify(\n event.toJSON(),\n )}`,\n );\n await this.storeFailedEvent(event, errorMessage);\n return;\n }\n\n this.failedEvents.set(event.id, retries + 1);\n this.queue.push(event);\n this.logger.warn(\n `[RETRY] Event re-added to queue (Attempt ${\n retries + 1\n }): ${JSON.stringify(event.toJSON())})`,\n );\n }\n\n async storeFailedEvent(event: Event, errorMessage: string) {\n try {\n await this.database.insertFailedEvent(\n JSON.stringify(event),\n errorMessage,\n this.maxRetries,\n );\n this.logger.warn(`[FAILED-LOGGED] Event stored in DB:`, event.toJSON());\n } catch (err) {\n this.logger.error(`[DB-ERROR] Failed to store event in DB:`, err);\n }\n }\n\n logQueueStats() {\n if (this.debug)\n this.logger.info(\n `[STATS] Queue Size: ${this.queue.length}, Failed Events: ${this.failedEvents.size}`,\n );\n }\n}\n"],"names":[],"mappings":";;AAyBO,MAAM,mBA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AAK,gBAAiB,CAAA,KAAA,EAAO,YAAY,CAAA;AAC/C,MAAA;AAAA;AAGF,IAAA,IAAA,CAAK,YAAa,CAAA,GAAA,CAAI,KAAM,CAAA,EAAA,EAAI,UAAU,CAAC,CAAA;AAC3C,IAAK,IAAA,CAAA,KAAA,CAAM,KAAK,KAAK,CAAA;AACrB,IAAA,IAAA,CAAK,MAAO,CAAA,IAAA;AAAA,MACV,CAAA,yCAAA,EACE,UAAU,CACZ,CAAA,GAAA,EAAM,KAAK,SAAU,CAAA,KAAA,CAAM,MAAO,EAAC,CAAC,CAAA,CAAA;AAAA,KACtC;AAAA;AACF,EAEA,MAAM,gBAAiB,CAAA,KAAA,EAAc,YAAsB,EAAA;AACzD,IAAI,IAAA;AACF,MAAA,MAAM,KAAK,QAAS,CAAA,iBAAA;AAAA,QAClB,IAAA,CAAK,UAAU,KAAK,CAAA;AAAA,QACpB,YAAA;AAAA,QACA,IAAK,CAAA;AAAA,OACP;AACA,MAAA,IAAA,CAAK,MAAO,CAAA,IAAA,CAAK,CAAuC,mCAAA,CAAA,EAAA,KAAA,CAAM,QAAQ,CAAA;AAAA,aAC/D,GAAK,EAAA;AACZ,MAAK,IAAA,CAAA,MAAA,CAAO,KAAM,CAAA,CAAA,uCAAA,CAAA,EAA2C,GAAG,CAAA;AAAA;AAClE;AACF,EAEA,aAAgB,GAAA;AACd,IAAA,IAAI,IAAK,CAAA,KAAA;AACP,MAAA,IAAA,CAAK,MAAO,CAAA,IAAA;AAAA,QACV,uBAAuB,IAAK,CAAA,KAAA,CAAM,MAAM,CAAoB,iBAAA,EAAA,IAAA,CAAK,aAAa,IAAI,CAAA;AAAA,OACpF;AAAA;AAEN;;;;"}
1
+ {"version":3,"file":"EventBatchProcessor.cjs.js","sources":["../../src/domain/EventBatchProcessor.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { LoggerService } from '@backstage/backend-plugin-api';\nimport { EventDatabase } from '../database/event-database';\nimport { Event } from '../models/Event';\n\nexport type ProcessorConfigOptions = {\n debug?: boolean;\n batchSize?: number;\n maxRetries?: number;\n batchInterval?: number;\n};\nexport class EventBatchProcessor {\n private readonly queue: Event[];\n private processing: boolean;\n private readonly batchSize: number;\n private readonly batchInterval: number;\n private readonly maxRetries: number;\n private readonly failedEvents: any;\n private readonly database: EventDatabase;\n private readonly logger: LoggerService;\n private readonly debug: boolean;\n\n constructor(\n database: EventDatabase,\n logger: LoggerService,\n options: ProcessorConfigOptions,\n ) {\n this.queue = [];\n this.logger = logger;\n this.processing = false;\n this.database = database;\n this.failedEvents = new Map();\n this.debug = options.debug || false;\n\n const { batchSize = 5, maxRetries = 3, batchInterval = 2000 } = options;\n\n this.batchSize = batchSize;\n this.maxRetries = maxRetries;\n this.batchInterval = batchInterval;\n\n setInterval(() => this.processEvents(), this.batchInterval);\n setInterval(() => this.logQueueStats(), 5000);\n }\n\n addEvent(event: Event) {\n if (\n !this.queue.some((existingEvent: Event) => existingEvent.id === event.id)\n ) {\n this.logger.info(`[QUEUE] Event added: ${JSON.stringify(event)}`);\n this.queue.push({ ...event, toJSON: event.toJSON });\n }\n }\n\n async processEvents() {\n if (this.processing || this.queue.length === 0) return;\n this.processing = true;\n\n const batch = this.queue.splice(0, this.batchSize);\n try {\n await this.database.insertEvents(batch);\n this.logger.info(`[SUCCESS] Inserted ${batch.length} events`);\n batch.forEach((event: Event) => this.failedEvents.delete(event.id));\n } catch (error) {\n this.logger.error(`[ERROR] Batch insert failed:`, error);\n batch.forEach(event =>\n this.retryOrStoreFailedEvent(event, error.message),\n );\n }\n\n this.processing = false;\n }\n\n async retryOrStoreFailedEvent(event: Event, errorMessage: string) {\n const retries = this.failedEvents.get(event.id) || 0;\n if (retries >= this.maxRetries) {\n this.logger.error(\n `[DROPPED] Event permanently failed, storing in DB: ${JSON.stringify(\n event.toJSON(),\n )}`,\n );\n await this.storeFailedEvent(event, errorMessage);\n return;\n }\n\n this.failedEvents.set(event.id, retries + 1);\n this.queue.push(event);\n this.logger.warn(\n `[RETRY] Event re-added to queue (Attempt ${\n retries + 1\n }): ${JSON.stringify(event.toJSON())})`,\n );\n }\n\n async storeFailedEvent(event: Event, errorMessage: string) {\n try {\n await this.database.insertFailedEvent(\n JSON.stringify(event),\n errorMessage,\n this.maxRetries,\n );\n this.logger.warn(`[FAILED-LOGGED] Event stored in DB:`, event.toJSON());\n } catch (err) {\n this.logger.error(`[DB-ERROR] Failed to store event in DB:`, err);\n }\n }\n\n logQueueStats() {\n if (this.debug)\n this.logger.info(\n `[STATS] Queue Size: ${this.queue.length}, Failed Events: ${this.failedEvents.size}`,\n );\n }\n}\n"],"names":[],"mappings":";;AAyBO,MAAM,mBAAoB,CAAA;AAAA,EACd,KAAA;AAAA,EACT,UAAA;AAAA,EACS,SAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EAEjB,WAAA,CACE,QACA,EAAA,MAAA,EACA,OACA,EAAA;AACA,IAAA,IAAA,CAAK,QAAQ,EAAC;AACd,IAAA,IAAA,CAAK,MAAS,GAAA,MAAA;AACd,IAAA,IAAA,CAAK,UAAa,GAAA,KAAA;AAClB,IAAA,IAAA,CAAK,QAAW,GAAA,QAAA;AAChB,IAAK,IAAA,CAAA,YAAA,uBAAmB,GAAI,EAAA;AAC5B,IAAK,IAAA,CAAA,KAAA,GAAQ,QAAQ,KAAS,IAAA,KAAA;AAE9B,IAAA,MAAM,EAAE,SAAY,GAAA,CAAA,EAAG,aAAa,CAAG,EAA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YAAA;AAAA,QACA,IAAK,CAAA;AAAA,OACP;AACA,MAAA,IAAA,CAAK,MAAO,CAAA,IAAA,CAAK,CAAuC,mCAAA,CAAA,EAAA,KAAA,CAAM,QAAQ,CAAA;AAAA,aAC/D,GAAK,EAAA;AACZ,MAAK,IAAA,CAAA,MAAA,CAAO,KAAM,CAAA,CAAA,uCAAA,CAAA,EAA2C,GAAG,CAAA;AAAA;AAClE;AACF,EAEA,aAAgB,GAAA;AACd,IAAA,IAAI,IAAK,CAAA,KAAA;AACP,MAAA,IAAA,CAAK,MAAO,CAAA,IAAA;AAAA,QACV,uBAAuB,IAAK,CAAA,KAAA,CAAM,MAAM,CAAoB,iBAAA,EAAA,IAAA,CAAK,aAAa,IAAI,CAAA;AAAA,OACpF;AAAA;AAEN;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.cjs.js","sources":["../../src/utils/config.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { RootConfigService } from '@backstage/backend-plugin-api/index';\nimport { ProcessorConfigOptions } from '../domain/EventBatchProcessor';\n\nexport const getConfigurationOptions = (\n config: RootConfigService,\n): ProcessorConfigOptions => {\n const batchSize =\n config.getOptionalNumber('app.analytics.adoptionInsights.maxBufferSize') ||\n 5;\n\n const batchInterval =\n config.getOptionalNumber('app.analytics.adoptionInsights.flushInterval') ||\n 2000;\n\n const debug =\n config.getOptionalBoolean('app.analytics.adoptionInsights.debug') || false;\n\n return {\n debug,\n batchSize,\n batchInterval,\n };\n};\nexport const getLicensedUsersCount = (config: RootConfigService) => {\n return (\n config.getOptionalNumber('app.analytics.adoptionInsights.licensedUsers') ||\n 100\n );\n};\n"],"names":[],"mappings":";;AAkBa,MAAA,uBAAA,GAA0B,CACrC,MAC2B,KAAA;AAC3B,EAAA,MAAM,SACJ,GAAA,MAAA,CAAO,iBAAkB,CAAA,8CAA8C,CACvE,IAAA,CAAA;AAEF,EAAA,MAAM,aACJ,GAAA,MAAA,CAAO,iBAAkB,CAAA,8CAA8C,CACvE,IAAA,GAAA;AAEF,EAAA,MAAM,KACJ,GAAA,MAAA,CAAO,kBAAmB,CAAA,sCAAsC,CAAK,IAAA,KAAA;AAEvE,EAAO,OAAA;AAAA,IACL,KAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACF;AACa,MAAA,qBAAA,GAAwB,CAAC,MAA8B,KAAA;AAClE,EACE,OAAA,MAAA,CAAO,iBAAkB,CAAA,8CAA8C,CACvE,IAAA,GAAA;AAEJ;;;;;"}
1
+ {"version":3,"file":"config.cjs.js","sources":["../../src/utils/config.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { RootConfigService } from '@backstage/backend-plugin-api';\nimport { ProcessorConfigOptions } from '../domain/EventBatchProcessor';\n\nexport const getConfigurationOptions = (\n config: RootConfigService,\n): ProcessorConfigOptions => {\n const batchSize =\n config.getOptionalNumber('app.analytics.adoptionInsights.maxBufferSize') ||\n 5;\n\n const batchInterval =\n config.getOptionalNumber('app.analytics.adoptionInsights.flushInterval') ||\n 2000;\n\n const debug =\n config.getOptionalBoolean('app.analytics.adoptionInsights.debug') || false;\n\n return {\n debug,\n batchSize,\n batchInterval,\n };\n};\nexport const getLicensedUsersCount = (config: RootConfigService) => {\n return (\n config.getOptionalNumber('app.analytics.adoptionInsights.licensedUsers') ||\n 100\n );\n};\n"],"names":[],"mappings":";;AAkBa,MAAA,uBAAA,GAA0B,CACrC,MAC2B,KAAA;AAC3B,EAAA,MAAM,SACJ,GAAA,MAAA,CAAO,iBAAkB,CAAA,8CAA8C,CACvE,IAAA,CAAA;AAEF,EAAA,MAAM,aACJ,GAAA,MAAA,CAAO,iBAAkB,CAAA,8CAA8C,CACvE,IAAA,GAAA;AAEF,EAAA,MAAM,KACJ,GAAA,MAAA,CAAO,kBAAmB,CAAA,sCAAsC,CAAK,IAAA,KAAA;AAEvE,EAAO,OAAA;AAAA,IACL,KAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACF;AACF;AACa,MAAA,qBAAA,GAAwB,CAAC,MAA8B,KAAA;AAClE,EACE,OAAA,MAAA,CAAO,iBAAkB,CAAA,8CAA8C,CACvE,IAAA,GAAA;AAEJ;;;;;"}
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const extractOverlappingPartition = (message) => {
4
+ const match = message.match(/would overlap partition "(.*?)"$/);
5
+ return match?.[1] || "";
6
+ };
7
+ const parsePartitionDate = (name) => {
8
+ const match = name.match(/events_(\d{4})_(\d{1,2})/);
9
+ if (!match) throw new Error(`Cannot parse partition name: ${name}`);
10
+ return { year: parseInt(match[1], 10), month: parseInt(match[2], 10) };
11
+ };
12
+ const isPartitionOverlapError = (error) => {
13
+ return error !== null && typeof error.message === "string" && error.message.includes("would overlap partition");
14
+ };
15
+
16
+ exports.extractOverlappingPartition = extractOverlappingPartition;
17
+ exports.isPartitionOverlapError = isPartitionOverlapError;
18
+ exports.parsePartitionDate = parsePartitionDate;
19
+ //# sourceMappingURL=partition.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partition.cjs.js","sources":["../../src/utils/partition.ts"],"sourcesContent":["/*\n * Copyright Red Hat, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const extractOverlappingPartition = (message: string): string => {\n const match = message.match(/would overlap partition \"(.*?)\"$/);\n return match?.[1] || '';\n};\n\nexport const parsePartitionDate = (\n name: string,\n): { year: number; month: number } => {\n const match = name.match(/events_(\\d{4})_(\\d{1,2})/);\n if (!match) throw new Error(`Cannot parse partition name: ${name}`);\n return { year: parseInt(match[1], 10), month: parseInt(match[2], 10) };\n};\n\nexport const isPartitionOverlapError = (error: unknown): boolean => {\n return (\n error !== null &&\n typeof (error as any).message === 'string' &&\n (error as any).message.includes('would overlap partition')\n );\n};\n"],"names":[],"mappings":";;AAea,MAAA,2BAAA,GAA8B,CAAC,OAA4B,KAAA;AACtE,EAAM,MAAA,KAAA,GAAQ,OAAQ,CAAA,KAAA,CAAM,kCAAkC,CAAA;AAC9D,EAAO,OAAA,KAAA,GAAQ,CAAC,CAAK,IAAA,EAAA;AACvB;AAEa,MAAA,kBAAA,GAAqB,CAChC,IACoC,KAAA;AACpC,EAAM,MAAA,KAAA,GAAQ,IAAK,CAAA,KAAA,CAAM,0BAA0B,CAAA;AACnD,EAAA,IAAI,CAAC,KAAO,EAAA,MAAM,IAAI,KAAM,CAAA,CAAA,6BAAA,EAAgC,IAAI,CAAE,CAAA,CAAA;AAClE,EAAA,OAAO,EAAE,IAAA,EAAM,QAAS,CAAA,KAAA,CAAM,CAAC,CAAG,EAAA,EAAE,CAAG,EAAA,KAAA,EAAO,QAAS,CAAA,KAAA,CAAM,CAAC,CAAA,EAAG,EAAE,CAAE,EAAA;AACvE;AAEa,MAAA,uBAAA,GAA0B,CAAC,KAA4B,KAAA;AAClE,EACE,OAAA,KAAA,KAAU,QACV,OAAQ,KAAA,CAAc,YAAY,QACjC,IAAA,KAAA,CAAc,OAAQ,CAAA,QAAA,CAAS,yBAAyB,CAAA;AAE7D;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@red-hat-developer-hub/backstage-plugin-adoption-insights-backend",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,7 +21,10 @@
21
21
  "@red-hat-developer-hub/backstage-plugin-adoption-insights",
22
22
  "@red-hat-developer-hub/backstage-plugin-adoption-insights-backend",
23
23
  "@red-hat-developer-hub/backstage-plugin-adoption-insights-common"
24
- ]
24
+ ],
25
+ "features": {
26
+ ".": "@backstage/BackendFeature"
27
+ }
25
28
  },
26
29
  "scripts": {
27
30
  "start": "backstage-cli package start",
@@ -33,13 +36,13 @@
33
36
  "postpack": "backstage-cli package postpack"
34
37
  },
35
38
  "dependencies": {
36
- "@backstage/backend-defaults": "^0.7.0",
37
- "@backstage/backend-plugin-api": "^1.1.1",
38
- "@backstage/core-plugin-api": "^1.10.3",
39
+ "@backstage/backend-defaults": "^0.8.1",
40
+ "@backstage/backend-plugin-api": "^1.2.0",
41
+ "@backstage/core-plugin-api": "^1.10.4",
39
42
  "@backstage/errors": "^1.2.7",
40
43
  "@backstage/plugin-catalog-node": "^1.15.1",
41
44
  "@backstage/plugin-permission-common": "^0.8.4",
42
- "@red-hat-developer-hub/backstage-plugin-adoption-insights-common": "^0.1.1",
45
+ "@red-hat-developer-hub/backstage-plugin-adoption-insights-common": "^0.2.0",
43
46
  "express": "^4.17.1",
44
47
  "express-promise-router": "^4.1.0",
45
48
  "json-2-csv": "^5.5.8",
@@ -50,7 +53,7 @@
50
53
  },
51
54
  "devDependencies": {
52
55
  "@backstage/backend-test-utils": "^1.3.0",
53
- "@backstage/cli": "^0.29.6",
56
+ "@backstage/cli": "^0.30.0",
54
57
  "@types/express": "^4.17.6",
55
58
  "@types/supertest": "^2.0.12",
56
59
  "supertest": "^6.2.4"