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:
parent
f5cf118b12
commit
d3215335c9
@ -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);
|
||||
|
||||
|
@ -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),
|
||||
);
|
||||
|
@ -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 {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user