mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
refactor(core): Track metrics state and categories in telemetry (no-changelog) (#10483)
This commit is contained in:
parent
c410aed4c2
commit
aad3e5b677
|
@ -20,7 +20,22 @@ const flushPromises = async () => await new Promise((resolve) => setImmediate(re
|
||||||
describe('TelemetryEventRelay', () => {
|
describe('TelemetryEventRelay', () => {
|
||||||
const telemetry = mock<Telemetry>();
|
const telemetry = mock<Telemetry>();
|
||||||
const license = mock<License>();
|
const license = mock<License>();
|
||||||
const globalConfig = mock<GlobalConfig>({ userManagement: { emails: { mode: 'smtp' } } });
|
const globalConfig = mock<GlobalConfig>({
|
||||||
|
userManagement: {
|
||||||
|
emails: {
|
||||||
|
mode: 'smtp',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
endpoints: {
|
||||||
|
metrics: {
|
||||||
|
enable: true,
|
||||||
|
includeDefaultMetrics: true,
|
||||||
|
includeApiEndpoints: false,
|
||||||
|
includeCacheMetrics: false,
|
||||||
|
includeMessageEventBusMetrics: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
const workflowRepository = mock<WorkflowRepository>();
|
const workflowRepository = mock<WorkflowRepository>();
|
||||||
const nodeTypes = mock<NodeTypes>();
|
const nodeTypes = mock<NodeTypes>();
|
||||||
const sharedWorkflowRepository = mock<SharedWorkflowRepository>();
|
const sharedWorkflowRepository = mock<SharedWorkflowRepository>();
|
||||||
|
@ -927,6 +942,13 @@ describe('TelemetryEventRelay', () => {
|
||||||
'Instance started',
|
'Instance started',
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
earliest_workflow_created: firstWorkflow.createdAt,
|
earliest_workflow_created: firstWorkflow.createdAt,
|
||||||
|
metrics: {
|
||||||
|
metrics_enabled: true,
|
||||||
|
metrics_category_default: true,
|
||||||
|
metrics_category_routes: false,
|
||||||
|
metrics_category_cache: false,
|
||||||
|
metrics_category_logs: false,
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -762,6 +762,13 @@ export class TelemetryEventRelay extends EventRelay {
|
||||||
license_tenant_id: config.getEnv('license.tenantId'),
|
license_tenant_id: config.getEnv('license.tenantId'),
|
||||||
binary_data_s3: isS3Available && isS3Selected && isS3Licensed,
|
binary_data_s3: isS3Available && isS3Selected && isS3Licensed,
|
||||||
multi_main_setup_enabled: config.getEnv('multiMainSetup.enabled'),
|
multi_main_setup_enabled: config.getEnv('multiMainSetup.enabled'),
|
||||||
|
metrics: {
|
||||||
|
metrics_enabled: this.globalConfig.endpoints.metrics.enable,
|
||||||
|
metrics_category_default: this.globalConfig.endpoints.metrics.includeDefaultMetrics,
|
||||||
|
metrics_category_routes: this.globalConfig.endpoints.metrics.includeApiEndpoints,
|
||||||
|
metrics_category_cache: this.globalConfig.endpoints.metrics.includeCacheMetrics,
|
||||||
|
metrics_category_logs: this.globalConfig.endpoints.metrics.includeMessageEventBusMetrics,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const firstWorkflow = await this.workflowRepository.findOne({
|
const firstWorkflow = await this.workflowRepository.findOne({
|
||||||
|
|
Loading…
Reference in a new issue