chore: fixing parsing

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2023-09-22 16:25:09 +02:00
parent 78af9433c8
commit 54299c496e
@@ -18,6 +18,7 @@ import { Knex } from 'knex';
import { createGaugeMetric } from '../util/metrics';
import { DbRefreshStateRow, DbRelationsRow, DbLocationsRow } from './tables';
import { metrics } from '@opentelemetry/api';
import { parseEntityRef } from '@backstage/catalog-model';
export function initDatabaseMetrics(knex: Knex) {
const seenProm = new Set<string>();
@@ -79,7 +80,7 @@ export function initDatabaseMetrics(knex: Knex) {
'entity_ref',
);
const results = result
.map(row => row.entity_ref.split(':')[0])
.map(row => parseEntityRef(row.entity_ref).kind)
.reduce((acc, e) => acc.set(e, (acc.get(e) || 0) + 1), new Map());
results.forEach((value, key) => {