mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
feat: Include totalUsers in usage metrics during license renewal (no-changelog) (#8598)
This commit is contained in:
parent
79b09fdf84
commit
cd151f1ba9
|
@ -29,6 +29,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
|
|||
async getLicenseRenewalMetrics() {
|
||||
type Row = {
|
||||
enabled_user_count: string | number;
|
||||
total_user_count: string | number;
|
||||
active_workflow_count: string | number;
|
||||
total_workflow_count: string | number;
|
||||
total_credentials_count: string | number;
|
||||
|
@ -44,6 +45,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
|
|||
const [
|
||||
{
|
||||
enabled_user_count: enabledUsers,
|
||||
total_user_count: totalUsers,
|
||||
active_workflow_count: activeWorkflows,
|
||||
total_workflow_count: totalWorkflows,
|
||||
total_credentials_count: totalCredentials,
|
||||
|
@ -53,6 +55,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
|
|||
] = (await this.query(`
|
||||
SELECT
|
||||
(SELECT COUNT(*) FROM ${userTable} WHERE disabled = false) AS enabled_user_count,
|
||||
(SELECT COUNT(*) FROM ${userTable}) AS total_user_count,
|
||||
(SELECT COUNT(*) FROM ${workflowTable} WHERE active = true) AS active_workflow_count,
|
||||
(SELECT COUNT(*) FROM ${workflowTable}) AS total_workflow_count,
|
||||
(SELECT COUNT(*) FROM ${credentialTable}) AS total_credentials_count,
|
||||
|
@ -65,6 +68,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
|
|||
|
||||
return {
|
||||
enabledUsers: toNumber(enabledUsers),
|
||||
totalUsers: toNumber(totalUsers),
|
||||
activeWorkflows: toNumber(activeWorkflows),
|
||||
totalWorkflows: toNumber(totalWorkflows),
|
||||
totalCredentials: toNumber(totalCredentials),
|
||||
|
|
|
@ -10,6 +10,7 @@ export class UsageMetricsService {
|
|||
activeWorkflows,
|
||||
totalWorkflows,
|
||||
enabledUsers,
|
||||
totalUsers,
|
||||
totalCredentials,
|
||||
productionExecutions,
|
||||
manualExecutions,
|
||||
|
@ -19,6 +20,7 @@ export class UsageMetricsService {
|
|||
{ name: 'activeWorkflows', value: activeWorkflows },
|
||||
{ name: 'totalWorkflows', value: totalWorkflows },
|
||||
{ name: 'enabledUsers', value: enabledUsers },
|
||||
{ name: 'totalUsers', value: totalUsers },
|
||||
{ name: 'totalCredentials', value: totalCredentials },
|
||||
{ name: 'productionExecutions', value: productionExecutions },
|
||||
{ name: 'manualExecutions', value: manualExecutions },
|
||||
|
|
|
@ -64,6 +64,7 @@ describe('UsageMetricsRepository', () => {
|
|||
|
||||
expect(metrics).toStrictEqual({
|
||||
enabledUsers: 4,
|
||||
totalUsers: 5,
|
||||
totalCredentials: 2,
|
||||
totalWorkflows: 5,
|
||||
activeWorkflows: 3,
|
||||
|
@ -79,6 +80,7 @@ describe('UsageMetricsRepository', () => {
|
|||
|
||||
expect(metrics).toStrictEqual({
|
||||
enabledUsers: 1,
|
||||
totalUsers: 1,
|
||||
totalCredentials: 0,
|
||||
totalWorkflows: 3,
|
||||
activeWorkflows: 3,
|
||||
|
|
Loading…
Reference in a new issue