mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-13 05:47:31 -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() {
|
async getLicenseRenewalMetrics() {
|
||||||
type Row = {
|
type Row = {
|
||||||
enabled_user_count: string | number;
|
enabled_user_count: string | number;
|
||||||
|
total_user_count: string | number;
|
||||||
active_workflow_count: string | number;
|
active_workflow_count: string | number;
|
||||||
total_workflow_count: string | number;
|
total_workflow_count: string | number;
|
||||||
total_credentials_count: string | number;
|
total_credentials_count: string | number;
|
||||||
|
@ -44,6 +45,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
|
||||||
const [
|
const [
|
||||||
{
|
{
|
||||||
enabled_user_count: enabledUsers,
|
enabled_user_count: enabledUsers,
|
||||||
|
total_user_count: totalUsers,
|
||||||
active_workflow_count: activeWorkflows,
|
active_workflow_count: activeWorkflows,
|
||||||
total_workflow_count: totalWorkflows,
|
total_workflow_count: totalWorkflows,
|
||||||
total_credentials_count: totalCredentials,
|
total_credentials_count: totalCredentials,
|
||||||
|
@ -53,6 +55,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
|
||||||
] = (await this.query(`
|
] = (await this.query(`
|
||||||
SELECT
|
SELECT
|
||||||
(SELECT COUNT(*) FROM ${userTable} WHERE disabled = false) AS enabled_user_count,
|
(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} WHERE active = true) AS active_workflow_count,
|
||||||
(SELECT COUNT(*) FROM ${workflowTable}) AS total_workflow_count,
|
(SELECT COUNT(*) FROM ${workflowTable}) AS total_workflow_count,
|
||||||
(SELECT COUNT(*) FROM ${credentialTable}) AS total_credentials_count,
|
(SELECT COUNT(*) FROM ${credentialTable}) AS total_credentials_count,
|
||||||
|
@ -65,6 +68,7 @@ export class UsageMetricsRepository extends Repository<UsageMetrics> {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
enabledUsers: toNumber(enabledUsers),
|
enabledUsers: toNumber(enabledUsers),
|
||||||
|
totalUsers: toNumber(totalUsers),
|
||||||
activeWorkflows: toNumber(activeWorkflows),
|
activeWorkflows: toNumber(activeWorkflows),
|
||||||
totalWorkflows: toNumber(totalWorkflows),
|
totalWorkflows: toNumber(totalWorkflows),
|
||||||
totalCredentials: toNumber(totalCredentials),
|
totalCredentials: toNumber(totalCredentials),
|
||||||
|
|
|
@ -10,6 +10,7 @@ export class UsageMetricsService {
|
||||||
activeWorkflows,
|
activeWorkflows,
|
||||||
totalWorkflows,
|
totalWorkflows,
|
||||||
enabledUsers,
|
enabledUsers,
|
||||||
|
totalUsers,
|
||||||
totalCredentials,
|
totalCredentials,
|
||||||
productionExecutions,
|
productionExecutions,
|
||||||
manualExecutions,
|
manualExecutions,
|
||||||
|
@ -19,6 +20,7 @@ export class UsageMetricsService {
|
||||||
{ name: 'activeWorkflows', value: activeWorkflows },
|
{ name: 'activeWorkflows', value: activeWorkflows },
|
||||||
{ name: 'totalWorkflows', value: totalWorkflows },
|
{ name: 'totalWorkflows', value: totalWorkflows },
|
||||||
{ name: 'enabledUsers', value: enabledUsers },
|
{ name: 'enabledUsers', value: enabledUsers },
|
||||||
|
{ name: 'totalUsers', value: totalUsers },
|
||||||
{ name: 'totalCredentials', value: totalCredentials },
|
{ name: 'totalCredentials', value: totalCredentials },
|
||||||
{ name: 'productionExecutions', value: productionExecutions },
|
{ name: 'productionExecutions', value: productionExecutions },
|
||||||
{ name: 'manualExecutions', value: manualExecutions },
|
{ name: 'manualExecutions', value: manualExecutions },
|
||||||
|
|
|
@ -64,6 +64,7 @@ describe('UsageMetricsRepository', () => {
|
||||||
|
|
||||||
expect(metrics).toStrictEqual({
|
expect(metrics).toStrictEqual({
|
||||||
enabledUsers: 4,
|
enabledUsers: 4,
|
||||||
|
totalUsers: 5,
|
||||||
totalCredentials: 2,
|
totalCredentials: 2,
|
||||||
totalWorkflows: 5,
|
totalWorkflows: 5,
|
||||||
activeWorkflows: 3,
|
activeWorkflows: 3,
|
||||||
|
@ -79,6 +80,7 @@ describe('UsageMetricsRepository', () => {
|
||||||
|
|
||||||
expect(metrics).toStrictEqual({
|
expect(metrics).toStrictEqual({
|
||||||
enabledUsers: 1,
|
enabledUsers: 1,
|
||||||
|
totalUsers: 1,
|
||||||
totalCredentials: 0,
|
totalCredentials: 0,
|
||||||
totalWorkflows: 3,
|
totalWorkflows: 3,
|
||||||
activeWorkflows: 3,
|
activeWorkflows: 3,
|
||||||
|
|
Loading…
Reference in a new issue