mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-17 01:12:59 +00:00
misc: added secret read metric
This commit is contained in:
@@ -34,6 +34,7 @@ import { diff, groupBy } from "@app/lib/fn";
|
||||
import { setKnexStringValue } from "@app/lib/knex";
|
||||
import { logger } from "@app/lib/logger";
|
||||
import { alphaNumericNanoId } from "@app/lib/nanoid";
|
||||
import { recordSecretReadMetric } from "@app/lib/telemetry/metrics";
|
||||
|
||||
import { ActorType } from "../auth/auth-type";
|
||||
import { TCommitResourceChangeDTO, TFolderCommitServiceFactory } from "../folder-commit/folder-commit-service";
|
||||
@@ -1052,6 +1053,11 @@ export const secretV2BridgeServiceFactory = ({
|
||||
});
|
||||
throwIfMissingSecretReadValueOrDescribePermission(permission, ProjectPermissionSecretActions.DescribeSecret);
|
||||
|
||||
recordSecretReadMetric({
|
||||
environment,
|
||||
secretPath: path
|
||||
});
|
||||
|
||||
const cachedSecretDalVersion = await keyStore.pgGetIntItem(SecretServiceCacheKeys.getSecretDalVersion(projectId));
|
||||
const secretDalVersion = Number(cachedSecretDalVersion || 0);
|
||||
const cacheKey = SecretServiceCacheKeys.getSecretsOfServiceLayer(projectId, secretDalVersion, {
|
||||
@@ -1482,6 +1488,12 @@ export const secretV2BridgeServiceFactory = ({
|
||||
secretTags: (secret?.tags || []).map((el) => el.slug)
|
||||
});
|
||||
|
||||
recordSecretReadMetric({
|
||||
environment,
|
||||
secretPath: path,
|
||||
name: secretName
|
||||
});
|
||||
|
||||
// this will throw if the user doesn't have read value permission no matter what
|
||||
// because if its an expansion, it will fully depend on the value.
|
||||
const { expandSecretReferences } = expandSecretReferencesFactory({
|
||||
|
||||
Reference in New Issue
Block a user