Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: enhance telemetry metrics and error classification

Victor Hugo dos Santos0e499624ccd1
diff --git a/backend/src/ee/services/audit-log/audit-log-queue.ts b/backend/src/ee/services/audit-log/audit-log-queue.ts
index 6aab576329..d0b8ad3f1c 100644
--- a/backend/src/ee/services/audit-log/audit-log-queue.ts
+++ b/backend/src/ee/services/audit-log/audit-log-queue.ts
@@ -159,12 +159,14 @@ export const auditLogQueueServiceFactory = async ({
// Push to Redis stream for ClickHouse batch processing
const persistStart = Date.now();
const backend = isClickHouseBatchEnabled ? "clickhouse" : "postgres";
+ let persistOutcome: "success" | "failure" = "success";
if (isClickHouseBatchEnabled) {
try {
await keyStore.streamAdd(AUDIT_LOG_CLICKHOUSE_STREAM_KEY, "*", {
data: JSON.stringify(auditLog)
});
} catch (error) {
+ persistOutcome = "failure";
logger.error(
error,
`audit-log-queue: Failed to push audit log to Redis stream for ClickHouse batch [jobId=${job.id}] [event=${job.data.event?.type}] [orgId=${job.data.orgId}] [projectId=${job.data.projectId}]`
@@ -176,7 +178,8 @@ export const auditLogQueueServiceFactory = async ({
auditLogPersistDurationHistogram.record((Date.now() - persistStart) / 1000, {
"audit_log.backend": backend,
"audit_log.event_type": event.type,
- "infisical.organization.id": orgId
+ "infisical.organization.id": orgId,
+ outcome: persistOutcome
});
if (getConfig().AUDIT_LOG_STREAMS_ENABLED) {
diff --git a/backend/src/lib/errors/classify.test.ts b/backend/src/lib/errors/classify.test.ts
new file mode 100644
index 0000000000..80dd02b280
--- /dev/null
+++ b/backend/src/lib/errors/classify.test.ts
@@ -0,0 +1,42 @@
+import { AxiosError } from "axios";
+
+import { classifyError } from "./classify";
+import { BadRequestError, ForbiddenRequestError, NotFoundError, RateLimitError, UnauthorizedError } from "./index";
+
+describe("classifyError", () => {
+ test("maps known Infisical error classes to bounded labels", () => {
+ expect(classifyError(new UnauthorizedError({ message: "x" }))).toBe("auth");
+ expect(classifyError(new ForbiddenRequestError({ message: "x" }))).toBe("permission");
+ expect(classifyError(new RateLimitError({ message: "x" }))).toBe("rate_limit");
+ expect(classifyError(new NotFoundError({ message: "x" }))).toBe("not_found");
+ expect(classifyError(new BadRequestError({ message: "x" }))).toBe("validation");
+ });
+
+ test("classifies connection-level codes on raw Node errors (not just axios)", () => {
+ expect(classifyError(Object.assign(new Error("boom"), { code: "ETIMEDOUT" }))).toBe("timeout");
+ expect(classifyError(Object.assign(new Error("boom"), { code: "ECONNRESET" }))).toBe("network");
+ expect(classifyError(Object.assign(new Error("boom"), { code: "ECONNREFUSED" }))).toBe("network");
+ });
+
+ test("does NOT treat a bare non-network code (e.g. fs ENOENT) as network", () => {
+ expect(classifyError(Object.assign(new Error("no such file"), { code: "ENOENT" }))).toBe("unknown");
+ });
+
+ test("maps axios HTTP status codes to bounded labels", () => {
+ const make = (status: number) => new AxiosError("http", undefined, undefined, undefined, { status } as never);
+ expect(classifyError(make(429))).toBe("rate_limit");
+ expect(classifyError(make(401))).toBe("auth");
+ expect(classifyError(make(403))).toBe("auth");
+ expect(classifyError(make(404))).toBe("not_found");
+ expect(classifyError(make(400))).toBe("validation");
+ expect(classifyError(make(502))).toBe("network");
+ });
+
+ test("falls back to message heuristics then unknown", () => {
+ expect(classifyError(new Error("Connection timed out"))).toBe("timeout");
+ expect(classifyError(new Error("network unreachable"))).toBe("network");
+ expect(classifyError(new Error("something else entirely"))).toBe("unknown");
+ expect(classifyError("a plain string")).toBe("unknown");
+ expect(classifyError(undefined)).toBe("unknown");
+ });
+});
diff --git a/backend/src/lib/errors/classify.ts b/backend/src/lib/errors/classify.ts
index 0a3fc9d2ed..69cdfbd0e1 100644
--- a/backend/src/lib/errors/classify.ts
+++ b/backend/src/lib/errors/classify.ts
@@ -42,10 +42,15 @@ export type ErrorType = (typeof ERROR_TYPES)[number];
const isAxiosLikeError = (err: unknown): err is { code?: string; response?: { status?: number } } =>
typeof err === "object" &&
err !== null &&
- // axios sets isAxiosError = true on the error instance
- (("isAxiosError" in err && (err as { isAxiosError?: boolean }).isAxiosError === true) ||
- "response" in err ||
- ("code" in err && typeof (err as { code?: string }).code === "string"));
+ // axios sets isAxiosError = true on the error instance, and always attaches a response on HTTP errors
+ (("isAxiosError" in err && (err as { isAxiosError?: boolean }).isAxiosError === true) || "response" in err);
+
+// Connection-level error codes that unambiguously mean timeout/network regardless of whether the error
+// originated from axios or a raw Node socket. Pulled out so they're classified before the axios check.
+const getErrorCode = (err: unknown): string | undefined =>
+ typeof err === "object" && err !== null && "code" in err && typeof (err as { code?: unknown }).code === "string"
+ ? (err as { code: string }).code
+ : undefined;
/**
* Classify a thrown error into one of the bounded ERROR_TYPES values. Used for the `error.type` label
@@ -66,10 +71,11 @@ export const classifyError = (err: unknown): ErrorType => {
if (err instanceof OidcAuthError) return "oidc";
if (err instanceof InternalServerError) return "internal";
+ const code = getErrorCode(err);
+ if (code === "ECONNABORTED" || code === "ETIMEDOUT") return "timeout";
+ if (code === "ECONNRESET" || code === "ENOTFOUND" || code === "ECONNREFUSED") return "network";
+
if (isAxiosLikeError(err)) {
- const { code } = err as { code?: string };
- if (code === "ECONNABORTED" || code === "ETIMEDOUT") return "timeout";
- if (code === "ECONNRESET" || code === "ENOTFOUND" || code === "ECONNREFUSED") return "network";
const status = err.response?.status;
if (status === 429) return "rate_limit";
if (status === 401 || status === 403) return "auth";
diff --git a/backend/src/lib/telemetry/instrumentation.ts b/backend/src/lib/telemetry/instrumentation.ts
index 24c69c7ad2..f6ea83819f 100644
--- a/backend/src/lib/telemetry/instrumentation.ts
+++ b/backend/src/lib/telemetry/instrumentation.ts
@@ -26,8 +26,9 @@ dotenv.config();
// unbounded label by mistake is caught automatically.
//
// If you need per-actor breakdowns, query the audit log table. It carries actorId, actorType, ip, userAgent and full event detail.
-// Legacy meters ("Infisical", "API") have no View — their existing labels flow through unchanged for
-// self-hosted backwards compatibility.
+// Legacy meters ("Infisical", "API", "SecretSyncs", "PkiSyncs", "Integrations") have no allowlist View —
+// their existing labels (including unbounded ones like syncId) flow through unchanged for self-hosted
+// backwards compatibility, and are dropped wholesale by OTEL_DROP_LEGACY_METERS (see LEGACY_METER_NAMES).
const INFISICAL_CORE_METER_ATTRIBUTES = [
// HTTP semantics
"http.request.method",
@@ -65,6 +66,10 @@ const INFISICAL_CORE_METER_ATTRIBUTES = [
"node.version"
];
+// Every meter that predates the InfisicalCore allowlist. None have a View, so their labels (including
+// unbounded ones like syncId) flow through unchanged unless OTEL_DROP_LEGACY_METERS drops them wholesale.
+const LEGACY_METER_NAMES = ["Infisical", "API", "SecretSyncs", "PkiSyncs", "Integrations"];
+
const initTelemetryInstrumentation = ({
exportType,
otlpURL,
@@ -127,10 +132,9 @@ const initTelemetryInstrumentation = ({
];
if (dropLegacyMeters) {
- views.push(
- new View({ meterName: "Infisical", aggregation: Aggregation.Drop() }),
- new View({ meterName: "API", aggregation: Aggregation.Drop() })
- );
+ LEGACY_METER_NAMES.forEach((meterName) => {
+ views.push(new View({ meterName, aggregation: Aggregation.Drop() }));
+ });
}
const meterProvider = new MeterProvider({
diff --git a/backend/src/lib/telemetry/metrics.ts b/backend/src/lib/telemetry/metrics.ts
index 9857b66c90..108d5b146a 100644
--- a/backend/src/lib/telemetry/metrics.ts
+++ b/backend/src/lib/telemetry/metrics.ts
@@ -275,13 +275,12 @@ export enum KmsCryptoOperation {
export enum KmsKeyType {
INTERNAL = "internal",
AWS = "aws",
- GCP = "gcp",
- HSM = "hsm"
+ GCP = "gcp"
}
export const kmsCryptoDurationHistogram = infisicalCoreMeter.createHistogram("infisical.kms.crypto.duration", {
description:
- "External KMS (AWS/GCP/HSM) encrypt/decrypt latency including network round trip (use _count for operation volume).",
+ "External KMS (AWS/GCP) encrypt/decrypt latency including network round trip (use _count for operation volume).",
unit: "s"
});
@@ -321,6 +320,45 @@ export const permissionCacheFingerprintDurationHistogram = infisicalCoreMeter.cr
}
);
+// Secret service-layer cache metrics. Wired in secret-service.ts at cache read/write boundaries.
+export enum SecretCacheAccessResult {
+ NOT_MODIFIED = "not_modified",
+ HIT = "hit",
+ MISS = "miss"
+}
+
+export const secretCacheAccessCounter = infisicalCoreMeter.createCounter("infisical.secret.cache.access.count", {
+ description: "Secret service-layer cache accesses by outcome (304 not-modified / hit / miss)",
+ unit: "{access}"
+});
+
+export const secretCacheEntryBytesHistogram = infisicalCoreMeter.createHistogram("infisical.secret.cache.entry.bytes", {
+ description: "Encrypted secret cache entry size computed at write time",
+ unit: "By"
+});
+
+export const secretCacheOversizeSkipCounter = infisicalCoreMeter.createCounter(
+ "infisical.secret.cache.oversize_skip.count",
+ {
+ description: "Secret cache writes skipped because the entry exceeded the max byte cap",
+ unit: "{skip}"
+ }
+);
+
+export const recordSecretCacheAccessMetric = (result: SecretCacheAccessResult) => {
+ if (!isTelemetryEnabled()) return;
+ secretCacheAccessCounter.add(1, { ...buildBaseAttributes(), "cache.result": result });
+};
+
+export const recordSecretCacheWriteMetric = (params: { bytes: number; stored: boolean }) => {
+ if (!isTelemetryEnabled()) return;
+ const attributes = buildBaseAttributes();
+ secretCacheEntryBytesHistogram.record(params.bytes, attributes);
+ if (!params.stored) {
+ secretCacheOversizeSkipCounter.add(1, attributes);
+ }
+};
+
export const coreHttpErrorCounter = infisicalCoreMeter.createCounter("infisical.core.http.error.count", {
description: "API errors with bounded error classification. Labels limited to InfisicalCore View allowlist.",
unit: "{error}"
diff --git a/backend/src/queue/queue-service.ts b/backend/src/queue/queue-service.ts
index bb6849ea18..3708f0023b 100644
--- a/backend/src/queue/queue-service.ts
+++ b/backend/src/queue/queue-service.ts
@@ -599,10 +599,11 @@ export const queueServiceFactory = (redisCfg: TRedisConfigKeys): TQueueServiceFa
// Observable gauge for queue depth. The SDK invokes the callback on each export (every 30s for OTLP
// push, on each scrape for Prometheus). Iterates only initialized queues in queueContainer; one
// snapshot covers all ~30 named queues. Failures are swallowed because metrics must never crash the app.
+ const QUEUE_DEPTH_STATES = ["waiting", "active", "delayed", "failed"] as const;
const queueDepthGauge = opentelemetry.metrics
.getMeter("InfisicalCore")
.createObservableGauge("infisical.queue.depth", {
- description: "Number of jobs in each queue state (waiting, active, delayed, failed, completed)",
+ description: "Number of jobs in each queue state (waiting, active, delayed, failed)",
unit: "{job}"
});
@@ -612,7 +613,7 @@ export const queueServiceFactory = (redisCfg: TRedisConfigKeys): TQueueServiceFa
Object.entries(queueContainer).map(async ([name, q]) => {
if (!q) return;
try {
- const counts = await q.getJobCounts();
+ const counts = await q.getJobCounts(...QUEUE_DEPTH_STATES);
Object.entries(counts).forEach(([state, count]) => {
if (typeof count !== "number") return;
observableResult.observe(count, { "queue.name": name, "queue.state": state });
diff --git a/backend/src/services/kms/kms-service.ts b/backend/src/services/kms/kms-service.ts
index 80a9f80fbf..69d2d16d1f 100644
--- a/backend/src/services/kms/kms-service.ts
+++ b/backend/src/services/kms/kms-service.ts
@@ -375,27 +375,9 @@ export const kmsServiceFactory = ({
const kmsKey = keyCipher.decrypt(kmsDoc.internalKms?.encryptedKey as Buffer, ROOT_ENCRYPTION_KEY);
return ({ cipherTextBlob: versionedCipherTextBlob }: Pick<TDecryptWithKmsDTO, "cipherTextBlob">) => {
- const cryptoStart = Date.now();
- try {
- const cipherTextBlob = versionedCipherTextBlob.subarray(0, -KMS_VERSION_BLOB_LENGTH);
- const decryptedBlob = dataCipher.decrypt(cipherTextBlob, kmsKey);
- recordKmsCryptoMetric({
- operation: KmsCryptoOperation.DECRYPT,
- keyType: KmsKeyType.INTERNAL,
- outcome: "success",
- durationSeconds: (Date.now() - cryptoStart) / 1000
- });
- return Promise.resolve(decryptedBlob);
- } catch (err) {
- recordKmsCryptoMetric({
- operation: KmsCryptoOperation.DECRYPT,
- keyType: KmsKeyType.INTERNAL,
- outcome: "failure",
- durationSeconds: (Date.now() - cryptoStart) / 1000,
- errorType: classifyError(err)
- });
- throw err;
- }
+ const cipherTextBlob = versionedCipherTextBlob.subarray(0, -KMS_VERSION_BLOB_LENGTH);
+ const decryptedBlob = dataCipher.decrypt(cipherTextBlob, kmsKey);
+ return Promise.resolve(decryptedBlob);
};
};
@@ -690,32 +672,14 @@ export const kmsServiceFactory = ({
const keyCipher = symmetricCipherService(SymmetricKeyAlgorithm.AES_GCM_256);
const dataCipher = symmetricCipherService(encryptionAlgorithm);
return ({ plainText }: Pick<TEncryptWithKmsDTO, "plainText">) => {
- const cryptoStart = Date.now();
- try {
- const kmsKey = keyCipher.decrypt(kmsDoc.internalKms?.encryptedKey as Buffer, ROOT_ENCRYPTION_KEY);
- const encryptedPlainTextBlob = dataCipher.encrypt(plainText, kmsKey);
+ const kmsKey = keyCipher.decrypt(kmsDoc.internalKms?.encryptedKey as Buffer, ROOT_ENCRYPTION_KEY);
+ const encryptedPlainTextBlob = dataCipher.encrypt(plainText, kmsKey);
- // Buffer#1 encrypted text + Buffer#2 version number
- const versionBlob = Buffer.from(KMS_VERSION, "utf8"); // length is 3
- const cipherTextBlob = Buffer.concat([encryptedPlainTextBlob, versionBlob]);
+ // Buffer#1 encrypted text + Buffer#2 version number
+ const versionBlob = Buffer.from(KMS_VERSION, "utf8"); // length is 3
+ const cipherTextBlob = Buffer.concat([encryptedPlainTextBlob, versionBlob]);
- recordKmsCryptoMetric({
- operation: KmsCryptoOperation.ENCRYPT,
- keyType: KmsKeyType.INTERNAL,
- outcome: "success",
- durationSeconds: (Date.now() - cryptoStart) / 1000
- });
- return Promise.resolve({ cipherTextBlob });
- } catch (err) {
- recordKmsCryptoMetric({
- operation: KmsCryptoOperation.ENCRYPT,
- keyType: KmsKeyType.INTERNAL,
- outcome: "failure",
- durationSeconds: (Date.now() - cryptoStart) / 1000,
- errorType: classifyError(err)
- });
- throw err;
- }
+ return Promise.resolve({ cipherTextBlob });
};
};
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.ts
index 0235ed1428..7807c6e8bc 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
@@ -43,7 +43,12 @@ 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 { recordSecretReadMetric } from "@app/lib/telemetry/metrics";
+import {
+ recordSecretCacheAccessMetric,
+ recordSecretCacheWriteMetric,
+ recordSecretReadMetric,
+ SecretCacheAccessResult
+} from "@app/lib/telemetry/metrics";
import { ActorType } from "../auth/auth-type";
import { TCommitResourceChangeDTO, TFolderCommitServiceFactory } from "../folder-commit/folder-commit-service";
@@ -1207,6 +1212,7 @@ 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: [] };
}
}
@@ -1259,6 +1265,7 @@ 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");
@@ -1504,9 +1511,13 @@ export const secretV2BridgeServiceFactory = ({
const encryptedUpdatedCachedSecrets = secretManagerEncryptor({
plainText: Buffer.from(JSON.stringify(payload))
}).cipherTextBlob;
- if (encryptedUpdatedCachedSecrets.byteLength < MAX_SECRET_CACHE_BYTES) {
+ const cacheBytes = encryptedUpdatedCachedSecrets.byteLength;
+ const stored = cacheBytes < MAX_SECRET_CACHE_BYTES;
+ if (stored) {
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);
@@ -1578,9 +1589,13 @@ export const secretV2BridgeServiceFactory = ({
const encryptedUpdatedCachedSecrets = secretManagerEncryptor({
plainText: Buffer.from(JSON.stringify(payload))
}).cipherTextBlob;
- if (encryptedUpdatedCachedSecrets.byteLength < MAX_SECRET_CACHE_BYTES) {
+ const cacheBytes = encryptedUpdatedCachedSecrets.byteLength;
+ const stored = cacheBytes < MAX_SECRET_CACHE_BYTES;
+ if (stored) {
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);
diff --git a/docs/self-hosting/guides/monitoring-telemetry.mdx b/docs/self-hosting/guides/monitoring-telemetry.mdx
index c424306a07..8f7d78057c 100644
--- a/docs/self-hosting/guides/monitoring-telemetry.mdx
+++ b/docs/self-hosting/guides/monitoring-telemetry.mdx
@@ -342,12 +342,12 @@ Replace `otel-collector:8889` with the actual hostname and port where your OpenT
Infisical emits metrics on two OpenTelemetry meters simultaneously. Choose which to scrape based on your deployment scale.
-- **`Infisical` meter (high-cardinality):** the original metrics (`infisical.http.server.request.*`, `infisical.http.server.error.count`, `infisical.secret.read.count`, `infisical.auth.attempt.count`, `infisical.kmip.operation.count`) include per-actor labels such as `user.email`, `identity.name`, `client.address`, `user_agent.original`, `organization.name`, `project.name`, `secret.path`, and `secret.name`. Useful for small self-hosted deployments where you want per-user visibility directly in Grafana. May become expensive at large scale due to label cardinality.
-- **`InfisicalCore` meter (bounded-cardinality):** all newer metrics (queue, audit log, KMS, permission cache, rate limit, build info, `infisical.core.http.error.count`, authentication latency, token renewal, SSO config changes, SCIM provisioning, and database connection pool) use only IDs and bounded enums as labels. No names, emails, IPs, or user agents. Designed for large or multi-tenant deployments. Per-actor detail is available in audit logs instead.
+- **Legacy meters (high-cardinality):** the `Infisical` and `API` meters' original metrics (`infisical.http.server.request.*`, `infisical.http.server.error.count`, `infisical.secret.read.count`, `infisical.auth.attempt.count`, `infisical.kmip.operation.count`) include per-actor labels such as `user.email`, `identity.name`, `client.address`, `user_agent.original`, `organization.name`, `project.name`, `secret.path`, and `secret.name`. The `SecretSyncs`, `PkiSyncs`, and `Integrations` meters likewise carry unbounded labels such as `syncId`. Useful for small self-hosted deployments where you want per-user visibility directly in Grafana. May become expensive at large scale due to label cardinality.
+- **`InfisicalCore` meter (bounded-cardinality):** all newer metrics (queue, audit log, KMS, permission cache, secret cache, rate limit, build info, `infisical.core.http.error.count`, authentication latency, token renewal, SSO config changes, SCIM provisioning, and database connection pool) use only IDs and bounded enums as labels. No names, emails, IPs, or user agents. Designed for large or multi-tenant deployments. Per-actor detail is available in audit logs instead.
-Both meters emit at the same time. If you are a small self-hosted instance and find the per-actor labels useful, keep using the `Infisical`-meter metrics. For larger deployments, scrape only the `InfisicalCore` metrics to keep cardinality under control.
+All meters emit at the same time. If you are a small self-hosted instance and find the per-actor labels useful, keep using the legacy-meter metrics. For larger deployments, scrape only the `InfisicalCore` metrics to keep cardinality under control.
-To eliminate the in-memory cost of the legacy meters entirely, set `OTEL_DROP_LEGACY_METERS=true`. When enabled, the SDK discards all data points from the `Infisical` and `API` meters before aggregation. The instruments still exist in code (no errors), but nothing is stored or exported. Only `InfisicalCore` metrics are emitted. Defaults to `false`.
+To eliminate the in-memory cost of the legacy meters entirely, set `OTEL_DROP_LEGACY_METERS=true`. When enabled, the SDK discards all data points from the legacy `Infisical`, `API`, `SecretSyncs`, `PkiSyncs`, and `Integrations` meters before aggregation. The instruments still exist in code (no errors), but nothing is stored or exported. Only `InfisicalCore` metrics are emitted. Defaults to `false`.
For per-user / per-identity / per-IP breakdowns, query the audit log table. It carries `actorId`, `actorType`, `ip`, `userAgent` and full event detail. Metrics give you the *rate* and *latency*; audit logs give you the *who*.
@@ -873,7 +873,7 @@ KMS encrypt/decrypt is the hottest path in the system (every secret read and wri
**Attributes**:
- `kms.operation` (string): `encrypt` or `decrypt`
- - `kms.key_type` (string): `internal`, `aws`, `gcp`, `hsm`
+ - `kms.key_type` (string): `internal`, `aws`, `gcp`
- `outcome` (string): `success` or `failure`
- `error.type` (string, only on failure)
</Accordion>
@@ -920,6 +920,45 @@ The CASL permission cache uses a fingerprint-based two-tier scheme. These metric
</Accordion>
</AccordionGroup>
+### Secret Cache Metrics (InfisicalCore)
+
+The secret service caches encrypted secret payloads to avoid redundant decryption on repeated reads. These metrics tell you whether the cache is effective and whether entries are being skipped for exceeding the size cap.
+
+<AccordionGroup>
+ <Accordion title="Secret Cache Access">
+ **Metric Name**: `infisical.secret.cache.access.count`
+
+ **Type**: Counter
+
+ **Unit**: `{access}`
+
+ **Description**: Secret service-layer cache accesses by outcome. `not_modified` (client revalidation returned 304), `hit` (served from cache), or `miss` (cache empty/stale, full read performed).
+
+ **Attributes**:
+ - `cache.result` (string): `not_modified`, `hit`, `miss`
+ </Accordion>
+
+ <Accordion title="Secret Cache Entry Bytes">
+ **Metric Name**: `infisical.secret.cache.entry.bytes`
+
+ **Type**: Histogram
+
+ **Unit**: `By`
+
+ **Description**: Encrypted secret cache entry size computed at write time. Use this to size the cache and tune the per-entry byte cap.
+ </Accordion>
+
+ <Accordion title="Secret Cache Oversize Skip">
+ **Metric Name**: `infisical.secret.cache.oversize_skip.count`
+
+ **Type**: Counter
+
+ **Unit**: `{skip}`
+
+ **Description**: Secret cache writes skipped because the entry exceeded the max byte cap. A high rate means large payloads are never being cached and will always incur a full read.
+ </Accordion>
+</AccordionGroup>
+
### Rate Limit Metrics (InfisicalCore)
<AccordionGroup>