refactor(core): Add binary data S3 to telemetry (#7412)

https://n8nio.slack.com/archives/C04B1GZ4T0U/p1697033523039729
This commit is contained in:
Iván Ovejero 2023-10-13 13:16:43 +02:00 committed by GitHub
parent c3f0be809f
commit c6ee1e30c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 0 deletions

View file

@ -348,6 +348,7 @@ export interface IDiagnosticInfo {
smtp_set_up: boolean; smtp_set_up: boolean;
ldap_allowed: boolean; ldap_allowed: boolean;
saml_enabled: boolean; saml_enabled: boolean;
binary_data_s3: boolean;
licensePlanName?: string; licensePlanName?: string;
licenseTenantId?: number; licenseTenantId?: number;
} }

View file

@ -191,6 +191,10 @@ export class License {
return this.isFeatureEnabled(LICENSE_FEATURES.DEBUG_IN_EDITOR); return this.isFeatureEnabled(LICENSE_FEATURES.DEBUG_IN_EDITOR);
} }
isBinaryDataS3Licensed() {
return this.isFeatureEnabled(LICENSE_FEATURES.BINARY_DATA_S3);
}
isVariablesEnabled() { isVariablesEnabled() {
return this.isFeatureEnabled(LICENSE_FEATURES.VARIABLES); return this.isFeatureEnabled(LICENSE_FEATURES.VARIABLES);
} }

View file

@ -219,6 +219,11 @@ export class Server extends AbstractServer {
const cpus = os.cpus(); const cpus = os.cpus();
const binaryDataConfig = config.getEnv('binaryDataManager'); const binaryDataConfig = config.getEnv('binaryDataManager');
const isS3Selected = config.getEnv('binaryDataManager.mode') === 's3';
const isS3Available = config.getEnv('binaryDataManager.availableModes').includes('s3');
const isS3Licensed = Container.get(License).isBinaryDataS3Licensed();
const diagnosticInfo: IDiagnosticInfo = { const diagnosticInfo: IDiagnosticInfo = {
databaseType: config.getEnv('database.type'), databaseType: config.getEnv('database.type'),
disableProductionWebhooksOnMainProcess: config.getEnv( disableProductionWebhooksOnMainProcess: config.getEnv(
@ -257,6 +262,7 @@ export class Server extends AbstractServer {
smtp_set_up: config.getEnv('userManagement.emails.mode') === 'smtp', smtp_set_up: config.getEnv('userManagement.emails.mode') === 'smtp',
ldap_allowed: isLdapCurrentAuthenticationMethod(), ldap_allowed: isLdapCurrentAuthenticationMethod(),
saml_enabled: isSamlCurrentAuthenticationMethod(), saml_enabled: isSamlCurrentAuthenticationMethod(),
binary_data_s3: isS3Available && isS3Selected && isS3Licensed,
licensePlanName: Container.get(License).getPlanName(), licensePlanName: Container.get(License).getPlanName(),
licenseTenantId: config.getEnv('license.tenantId'), licenseTenantId: config.getEnv('license.tenantId'),
}; };

View file

@ -155,6 +155,7 @@ export class FrontendService {
externalSecrets: false, externalSecrets: false,
showNonProdBanner: false, showNonProdBanner: false,
debugInEditor: false, debugInEditor: false,
binaryDataS3: false,
workflowHistory: false, workflowHistory: false,
}, },
mfa: { mfa: {
@ -224,6 +225,10 @@ export class FrontendService {
this.settings.banners.dismissed = dismissedBanners; this.settings.banners.dismissed = dismissedBanners;
const isS3Selected = config.getEnv('binaryDataManager.mode') === 's3';
const isS3Available = config.getEnv('binaryDataManager.availableModes').includes('s3');
const isS3Licensed = this.license.isBinaryDataS3Licensed();
// refresh enterprise status // refresh enterprise status
Object.assign(this.settings.enterprise, { Object.assign(this.settings.enterprise, {
sharing: this.license.isSharingEnabled(), sharing: this.license.isSharingEnabled(),
@ -236,6 +241,7 @@ export class FrontendService {
externalSecrets: this.license.isExternalSecretsEnabled(), externalSecrets: this.license.isExternalSecretsEnabled(),
showNonProdBanner: this.license.isFeatureEnabled(LICENSE_FEATURES.SHOW_NON_PROD_BANNER), showNonProdBanner: this.license.isFeatureEnabled(LICENSE_FEATURES.SHOW_NON_PROD_BANNER),
debugInEditor: this.license.isDebugInEditorLicensed(), debugInEditor: this.license.isDebugInEditorLicensed(),
binaryDataS3: isS3Available && isS3Selected && isS3Licensed,
workflowHistory: workflowHistory:
this.license.isWorkflowHistoryLicensed() && config.getEnv('workflowHistory.enabled'), this.license.isWorkflowHistoryLicensed() && config.getEnv('workflowHistory.enabled'),
}); });

View file

@ -2300,6 +2300,7 @@ export interface IN8nUISettings {
externalSecrets: boolean; externalSecrets: boolean;
showNonProdBanner: boolean; showNonProdBanner: boolean;
debugInEditor: boolean; debugInEditor: boolean;
binaryDataS3: boolean;
workflowHistory: boolean; workflowHistory: boolean;
}; };
hideUsagePage: boolean; hideUsagePage: boolean;