fix(stats): display consistent query count on stats tab (#8151)

This commit is contained in:
Joshua Eilers 2023-05-31 08:33:02 -07:00 committed by GitHub
parent 6c445c891a
commit 4ade1311f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -18,6 +18,7 @@ export const DatasetStatsSummarySubHeader = () => {
const rowCount = maybeLastProfile?.rowCount;
const columnCount = maybeLastProfile?.columnCount;
const sizeInBytes = maybeLastProfile?.sizeInBytes;
const totalSqlQueries = dataset?.usageStats?.aggregations?.totalSqlQueries;
const queryCountLast30Days = maybeStatsSummary?.queryCountLast30Days;
const uniqueUserCountLast30Days = maybeStatsSummary?.uniqueUserCountLast30Days;
const lastUpdatedMs = maybeLastOperation?.lastUpdatedTimestamp;
@ -27,6 +28,7 @@ export const DatasetStatsSummarySubHeader = () => {
rowCount={rowCount}
columnCount={columnCount}
sizeInBytes={sizeInBytes}
totalSqlQueries={totalSqlQueries}
queryCountLast30Days={queryCountLast30Days}
uniqueUserCountLast30Days={uniqueUserCountLast30Days}
lastUpdatedMs={lastUpdatedMs}

View File

@ -20,6 +20,7 @@ type Props = {
rowCount?: number | null;
columnCount?: number | null;
sizeInBytes?: number | null;
totalSqlQueries?: number | null;
queryCountLast30Days?: number | null;
uniqueUserCountLast30Days?: number | null;
lastUpdatedMs?: number | null;
@ -30,6 +31,7 @@ export const DatasetStatsSummary = ({
rowCount,
columnCount,
sizeInBytes,
totalSqlQueries,
queryCountLast30Days,
uniqueUserCountLast30Days,
lastUpdatedMs,
@ -55,10 +57,11 @@ export const DatasetStatsSummary = ({
<FormattedBytesStat bytes={sizeInBytes} />
</StatText>
),
!!queryCountLast30Days && (
(!!queryCountLast30Days || !!totalSqlQueries) && (
<StatText color={displayedColor}>
<ConsoleSqlOutlined style={{ marginRight: 8, color: displayedColor }} />
<b>{formatNumberWithoutAbbreviation(queryCountLast30Days)}</b> queries last month
<b>{formatNumberWithoutAbbreviation(queryCountLast30Days || totalSqlQueries)}</b>{' '}
{queryCountLast30Days ? <>queries last month</> : <>monthly queries</>}
</StatText>
),
!!uniqueUserCountLast30Days && (

View File

@ -51,6 +51,9 @@ export default function StatsTab() {
latestProfile?.timestampMillis,
)}`;
const totalSqlQueries = usageStats?.aggregations?.totalSqlQueries;
const queryCountLast30Days = baseEntity.dataset?.statsSummary?.queryCountLast30Days;
const statsHeader = (
<StatsHeader
viewType={viewType}
@ -66,7 +69,7 @@ export default function StatsTab() {
<TableStats
rowCount={latestProfile?.rowCount || undefined}
columnCount={latestProfile?.columnCount || undefined}
queryCount={usageStats?.aggregations?.totalSqlQueries || undefined}
queryCount={queryCountLast30Days || totalSqlQueries || undefined}
users={usageStats?.aggregations?.users || undefined}
lastUpdatedTime={lastUpdatedTime || undefined}
lastReportedTime={lastReportedTime || undefined}