Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/young-terms-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'hive': patch
---

fix: correct RPM chart Y-axis scale to match actual values
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
PaginationState,
useReactTable,
} from '@tanstack/react-table';
import { OperationsFallback } from './Fallback';
import { OperationsFallback } from './fallback';

interface Operation {
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { createAdaptiveTimeFormatter } from '@/lib/date-time';
import {
formatDuration,
formatNumber,
formatThroughput,
formatRpm,
toDecimal,
useFormattedDuration,
useFormattedNumber,
Expand All @@ -31,7 +31,7 @@ import {
import { pick } from '@/lib/object';
import { useChartStyles } from '@/lib/utils';
import { useRouter } from '@tanstack/react-router';
import { OperationsFallback } from './Fallback';
import { OperationsFallback } from './fallback';
import { resolutionToMilliseconds } from './utils';

const Stats_GeneralOperationsStatsQuery = graphql(`
Expand Down Expand Up @@ -947,8 +947,7 @@ function RpmOverTimeStats({
const { requestsOverTime: requests = [] } =
useFragment(RpmOverTimeStats_OperationStatsFragment, operationStats) ?? {};

const interval = resolutionToMilliseconds(resolution, period);
const windowInM = interval / (60 * 1000);
const windowInM = resolutionToMilliseconds(resolution, period) / (60 * 1000);
const rpmOverTime = useMemo(() => {
if (requests.length) {
return requests.map<[string, number]>(node => [
Expand Down Expand Up @@ -1005,7 +1004,7 @@ function RpmOverTimeStats({
boundaryGap: false,
min: 0,
axisLabel: {
formatter: (value: number) => formatThroughput(value * 10, interval),
formatter: (value: number) => formatRpm(value),
},
splitLine: {
lineStyle: {
Expand Down
2 changes: 1 addition & 1 deletion packages/web/app/src/lib/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export { useClipboard } from './use-clipboard';
export { toDecimal, useDecimal } from './use-decimal';
export { formatDuration, useFormattedDuration } from './use-formatted-duration';
export { formatNumber, useFormattedNumber } from './use-formatted-number';
export { formatThroughput, useFormattedThroughput } from './use-formatted-throughput';
export { formatRpm, formatThroughput, useFormattedThroughput } from './use-formatted-throughput';
export { useLocalStorageJson } from './use-local-storage-json';
export { useLocalStorage } from './use-local-storage';
export { useNotifications } from './use-notifications';
Expand Down
10 changes: 6 additions & 4 deletions packages/web/app/src/lib/hooks/use-formatted-throughput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import React from 'react';
import { toDecimal } from './use-decimal';
import { formatNumber } from './use-formatted-number';

export function formatThroughput(requests: number, window: number) {
const distance = window / (60 * 1000);
const rpm = requests / distance;

export function formatRpm(rpm: number) {
if (rpm >= 1000) {
return formatNumber(rpm);
}
Expand All @@ -21,6 +18,11 @@ export function formatThroughput(requests: number, window: number) {
return toDecimal(rpm, 4);
}

export function formatThroughput(requests: number, window: number) {
const distance = window / (60 * 1000);
return formatRpm(requests / distance);
}

export function useFormattedThroughput({
requests,
window,
Expand Down
2 changes: 1 addition & 1 deletion packages/web/app/src/pages/target-insights-operation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useQuery } from 'urql';
import { Section } from '@/components/common';
import { GraphQLHighlight } from '@/components/common/GraphQLSDLBlock';
import { Page, TargetLayout } from '@/components/layouts/target';
import { OperationsStats } from '@/components/target/insights/Stats';
import { OperationsStats } from '@/components/target/insights/stats';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import { Button } from '@/components/ui/button';
import { DateRangePicker, presetLast1Day } from '@/components/ui/date-range-picker';
Expand Down
4 changes: 2 additions & 2 deletions packages/web/app/src/pages/target-insights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import type { SavedFilterView } from '@/components/base/insights-filters';
import { InsightsFilters } from '@/components/base/insights-filters';
import { TriggerButton } from '@/components/base/trigger-button';
import { Page, TargetLayout } from '@/components/layouts/target';
import { OperationsList } from '@/components/target/insights/List';
import { OperationsList } from '@/components/target/insights/list';
import { SaveFilterButton } from '@/components/target/insights/save-filter-button';
import { OperationsStats } from '@/components/target/insights/Stats';
import { OperationsStats } from '@/components/target/insights/stats';
import { DateRangePicker, presetLast7Days } from '@/components/ui/date-range-picker';
import { EmptyList } from '@/components/ui/empty-list';
import { Meta } from '@/components/ui/meta';
Expand Down
Loading
Loading