mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-27 01:19:00 +02: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);
|
userEvent.click(intialSelectedValue);
|
||||||
|
|
||||||
const newSelectedValue = await screen.findByText('Last week');
|
const newSelectedValue = await screen.findByText('Last 7 days');
|
||||||
|
|
||||||
userEvent.click(newSelectedValue);
|
userEvent.click(newSelectedValue);
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ import { styled } from '@mui/material';
|
|||||||
import GeneralSelect, {
|
import GeneralSelect, {
|
||||||
IGeneralSelectProps,
|
IGeneralSelectProps,
|
||||||
} from 'component/common/GeneralSelect/GeneralSelect';
|
} from 'component/common/GeneralSelect/GeneralSelect';
|
||||||
import { subWeeks, subMonths, differenceInHours } from 'date-fns';
|
|
||||||
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||||
import { useExtendedFeatureMetrics } from '../useExtendedFeatureMetrics';
|
import { useExtendedFeatureMetrics } from '../useExtendedFeatureMetrics';
|
||||||
|
|
||||||
@ -74,20 +73,15 @@ const now = new Date();
|
|||||||
|
|
||||||
const daysOptions: { key: `${number}`; label: string }[] = [
|
const daysOptions: { key: `${number}`; label: string }[] = [
|
||||||
{
|
{
|
||||||
key: `${differenceInHours(now, subWeeks(now, 1))}`,
|
key: `${7 * 24}`,
|
||||||
label: 'Last week',
|
label: 'Last 7 days',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: `${differenceInHours(now, subMonths(now, 1))}`,
|
key: `${30 * 24}`,
|
||||||
label: 'Last month',
|
label: 'Last 30 days',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: `${differenceInHours(now, subMonths(now, 3))}`,
|
key: `${90 * 24}`,
|
||||||
label: 'Last 3 months',
|
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(
|
const dailyMetricsStorageDays = Math.min(
|
||||||
parseEnvVarNumber(process.env.DAILY_METRICS_STORAGE_DAYS, 31),
|
parseEnvVarNumber(process.env.DAILY_METRICS_STORAGE_DAYS, 31),
|
||||||
92,
|
91,
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -39,7 +39,7 @@ class ClientMetricsController extends Controller {
|
|||||||
|
|
||||||
private static HOURS_BACK_MAX = 48;
|
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(
|
constructor(
|
||||||
config: IUnleashConfig,
|
config: IUnleashConfig,
|
||||||
|
Loading…
Reference in New Issue
Block a user