Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const TELEMETRY_FORM_INTAKE_UPDATED = 'formIntakeUpdatedCount';
export const TELEMETRY_FORM_INTAKE_DELETED = 'formIntakeDeletedCount';
export const TELEMETRY_FORM_INTAKE_SUBMITTED = 'formIntakeSubmittedCount';
export const TELEMETRY_USER_LOGIN = 'userLoginCount';
export const TELEMETRY_RETENTION_HISTORY = 'retentionHistoryCreationCount';

export const addDisseminationCount = async () => {
await redisSetTelemetryAdd(TELEMETRY_GAUGE_DISSEMINATION, 1);
Expand Down Expand Up @@ -144,6 +145,10 @@ export const addUserLoginCount = () => {
redisSetTelemetryAdd(TELEMETRY_USER_LOGIN, 1).catch((reason) => logApp.info('Error add user login in telemetry', { reason }));
};

export const addRetentionHistoryCreationCount = async () => {
await redisSetTelemetryAdd(TELEMETRY_RETENTION_HISTORY, 1);
};

// End Region user event counters

const telemetryInitializer = async (): Promise<HandlerInput> => {
Expand Down Expand Up @@ -330,6 +335,8 @@ export const fetchTelemetryData = async (manager: TelemetryMeterManager) => {
manager.setFormIntakeDeletedCount(formIntakeDeletedCountInRedis);
const formIntakeSubmittedCountInRedis = await redisGetTelemetry(TELEMETRY_FORM_INTAKE_SUBMITTED);
manager.setFormIntakeSubmittedCount(formIntakeSubmittedCountInRedis);
const retentionHistoryCreationCountInRedis = await redisGetTelemetry(TELEMETRY_RETENTION_HISTORY);
manager.setRetentionHistoryCreationCount(retentionHistoryCreationCountInRedis);
// end region Telemetry user events

logApp.debug('[TELEMETRY] Fetching telemetry data successfully');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { utcDate } from '../../utils/format';
import { RETENTION_MANAGER_USER } from '../../utils/access';
import { convertFiltersToQueryOptions } from '../../utils/filtering/filtering-resolution';
import { publishUserAction } from '../../listener/UserActionListener';
import { addRetentionHistoryCreationCount } from '../../manager/telemetryManager';
import { DELETABLE_FILE_STATUSES, paginatedForPathWithEnrichment } from '../internal/document/document-domain';
import { logApp } from '../../config/conf';
import { BASE_TYPE_ENTITY } from '../../schema/general';
Expand Down Expand Up @@ -86,6 +87,9 @@ export const createRetentionRule = async (context: AuthContext, user: AuthUser,
message: `creates retention rule \`${retentionRule.name}\``,
context_data: { id: retentionRuleId, entity_type: ENTITY_TYPE_RETENTION_RULE, input },
});
if (input.scope === 'history') {
await addRetentionHistoryCreationCount();
}
return retentionRule;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export class TelemetryMeterManager {
// Number of connectors deployed
connectorDeployedCount = 0;

// Number of retention rules created with scope history
retentionHistoryCreationCount = 0;

// +1 when a user that login into application, does not count token authentication
userLoginCount = 0;

Expand Down Expand Up @@ -264,6 +267,10 @@ export class TelemetryMeterManager {
this.connectorDeployedCount = n;
}

setRetentionHistoryCreationCount(n: number) {
this.retentionHistoryCreationCount = n;
}

setUserLoginCount(n: number) {
this.userLoginCount = n;
}
Expand Down Expand Up @@ -330,6 +337,7 @@ export class TelemetryMeterManager {
this.registerGauge('forgot_password_count', 'Number of clicks on Forgot Password', 'forgotPasswordCount');
this.registerGauge('pir_count', 'number of PIRs', 'pirCount');
this.registerGauge('connector_deployed_count', 'Number of connectors deployed via composer', 'connectorDeployedCount');
this.registerGauge('retention_history_creation_count', 'Number of retention rules created with scope history', 'retentionHistoryCreationCount');
this.registerGauge('user_login_count', 'Number of user that logs-in into application', 'userLoginCount');
this.registerGauge('form_intake_created_count', 'Number of form intakes created', 'formIntakeCreatedCount');
this.registerGauge('form_intake_updated_count', 'Number of form intakes updated', 'formIntakeUpdatedCount');
Expand Down
Loading