Compare commits

...

9 Commits

Author SHA1 Message Date
Hassan Ben Jobrane
607d89e2aa Merge pull request #2215 from nhost/changeset-release/main
chore: update versions
2023-09-01 19:13:41 +01:00
github-actions[bot]
0cca72311c chore: update versions 2023-09-01 15:26:44 +00:00
Hassan Ben Jobrane
a6525b6467 Merge pull request #2214 from nhost/feat/update-usage-metrics
feat(dashboard): update usage metrics
2023-09-01 16:24:06 +01:00
Hassan Ben Jobrane
387be37b6e chore: remove redundant egress card 2023-09-01 15:30:01 +01:00
Hassan Ben Jobrane
c8fd8bbcc7 fix: update storage upper limit for pro plan 2023-09-01 13:01:27 +01:00
Hassan Ben Jobrane
bfb34bad00 fix: use correct value for functions duration 2023-09-01 12:28:19 +01:00
Hassan Ben Jobrane
666a75a233 chore: add changeset 2023-09-01 12:26:41 +01:00
Hassan Ben Jobrane
3b050217df feat(dashboard): tweak usage metrics 2023-09-01 12:25:15 +01:00
Hassan Ben Jobrane
0ed4481615 feat(dashboard): update usage metrics 2023-09-01 11:14:49 +01:00
7 changed files with 111 additions and 12 deletions

View File

@@ -1,5 +1,11 @@
# @nhost/dashboard # @nhost/dashboard
## 0.20.10
### Patch Changes
- 666a75a23: feat(dashboard): add functions execution time and egress volume to usage stats
## 0.20.9 ## 0.20.9
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost/dashboard", "name": "@nhost/dashboard",
"version": "0.20.9", "version": "0.20.10",
"private": true, "private": true,
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm", "preinstall": "npx only-allow pnpm",

View File

@@ -7,14 +7,15 @@ import MaterialLinearProgress, {
export interface LinearProgressProps extends MaterialLinearProgressProps {} export interface LinearProgressProps extends MaterialLinearProgressProps {}
const LinearProgress = styled(MaterialLinearProgress)(({ theme }) => ({ const LinearProgress = styled(MaterialLinearProgress)(({ theme, value }) => ({
height: 12, height: 12,
borderRadius: 1, borderRadius: 1,
[`&.${linearProgressClasses.colorPrimary}`]: { [`&.${linearProgressClasses.colorPrimary}`]: {
backgroundColor: theme.palette.grey[300], backgroundColor: theme.palette.grey[300],
}, },
[`& .${linearProgressClasses.bar}`]: { [`& .${linearProgressClasses.bar}`]: {
backgroundColor: theme.palette.primary.main, backgroundColor:
value >= 100 ? theme.palette.error.dark : theme.palette.primary.main,
}, },
})); }));

View File

@@ -41,11 +41,6 @@ export default function OverviewMetrics() {
numberOfDecimals: 0, numberOfDecimals: 0,
}), }),
}, },
{
label: 'Egress Volume',
tooltip: 'Amount of data your services have sent to users',
value: prettifySize(data?.egressVolume?.value || 0),
},
{ {
label: 'Logs', label: 'Logs',
tooltip: 'Amount of logs stored', tooltip: 'Amount of logs stored',

View File

@@ -96,7 +96,7 @@ export function OverviewUsageMetrics() {
remoteAppMetricsData?.filesAggregate?.aggregate?.sum?.size || 0; remoteAppMetricsData?.filesAggregate?.aggregate?.sum?.size || 0;
const totalStorage = currentProject?.plan?.isFree const totalStorage = currentProject?.plan?.isFree
? 1 * 1000 ** 3 // 1 GB ? 1 * 1000 ** 3 // 1 GB
: 10 * 1000 ** 3; // 10 GB : 50 * 1000 ** 3; // 10 GB
// metrics for users // metrics for users
const usedUsers = remoteAppMetricsData?.usersAggregate?.aggregate?.count || 0; const usedUsers = remoteAppMetricsData?.usersAggregate?.aggregate?.count || 0;
@@ -105,6 +105,16 @@ export function OverviewUsageMetrics() {
// metrics for functions // metrics for functions
const usedFunctions = functionsInfoData?.app.metadataFunctions.length || 0; const usedFunctions = functionsInfoData?.app.metadataFunctions.length || 0;
const totalFunctions = currentProject?.plan?.isFree ? 10 : 50; const totalFunctions = currentProject?.plan?.isFree ? 10 : 50;
const usedFunctionsDuration = projectMetrics?.functionsDuration.value || 0;
const totalFunctionsDuration = currentProject?.plan?.isFree
? 3600 // 1 hour
: 3600 * 10; // 10 hours
// metrics for egress
const usedEgressVolume = projectMetrics?.egressVolume.value || 0;
const totalEgressVolume = currentProject?.plan?.isFree
? 5 * 1000 ** 3 // 5 GB
: 10 * 1000 ** 3; // 50 GB
if (metricsLoading) { if (metricsLoading) {
return ( return (
@@ -112,7 +122,9 @@ export function OverviewUsageMetrics() {
<UsageProgress label="Database" percentage={0} /> <UsageProgress label="Database" percentage={0} />
<UsageProgress label="Storage" percentage={0} /> <UsageProgress label="Storage" percentage={0} />
<UsageProgress label="Users" percentage={0} /> <UsageProgress label="Users" percentage={0} />
<UsageProgress label="Functions" percentage={0} /> <UsageProgress label="Number of Functions" percentage={0} />
<UsageProgress label="Functions Execution Time" percentage={0} />
<UsageProgress label="Egress Volume" percentage={0} />
</div> </div>
); );
} }
@@ -139,6 +151,18 @@ export function OverviewUsageMetrics() {
used={usedFunctions} used={usedFunctions}
percentage={100} percentage={100}
/> />
<UsageProgress
label="Functions"
used={usedFunctionsDuration}
percentage={100}
/>
<UsageProgress
label="Egress"
used={usedEgressVolume}
percentage={100}
/>
</div> </div>
); );
} }
@@ -167,11 +191,25 @@ export function OverviewUsageMetrics() {
/> />
<UsageProgress <UsageProgress
label="Functions" label="Number of Functions"
used={usedFunctions} used={usedFunctions}
total={totalFunctions} total={totalFunctions}
percentage={(usedFunctions / totalFunctions) * 100} percentage={(usedFunctions / totalFunctions) * 100}
/> />
<UsageProgress
label="Functions Execution Time"
used={usedFunctionsDuration}
total={`${totalFunctionsDuration} seconds`}
percentage={(usedFunctionsDuration / totalFunctionsDuration) * 100}
/>
<UsageProgress
label="Egress Volume"
used={prettifySize(usedEgressVolume)}
total={prettifySize(totalEgressVolume)}
percentage={(usedEgressVolume / totalEgressVolume) * 100}
/>
</div> </div>
); );
} }

View File

@@ -17,6 +17,9 @@ query GetProjectMetrics(
) { ) {
value value
} }
functionsDuration: getFunctionsDuration(appID: $appId, from: $from, to: $to) {
value
}
postgresVolumeCapacity: getPostgresVolumeCapacity(appID: $appId) { postgresVolumeCapacity: getPostgresVolumeCapacity(appID: $appId) {
value value
} }

View File

@@ -2109,6 +2109,15 @@ export type String_Comparison_Exp = {
_similar?: InputMaybe<Scalars['String']>; _similar?: InputMaybe<Scalars['String']>;
}; };
export type UsageSummary = {
__typename?: 'UsageSummary';
EgressBytes: Scalars['float64'];
EgressCDNBytes: Scalars['float64'];
EgressPgbouncerBytes: Scalars['float64'];
LambdaUsageSeconds: Scalars['float64'];
appID: Scalars['uuid'];
};
/** columns and relationships of "app_state_history" */ /** columns and relationships of "app_state_history" */
export type AppStateHistory = { export type AppStateHistory = {
__typename?: 'appStateHistory'; __typename?: 'appStateHistory';
@@ -6485,6 +6494,8 @@ export type Billing_Subscriptions = {
app_id: Scalars['uuid']; app_id: Scalars['uuid'];
created_at: Scalars['timestamptz']; created_at: Scalars['timestamptz'];
dedicated_compute?: Maybe<Scalars['String']>; dedicated_compute?: Maybe<Scalars['String']>;
egress?: Maybe<Scalars['String']>;
functions?: Maybe<Scalars['String']>;
id: Scalars['uuid']; id: Scalars['uuid'];
updated_at: Scalars['timestamptz']; updated_at: Scalars['timestamptz'];
}; };
@@ -6520,6 +6531,8 @@ export type Billing_Subscriptions_Bool_Exp = {
app_id?: InputMaybe<Uuid_Comparison_Exp>; app_id?: InputMaybe<Uuid_Comparison_Exp>;
created_at?: InputMaybe<Timestamptz_Comparison_Exp>; created_at?: InputMaybe<Timestamptz_Comparison_Exp>;
dedicated_compute?: InputMaybe<String_Comparison_Exp>; dedicated_compute?: InputMaybe<String_Comparison_Exp>;
egress?: InputMaybe<String_Comparison_Exp>;
functions?: InputMaybe<String_Comparison_Exp>;
id?: InputMaybe<Uuid_Comparison_Exp>; id?: InputMaybe<Uuid_Comparison_Exp>;
updated_at?: InputMaybe<Timestamptz_Comparison_Exp>; updated_at?: InputMaybe<Timestamptz_Comparison_Exp>;
}; };
@@ -6530,6 +6543,10 @@ export enum Billing_Subscriptions_Constraint {
SubscriptionsAppIdKey = 'subscriptions_app_id_key', SubscriptionsAppIdKey = 'subscriptions_app_id_key',
/** unique or primary key constraint on columns "dedicated_compute" */ /** unique or primary key constraint on columns "dedicated_compute" */
SubscriptionsDedicatedComputeKey = 'subscriptions_dedicated_compute_key', SubscriptionsDedicatedComputeKey = 'subscriptions_dedicated_compute_key',
/** unique or primary key constraint on columns "egress" */
SubscriptionsEgressKey = 'subscriptions_egress_key',
/** unique or primary key constraint on columns "functions" */
SubscriptionsFunctionsKey = 'subscriptions_functions_key',
/** unique or primary key constraint on columns "id" */ /** unique or primary key constraint on columns "id" */
SubscriptionsPkey = 'subscriptions_pkey' SubscriptionsPkey = 'subscriptions_pkey'
} }
@@ -6540,6 +6557,8 @@ export type Billing_Subscriptions_Insert_Input = {
app_id?: InputMaybe<Scalars['uuid']>; app_id?: InputMaybe<Scalars['uuid']>;
created_at?: InputMaybe<Scalars['timestamptz']>; created_at?: InputMaybe<Scalars['timestamptz']>;
dedicated_compute?: InputMaybe<Scalars['String']>; dedicated_compute?: InputMaybe<Scalars['String']>;
egress?: InputMaybe<Scalars['String']>;
functions?: InputMaybe<Scalars['String']>;
id?: InputMaybe<Scalars['uuid']>; id?: InputMaybe<Scalars['uuid']>;
updated_at?: InputMaybe<Scalars['timestamptz']>; updated_at?: InputMaybe<Scalars['timestamptz']>;
}; };
@@ -6550,6 +6569,8 @@ export type Billing_Subscriptions_Max_Fields = {
app_id?: Maybe<Scalars['uuid']>; app_id?: Maybe<Scalars['uuid']>;
created_at?: Maybe<Scalars['timestamptz']>; created_at?: Maybe<Scalars['timestamptz']>;
dedicated_compute?: Maybe<Scalars['String']>; dedicated_compute?: Maybe<Scalars['String']>;
egress?: Maybe<Scalars['String']>;
functions?: Maybe<Scalars['String']>;
id?: Maybe<Scalars['uuid']>; id?: Maybe<Scalars['uuid']>;
updated_at?: Maybe<Scalars['timestamptz']>; updated_at?: Maybe<Scalars['timestamptz']>;
}; };
@@ -6560,6 +6581,8 @@ export type Billing_Subscriptions_Min_Fields = {
app_id?: Maybe<Scalars['uuid']>; app_id?: Maybe<Scalars['uuid']>;
created_at?: Maybe<Scalars['timestamptz']>; created_at?: Maybe<Scalars['timestamptz']>;
dedicated_compute?: Maybe<Scalars['String']>; dedicated_compute?: Maybe<Scalars['String']>;
egress?: Maybe<Scalars['String']>;
functions?: Maybe<Scalars['String']>;
id?: Maybe<Scalars['uuid']>; id?: Maybe<Scalars['uuid']>;
updated_at?: Maybe<Scalars['timestamptz']>; updated_at?: Maybe<Scalars['timestamptz']>;
}; };
@@ -6593,6 +6616,8 @@ export type Billing_Subscriptions_Order_By = {
app_id?: InputMaybe<Order_By>; app_id?: InputMaybe<Order_By>;
created_at?: InputMaybe<Order_By>; created_at?: InputMaybe<Order_By>;
dedicated_compute?: InputMaybe<Order_By>; dedicated_compute?: InputMaybe<Order_By>;
egress?: InputMaybe<Order_By>;
functions?: InputMaybe<Order_By>;
id?: InputMaybe<Order_By>; id?: InputMaybe<Order_By>;
updated_at?: InputMaybe<Order_By>; updated_at?: InputMaybe<Order_By>;
}; };
@@ -6611,6 +6636,10 @@ export enum Billing_Subscriptions_Select_Column {
/** column name */ /** column name */
DedicatedCompute = 'dedicated_compute', DedicatedCompute = 'dedicated_compute',
/** column name */ /** column name */
Egress = 'egress',
/** column name */
Functions = 'functions',
/** column name */
Id = 'id', Id = 'id',
/** column name */ /** column name */
UpdatedAt = 'updated_at' UpdatedAt = 'updated_at'
@@ -6621,6 +6650,8 @@ export type Billing_Subscriptions_Set_Input = {
app_id?: InputMaybe<Scalars['uuid']>; app_id?: InputMaybe<Scalars['uuid']>;
created_at?: InputMaybe<Scalars['timestamptz']>; created_at?: InputMaybe<Scalars['timestamptz']>;
dedicated_compute?: InputMaybe<Scalars['String']>; dedicated_compute?: InputMaybe<Scalars['String']>;
egress?: InputMaybe<Scalars['String']>;
functions?: InputMaybe<Scalars['String']>;
id?: InputMaybe<Scalars['uuid']>; id?: InputMaybe<Scalars['uuid']>;
updated_at?: InputMaybe<Scalars['timestamptz']>; updated_at?: InputMaybe<Scalars['timestamptz']>;
}; };
@@ -6638,6 +6669,8 @@ export type Billing_Subscriptions_Stream_Cursor_Value_Input = {
app_id?: InputMaybe<Scalars['uuid']>; app_id?: InputMaybe<Scalars['uuid']>;
created_at?: InputMaybe<Scalars['timestamptz']>; created_at?: InputMaybe<Scalars['timestamptz']>;
dedicated_compute?: InputMaybe<Scalars['String']>; dedicated_compute?: InputMaybe<Scalars['String']>;
egress?: InputMaybe<Scalars['String']>;
functions?: InputMaybe<Scalars['String']>;
id?: InputMaybe<Scalars['uuid']>; id?: InputMaybe<Scalars['uuid']>;
updated_at?: InputMaybe<Scalars['timestamptz']>; updated_at?: InputMaybe<Scalars['timestamptz']>;
}; };
@@ -6651,6 +6684,10 @@ export enum Billing_Subscriptions_Update_Column {
/** column name */ /** column name */
DedicatedCompute = 'dedicated_compute', DedicatedCompute = 'dedicated_compute',
/** column name */ /** column name */
Egress = 'egress',
/** column name */
Functions = 'functions',
/** column name */
Id = 'id', Id = 'id',
/** column name */ /** column name */
UpdatedAt = 'updated_at' UpdatedAt = 'updated_at'
@@ -10660,6 +10697,7 @@ export type Mutation_Root = {
insert_regions?: Maybe<Regions_Mutation_Response>; insert_regions?: Maybe<Regions_Mutation_Response>;
/** insert a single row into the table: "regions" */ /** insert a single row into the table: "regions" */
insert_regions_one?: Maybe<Regions>; insert_regions_one?: Maybe<Regions>;
pauseAppsExceedUsage: Array<Scalars['String']>;
pauseInactiveApps: Array<Scalars['String']>; pauseInactiveApps: Array<Scalars['String']>;
replaceConfig: ConfigConfig; replaceConfig: ConfigConfig;
replaceRunServiceConfig: ConfigRunServiceConfig; replaceRunServiceConfig: ConfigRunServiceConfig;
@@ -14038,11 +14076,13 @@ export type Query_Root = {
getBackupPresignedURL: BackupPresignedUrl; getBackupPresignedURL: BackupPresignedUrl;
getCPUSecondsUsage: Metrics; getCPUSecondsUsage: Metrics;
getEgressVolume: Metrics; getEgressVolume: Metrics;
getFunctionsDuration: Metrics;
getFunctionsInvocations: Metrics; getFunctionsInvocations: Metrics;
getLogsVolume: Metrics; getLogsVolume: Metrics;
getPostgresVolumeCapacity: Metrics; getPostgresVolumeCapacity: Metrics;
getPostgresVolumeUsage: Metrics; getPostgresVolumeUsage: Metrics;
getTotalRequests: Metrics; getTotalRequests: Metrics;
getUsageAll: Array<UsageSummary>;
/** fetch data from the table: "github_app_installations" using primary key columns */ /** fetch data from the table: "github_app_installations" using primary key columns */
githubAppInstallation?: Maybe<GithubAppInstallations>; githubAppInstallation?: Maybe<GithubAppInstallations>;
/** fetch data from the table: "github_app_installations" */ /** fetch data from the table: "github_app_installations" */
@@ -14766,6 +14806,13 @@ export type Query_RootGetEgressVolumeArgs = {
}; };
export type Query_RootGetFunctionsDurationArgs = {
appID: Scalars['String'];
from?: InputMaybe<Scalars['Timestamp']>;
to?: InputMaybe<Scalars['Timestamp']>;
};
export type Query_RootGetFunctionsInvocationsArgs = { export type Query_RootGetFunctionsInvocationsArgs = {
appID: Scalars['String']; appID: Scalars['String'];
from?: InputMaybe<Scalars['Timestamp']>; from?: InputMaybe<Scalars['Timestamp']>;
@@ -14799,6 +14846,12 @@ export type Query_RootGetTotalRequestsArgs = {
}; };
export type Query_RootGetUsageAllArgs = {
from: Scalars['Timestamp'];
to: Scalars['Timestamp'];
};
export type Query_RootGithubAppInstallationArgs = { export type Query_RootGithubAppInstallationArgs = {
id: Scalars['uuid']; id: Scalars['uuid'];
}; };
@@ -20138,7 +20191,7 @@ export type GetProjectMetricsQueryVariables = Exact<{
}>; }>;
export type GetProjectMetricsQuery = { __typename?: 'query_root', logsVolume: { __typename?: 'Metrics', value: any }, cpuSecondsUsage: { __typename?: 'Metrics', value: any }, functionInvocations: { __typename?: 'Metrics', value: any }, postgresVolumeCapacity: { __typename?: 'Metrics', value: any }, postgresVolumeUsage: { __typename?: 'Metrics', value: any }, totalRequests: { __typename?: 'Metrics', value: any }, egressVolume: { __typename?: 'Metrics', value: any } }; export type GetProjectMetricsQuery = { __typename?: 'query_root', logsVolume: { __typename?: 'Metrics', value: any }, cpuSecondsUsage: { __typename?: 'Metrics', value: any }, functionInvocations: { __typename?: 'Metrics', value: any }, functionsDuration: { __typename?: 'Metrics', value: any }, postgresVolumeCapacity: { __typename?: 'Metrics', value: any }, postgresVolumeUsage: { __typename?: 'Metrics', value: any }, totalRequests: { __typename?: 'Metrics', value: any }, egressVolume: { __typename?: 'Metrics', value: any } };
export type GetRemoteAppRolesQueryVariables = Exact<{ [key: string]: never; }>; export type GetRemoteAppRolesQueryVariables = Exact<{ [key: string]: never; }>;
@@ -21705,6 +21758,9 @@ export const GetProjectMetricsDocument = gql`
) { ) {
value value
} }
functionsDuration: getFunctionsDuration(appID: $appId, from: $from, to: $to) {
value
}
postgresVolumeCapacity: getPostgresVolumeCapacity(appID: $appId) { postgresVolumeCapacity: getPostgresVolumeCapacity(appID: $appId) {
value value
} }