Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
chore(telemetry): drop secret-cache OTel metrics — covered by #6666
Tre Dubrava8813747ecb3b
diff --git a/backend/src/lib/telemetry/metrics.ts b/backend/src/lib/telemetry/metrics.tsindex 62788729e7..8489564666 100644--- a/backend/src/lib/telemetry/metrics.ts+++ b/backend/src/lib/telemetry/metrics.ts@@ -102,74 +102,6 @@ export const recordSecretReadMetric = (params: { environment: string; secretPath}};-export enum SecretCacheAccessResult {- NOT_MODIFIED = "not_modified",- HIT = "hit",- MISS = "miss"-}--export const secretCacheAccessCounter = infisicalMeter.createCounter("infisical.secret.cache.access.count", {- description: "Secret service-layer cache accesses by outcome (304 not-modified / hit / miss)",- unit: "{access}"-});--export const secretCacheEntryBytesHistogram = infisicalMeter.createHistogram("infisical.secret.cache.entry.bytes", {- description: "Encrypted secret cache entry size computed at write time",- unit: "By"-});--export const secretCacheOversizeSkipCounter = infisicalMeter.createCounter(- "infisical.secret.cache.oversize_skip.count",- {- description: "Secret cache writes skipped because the entry exceeded the max byte cap",- unit: "{skip}"- }-);--// Low-cardinality attributes (org + project only) so cache hit-rate stays queryable per project.-const getSecretCacheMetricAttributes = () => {- const attributes: Record<string, string> = {};-- const orgId = requestContext.get(RequestContextKey.OrgId);- if (orgId) {- attributes["infisical.organization.id"] = orgId;- }-- const projectDetails = requestContext.get(RequestContextKey.ProjectDetails);- if (projectDetails?.id) {- attributes["infisical.project.id"] = projectDetails.id;- }-- return attributes;-};--export const recordSecretCacheAccessMetric = (result: SecretCacheAccessResult) => {- const appCfg = getConfig();-- if (!appCfg.OTEL_TELEMETRY_COLLECTION_ENABLED) {- return;- }-- const attributes = getSecretCacheMetricAttributes();- attributes["infisical.secret.cache.result"] = result;- secretCacheAccessCounter.add(1, attributes);-};--export const recordSecretCacheWriteMetric = (params: { bytes: number; stored: boolean }) => {- const appCfg = getConfig();-- if (!appCfg.OTEL_TELEMETRY_COLLECTION_ENABLED) {- return;- }-- const attributes = getSecretCacheMetricAttributes();- secretCacheEntryBytesHistogram.record(params.bytes, attributes);-- if (!params.stored) {- secretCacheOversizeSkipCounter.add(1, attributes);- }-};-export enum KmipOperationType {CREATE = "create",GET = "get",diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.tsindex b64d37b9d4..1164d2dc30 100644--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts@@ -44,12 +44,7 @@ import { logger } from "@app/lib/logger";import { alphaNumericNanoId } from "@app/lib/nanoid";import { requestMemoKeys } from "@app/lib/request-context/memo-keys";import { requestMemoize } from "@app/lib/request-context/request-memoizer";-import {- recordSecretCacheAccessMetric,- recordSecretCacheWriteMetric,- recordSecretReadMetric,- SecretCacheAccessResult-} from "@app/lib/telemetry/metrics";+import { recordSecretReadMetric } from "@app/lib/telemetry/metrics";import { ActorType } from "../auth/auth-type";import { TCommitResourceChangeDTO, TFolderCommitServiceFactory } from "../folder-commit/folder-commit-service";@@ -1216,7 +1211,6 @@ export const secretV2BridgeServiceFactory = ({if (ifNoneMatch) {const storedEtag = await keyStore.hashGet(etagRedisKey, etagField);if (storedEtag && storedEtag === ifNoneMatch) {- recordSecretCacheAccessMetric(SecretCacheAccessResult.NOT_MODIFIED);return { notModified: true, etag: ifNoneMatch, secrets: [], imports: [] };}}@@ -1278,7 +1272,6 @@ export const secretV2BridgeServiceFactory = ({const cachedEtag = `"${generateCacheKeyFromData(payload)}"`;await keyStore.hashSet(etagRedisKey, etagField, cachedEtag);await keyStore.setExpiry(etagRedisKey, KeyStoreTtls.SecretEtagInSeconds);- recordSecretCacheAccessMetric(SecretCacheAccessResult.HIT);return { ...payload, etag: cachedEtag };} catch (err) {logger.error(err, "Secret service layer cache miss");@@ -1524,13 +1517,9 @@ export const secretV2BridgeServiceFactory = ({const encryptedUpdatedCachedSecrets = secretManagerEncryptor({plainText: Buffer.from(JSON.stringify(payload))}).cipherTextBlob;- const cacheBytes = encryptedUpdatedCachedSecrets.byteLength;- const stored = cacheBytes < MAX_SECRET_CACHE_BYTES;- if (stored) {+ if (encryptedUpdatedCachedSecrets.byteLength < MAX_SECRET_CACHE_BYTES) {await keyStore.setItemWithExpiry(cacheKey, SECRET_DAL_TTL(), encryptedUpdatedCachedSecrets.toString("base64"));}- recordSecretCacheWriteMetric({ bytes: cacheBytes, stored });- recordSecretCacheAccessMetric(SecretCacheAccessResult.MISS);const computedEtag = `"${generateCacheKeyFromData(payload)}"`;await keyStore.hashSet(etagRedisKey, etagField, computedEtag);await keyStore.setExpiry(etagRedisKey, KeyStoreTtls.SecretEtagInSeconds);@@ -1602,13 +1591,9 @@ export const secretV2BridgeServiceFactory = ({const encryptedUpdatedCachedSecrets = secretManagerEncryptor({plainText: Buffer.from(JSON.stringify(payload))}).cipherTextBlob;- const cacheBytes = encryptedUpdatedCachedSecrets.byteLength;- const stored = cacheBytes < MAX_SECRET_CACHE_BYTES;- if (stored) {+ if (encryptedUpdatedCachedSecrets.byteLength < MAX_SECRET_CACHE_BYTES) {await keyStore.setItemWithExpiry(cacheKey, SECRET_DAL_TTL(), encryptedUpdatedCachedSecrets.toString("base64"));}- recordSecretCacheWriteMetric({ bytes: cacheBytes, stored });- recordSecretCacheAccessMetric(SecretCacheAccessResult.MISS);const computedEtag = `"${generateCacheKeyFromData(payload)}"`;await keyStore.hashSet(etagRedisKey, etagField, computedEtag);await keyStore.setExpiry(etagRedisKey, KeyStoreTtls.SecretEtagInSeconds);