1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

feat: metrics periods expressed in days (#5928)

This commit is contained in:
Mateusz Kwasniewski 2024-01-18 11:54:20 +01:00 committed by GitHub
parent f5cf118b12
commit d3215335c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 15 deletions

View File

@ -29,7 +29,7 @@ test('Display extended daily metrics', async () => {
userEvent.click(intialSelectedValue);
const newSelectedValue = await screen.findByText('Last week');
const newSelectedValue = await screen.findByText('Last 7 days');
userEvent.click(newSelectedValue);

View File

@ -2,7 +2,6 @@ import { styled } from '@mui/material';
import GeneralSelect, {
IGeneralSelectProps,
} from 'component/common/GeneralSelect/GeneralSelect';
import { subWeeks, subMonths, differenceInHours } from 'date-fns';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import { useExtendedFeatureMetrics } from '../useExtendedFeatureMetrics';
@ -74,20 +73,15 @@ const now = new Date();
const daysOptions: { key: `${number}`; label: string }[] = [
{
key: `${differenceInHours(now, subWeeks(now, 1))}`,
label: 'Last week',
key: `${7 * 24}`,
label: 'Last 7 days',
},
{
key: `${differenceInHours(now, subMonths(now, 1))}`,
label: 'Last month',
key: `${30 * 24}`,
label: 'Last 30 days',
},
{
key: `${differenceInHours(now, subMonths(now, 3))}`,
label: 'Last 3 months',
key: `${90 * 24}`,
label: 'Last 90 days',
},
];
export const FEATURE_METRIC_HOURS_BACK_MAX = differenceInHours(
now,
subMonths(now, 3),
);

View File

@ -553,7 +553,7 @@ export function createConfig(options: IUnleashOptions): IUnleashConfig {
const dailyMetricsStorageDays = Math.min(
parseEnvVarNumber(process.env.DAILY_METRICS_STORAGE_DAYS, 31),
92,
91,
);
return {

View File

@ -39,7 +39,7 @@ class ClientMetricsController extends Controller {
private static HOURS_BACK_MAX = 48;
private static HOURS_BACK_MAX_V2 = 24 * 31 * 3; // 3 months
private static HOURS_BACK_MAX_V2 = 24 * 91; // 91 days
constructor(
config: IUnleashConfig,