mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
Fix stale field mapping in external chart api (#247)
This commit is contained in:
parent
c5b10759ff
commit
9c666fb915
2 changed files with 18 additions and 0 deletions
6
.changeset/breezy-kangaroos-lie.md
Normal file
6
.changeset/breezy-kangaroos-lie.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
'@hyperdx/api': patch
|
||||
---
|
||||
|
||||
Fixed /api/v1/logs/chart from returning null values due to stale property type
|
||||
mappings
|
||||
|
|
@ -9,6 +9,7 @@ import * as clickhouse from '@/clickhouse';
|
|||
import { getTeam } from '@/controllers/team';
|
||||
import { validateUserAccessKey } from '@/middleware/auth';
|
||||
import { Api400Error, Api403Error } from '@/utils/errors';
|
||||
import logger from '@/utils/logger';
|
||||
import rateLimiter from '@/utils/rateLimiter';
|
||||
import { SimpleCache } from '@/utils/redis';
|
||||
|
||||
|
|
@ -115,6 +116,17 @@ router.get(
|
|||
endTimeNum,
|
||||
);
|
||||
|
||||
// TODO: hacky way to make sure the cache is update to date
|
||||
if (
|
||||
!clickhouse.doesLogsPropertyExist(field, propertyTypeMappingsModel) ||
|
||||
!clickhouse.doesLogsPropertyExist(groupBy, propertyTypeMappingsModel)
|
||||
) {
|
||||
logger.warn({
|
||||
message: `getChart: Property type mappings cache is out of date (${field}, ${groupBy}})`,
|
||||
});
|
||||
await propertyTypeMappingsModel.refresh();
|
||||
}
|
||||
|
||||
// TODO: expose this to the frontend ?
|
||||
const MAX_NUM_GROUPS = 20;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue