Compare commits
9 Commits
@nhost/vue
...
@nhost/das
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
607d89e2aa | ||
|
|
0cca72311c | ||
|
|
a6525b6467 | ||
|
|
387be37b6e | ||
|
|
c8fd8bbcc7 | ||
|
|
bfb34bad00 | ||
|
|
666a75a233 | ||
|
|
3b050217df | ||
|
|
0ed4481615 |
@@ -1,5 +1,11 @@
|
||||
# @nhost/dashboard
|
||||
|
||||
## 0.20.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 666a75a23: feat(dashboard): add functions execution time and egress volume to usage stats
|
||||
|
||||
## 0.20.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/dashboard",
|
||||
"version": "0.20.9",
|
||||
"version": "0.20.10",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
|
||||
@@ -7,14 +7,15 @@ import MaterialLinearProgress, {
|
||||
|
||||
export interface LinearProgressProps extends MaterialLinearProgressProps {}
|
||||
|
||||
const LinearProgress = styled(MaterialLinearProgress)(({ theme }) => ({
|
||||
const LinearProgress = styled(MaterialLinearProgress)(({ theme, value }) => ({
|
||||
height: 12,
|
||||
borderRadius: 1,
|
||||
[`&.${linearProgressClasses.colorPrimary}`]: {
|
||||
backgroundColor: theme.palette.grey[300],
|
||||
},
|
||||
[`& .${linearProgressClasses.bar}`]: {
|
||||
backgroundColor: theme.palette.primary.main,
|
||||
backgroundColor:
|
||||
value >= 100 ? theme.palette.error.dark : theme.palette.primary.main,
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
@@ -41,11 +41,6 @@ export default function OverviewMetrics() {
|
||||
numberOfDecimals: 0,
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: 'Egress Volume',
|
||||
tooltip: 'Amount of data your services have sent to users',
|
||||
value: prettifySize(data?.egressVolume?.value || 0),
|
||||
},
|
||||
{
|
||||
label: 'Logs',
|
||||
tooltip: 'Amount of logs stored',
|
||||
|
||||
@@ -96,7 +96,7 @@ export function OverviewUsageMetrics() {
|
||||
remoteAppMetricsData?.filesAggregate?.aggregate?.sum?.size || 0;
|
||||
const totalStorage = currentProject?.plan?.isFree
|
||||
? 1 * 1000 ** 3 // 1 GB
|
||||
: 10 * 1000 ** 3; // 10 GB
|
||||
: 50 * 1000 ** 3; // 10 GB
|
||||
|
||||
// metrics for users
|
||||
const usedUsers = remoteAppMetricsData?.usersAggregate?.aggregate?.count || 0;
|
||||
@@ -105,6 +105,16 @@ export function OverviewUsageMetrics() {
|
||||
// metrics for functions
|
||||
const usedFunctions = functionsInfoData?.app.metadataFunctions.length || 0;
|
||||
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) {
|
||||
return (
|
||||
@@ -112,7 +122,9 @@ export function OverviewUsageMetrics() {
|
||||
<UsageProgress label="Database" percentage={0} />
|
||||
<UsageProgress label="Storage" 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>
|
||||
);
|
||||
}
|
||||
@@ -139,6 +151,18 @@ export function OverviewUsageMetrics() {
|
||||
used={usedFunctions}
|
||||
percentage={100}
|
||||
/>
|
||||
|
||||
<UsageProgress
|
||||
label="Functions"
|
||||
used={usedFunctionsDuration}
|
||||
percentage={100}
|
||||
/>
|
||||
|
||||
<UsageProgress
|
||||
label="Egress"
|
||||
used={usedEgressVolume}
|
||||
percentage={100}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -167,11 +191,25 @@ export function OverviewUsageMetrics() {
|
||||
/>
|
||||
|
||||
<UsageProgress
|
||||
label="Functions"
|
||||
label="Number of Functions"
|
||||
used={usedFunctions}
|
||||
total={totalFunctions}
|
||||
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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,9 @@ query GetProjectMetrics(
|
||||
) {
|
||||
value
|
||||
}
|
||||
functionsDuration: getFunctionsDuration(appID: $appId, from: $from, to: $to) {
|
||||
value
|
||||
}
|
||||
postgresVolumeCapacity: getPostgresVolumeCapacity(appID: $appId) {
|
||||
value
|
||||
}
|
||||
|
||||
58
dashboard/src/utils/__generated__/graphql.ts
generated
58
dashboard/src/utils/__generated__/graphql.ts
generated
@@ -2109,6 +2109,15 @@ export type String_Comparison_Exp = {
|
||||
_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" */
|
||||
export type AppStateHistory = {
|
||||
__typename?: 'appStateHistory';
|
||||
@@ -6485,6 +6494,8 @@ export type Billing_Subscriptions = {
|
||||
app_id: Scalars['uuid'];
|
||||
created_at: Scalars['timestamptz'];
|
||||
dedicated_compute?: Maybe<Scalars['String']>;
|
||||
egress?: Maybe<Scalars['String']>;
|
||||
functions?: Maybe<Scalars['String']>;
|
||||
id: Scalars['uuid'];
|
||||
updated_at: Scalars['timestamptz'];
|
||||
};
|
||||
@@ -6520,6 +6531,8 @@ export type Billing_Subscriptions_Bool_Exp = {
|
||||
app_id?: InputMaybe<Uuid_Comparison_Exp>;
|
||||
created_at?: InputMaybe<Timestamptz_Comparison_Exp>;
|
||||
dedicated_compute?: InputMaybe<String_Comparison_Exp>;
|
||||
egress?: InputMaybe<String_Comparison_Exp>;
|
||||
functions?: InputMaybe<String_Comparison_Exp>;
|
||||
id?: InputMaybe<Uuid_Comparison_Exp>;
|
||||
updated_at?: InputMaybe<Timestamptz_Comparison_Exp>;
|
||||
};
|
||||
@@ -6530,6 +6543,10 @@ export enum Billing_Subscriptions_Constraint {
|
||||
SubscriptionsAppIdKey = 'subscriptions_app_id_key',
|
||||
/** unique or primary key constraint on columns "dedicated_compute" */
|
||||
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" */
|
||||
SubscriptionsPkey = 'subscriptions_pkey'
|
||||
}
|
||||
@@ -6540,6 +6557,8 @@ export type Billing_Subscriptions_Insert_Input = {
|
||||
app_id?: InputMaybe<Scalars['uuid']>;
|
||||
created_at?: InputMaybe<Scalars['timestamptz']>;
|
||||
dedicated_compute?: InputMaybe<Scalars['String']>;
|
||||
egress?: InputMaybe<Scalars['String']>;
|
||||
functions?: InputMaybe<Scalars['String']>;
|
||||
id?: InputMaybe<Scalars['uuid']>;
|
||||
updated_at?: InputMaybe<Scalars['timestamptz']>;
|
||||
};
|
||||
@@ -6550,6 +6569,8 @@ export type Billing_Subscriptions_Max_Fields = {
|
||||
app_id?: Maybe<Scalars['uuid']>;
|
||||
created_at?: Maybe<Scalars['timestamptz']>;
|
||||
dedicated_compute?: Maybe<Scalars['String']>;
|
||||
egress?: Maybe<Scalars['String']>;
|
||||
functions?: Maybe<Scalars['String']>;
|
||||
id?: Maybe<Scalars['uuid']>;
|
||||
updated_at?: Maybe<Scalars['timestamptz']>;
|
||||
};
|
||||
@@ -6560,6 +6581,8 @@ export type Billing_Subscriptions_Min_Fields = {
|
||||
app_id?: Maybe<Scalars['uuid']>;
|
||||
created_at?: Maybe<Scalars['timestamptz']>;
|
||||
dedicated_compute?: Maybe<Scalars['String']>;
|
||||
egress?: Maybe<Scalars['String']>;
|
||||
functions?: Maybe<Scalars['String']>;
|
||||
id?: Maybe<Scalars['uuid']>;
|
||||
updated_at?: Maybe<Scalars['timestamptz']>;
|
||||
};
|
||||
@@ -6593,6 +6616,8 @@ export type Billing_Subscriptions_Order_By = {
|
||||
app_id?: InputMaybe<Order_By>;
|
||||
created_at?: InputMaybe<Order_By>;
|
||||
dedicated_compute?: InputMaybe<Order_By>;
|
||||
egress?: InputMaybe<Order_By>;
|
||||
functions?: InputMaybe<Order_By>;
|
||||
id?: InputMaybe<Order_By>;
|
||||
updated_at?: InputMaybe<Order_By>;
|
||||
};
|
||||
@@ -6611,6 +6636,10 @@ export enum Billing_Subscriptions_Select_Column {
|
||||
/** column name */
|
||||
DedicatedCompute = 'dedicated_compute',
|
||||
/** column name */
|
||||
Egress = 'egress',
|
||||
/** column name */
|
||||
Functions = 'functions',
|
||||
/** column name */
|
||||
Id = 'id',
|
||||
/** column name */
|
||||
UpdatedAt = 'updated_at'
|
||||
@@ -6621,6 +6650,8 @@ export type Billing_Subscriptions_Set_Input = {
|
||||
app_id?: InputMaybe<Scalars['uuid']>;
|
||||
created_at?: InputMaybe<Scalars['timestamptz']>;
|
||||
dedicated_compute?: InputMaybe<Scalars['String']>;
|
||||
egress?: InputMaybe<Scalars['String']>;
|
||||
functions?: InputMaybe<Scalars['String']>;
|
||||
id?: InputMaybe<Scalars['uuid']>;
|
||||
updated_at?: InputMaybe<Scalars['timestamptz']>;
|
||||
};
|
||||
@@ -6638,6 +6669,8 @@ export type Billing_Subscriptions_Stream_Cursor_Value_Input = {
|
||||
app_id?: InputMaybe<Scalars['uuid']>;
|
||||
created_at?: InputMaybe<Scalars['timestamptz']>;
|
||||
dedicated_compute?: InputMaybe<Scalars['String']>;
|
||||
egress?: InputMaybe<Scalars['String']>;
|
||||
functions?: InputMaybe<Scalars['String']>;
|
||||
id?: InputMaybe<Scalars['uuid']>;
|
||||
updated_at?: InputMaybe<Scalars['timestamptz']>;
|
||||
};
|
||||
@@ -6651,6 +6684,10 @@ export enum Billing_Subscriptions_Update_Column {
|
||||
/** column name */
|
||||
DedicatedCompute = 'dedicated_compute',
|
||||
/** column name */
|
||||
Egress = 'egress',
|
||||
/** column name */
|
||||
Functions = 'functions',
|
||||
/** column name */
|
||||
Id = 'id',
|
||||
/** column name */
|
||||
UpdatedAt = 'updated_at'
|
||||
@@ -10660,6 +10697,7 @@ export type Mutation_Root = {
|
||||
insert_regions?: Maybe<Regions_Mutation_Response>;
|
||||
/** insert a single row into the table: "regions" */
|
||||
insert_regions_one?: Maybe<Regions>;
|
||||
pauseAppsExceedUsage: Array<Scalars['String']>;
|
||||
pauseInactiveApps: Array<Scalars['String']>;
|
||||
replaceConfig: ConfigConfig;
|
||||
replaceRunServiceConfig: ConfigRunServiceConfig;
|
||||
@@ -14038,11 +14076,13 @@ export type Query_Root = {
|
||||
getBackupPresignedURL: BackupPresignedUrl;
|
||||
getCPUSecondsUsage: Metrics;
|
||||
getEgressVolume: Metrics;
|
||||
getFunctionsDuration: Metrics;
|
||||
getFunctionsInvocations: Metrics;
|
||||
getLogsVolume: Metrics;
|
||||
getPostgresVolumeCapacity: Metrics;
|
||||
getPostgresVolumeUsage: Metrics;
|
||||
getTotalRequests: Metrics;
|
||||
getUsageAll: Array<UsageSummary>;
|
||||
/** fetch data from the table: "github_app_installations" using primary key columns */
|
||||
githubAppInstallation?: Maybe<GithubAppInstallations>;
|
||||
/** 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 = {
|
||||
appID: Scalars['String'];
|
||||
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 = {
|
||||
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; }>;
|
||||
|
||||
@@ -21705,6 +21758,9 @@ export const GetProjectMetricsDocument = gql`
|
||||
) {
|
||||
value
|
||||
}
|
||||
functionsDuration: getFunctionsDuration(appID: $appId, from: $from, to: $to) {
|
||||
value
|
||||
}
|
||||
postgresVolumeCapacity: getPostgresVolumeCapacity(appID: $appId) {
|
||||
value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user