Skip to content

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

refactor: rename OTEL_DROP_LEGACY_METERS to OTEL_DROP_HIGH_CARDINALITY_METERS

Victor Hugo dos Santos89f1147f7069
diff --git a/.env.dev.example b/.env.dev.example
index da60b195e7..fbc3c73063 100644
--- a/.env.dev.example
+++ b/.env.dev.example
@@ -84,7 +84,7 @@ OTEL_OTLP_PUSH_INTERVAL=
OTEL_COLLECTOR_BASIC_AUTH_USERNAME=
OTEL_COLLECTOR_BASIC_AUTH_PASSWORD=
-OTEL_DROP_LEGACY_METERS=false
+OTEL_DROP_HIGH_CARDINALITY_METERS=false
PLAIN_API_KEY=
PLAIN_WISH_LABEL_IDS=
diff --git a/.env.example b/.env.example
index e856c595f5..f14bc7608f 100644
--- a/.env.example
+++ b/.env.example
@@ -71,7 +71,7 @@ OTEL_OTLP_PUSH_INTERVAL=
OTEL_COLLECTOR_BASIC_AUTH_USERNAME=
OTEL_COLLECTOR_BASIC_AUTH_PASSWORD=
-OTEL_DROP_LEGACY_METERS=false
+OTEL_DROP_HIGH_CARDINALITY_METERS=false
PLAIN_API_KEY=
PLAIN_WISH_LABEL_IDS=
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts
index a359ed5be5..ba487a5cc7 100644
--- a/backend/src/lib/config/env.ts
+++ b/backend/src/lib/config/env.ts
@@ -339,7 +339,7 @@ const envSchema = z
OTEL_COLLECTOR_BASIC_AUTH_USERNAME: zpStr(z.string().optional()),
OTEL_COLLECTOR_BASIC_AUTH_PASSWORD: zpStr(z.string().optional()),
OTEL_EXPORT_TYPE: z.enum(["prometheus", "otlp"]).optional(),
- OTEL_DROP_LEGACY_METERS: zodStrBool.default("false"),
+ OTEL_DROP_HIGH_CARDINALITY_METERS: zodStrBool.default("false"),
PYLON_API_KEY: zpStr(z.string().optional()),
DISABLE_AUDIT_LOG_GENERATION: zodStrBool.default("false"),
@@ -643,7 +643,7 @@ export const getTelemetryConfig = () => {
return {
useOtel: parsedEnv.data.OTEL_TELEMETRY_COLLECTION_ENABLED,
useDataDogTracer: parsedEnv.data.SHOULD_USE_DATADOG_TRACER,
- dropLegacyMeters: parsedEnv.data.OTEL_DROP_LEGACY_METERS,
+ dropHighCardinalityMeters: parsedEnv.data.OTEL_DROP_HIGH_CARDINALITY_METERS,
OTEL: {
otlpURL: parsedEnv.data.OTEL_EXPORT_OTLP_ENDPOINT,
otlpUser: parsedEnv.data.OTEL_COLLECTOR_BASIC_AUTH_USERNAME,
diff --git a/backend/src/lib/telemetry/instrumentation.ts b/backend/src/lib/telemetry/instrumentation.ts
index d80fd8fb8e..b5a63e99c6 100644
--- a/backend/src/lib/telemetry/instrumentation.ts
+++ b/backend/src/lib/telemetry/instrumentation.ts
@@ -26,9 +26,6 @@ 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", "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",
@@ -64,9 +61,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"];
+// Every meter that predates the InfisicalCore allowlist. None have a View, so their per-actor / unbounded
+// labels (user.email, client.address, syncId, ...) flow through unchanged unless dropped wholesale via
+// OTEL_DROP_HIGH_CARDINALITY_METERS. Kept on by default for self-hosted; dropped in multi-tenant/cloud.
+const HIGH_CARDINALITY_METER_NAMES = ["Infisical", "API", "SecretSyncs", "PkiSyncs", "Integrations"];
const initTelemetryInstrumentation = ({
exportType,
@@ -74,14 +72,14 @@ const initTelemetryInstrumentation = ({
otlpUser,
otlpPassword,
otlpPushInterval,
- dropLegacyMeters
+ dropHighCardinalityMeters
}: {
exportType?: string;
otlpURL?: string;
otlpUser?: string;
otlpPassword?: string;
otlpPushInterval?: number;
- dropLegacyMeters?: boolean;
+ dropHighCardinalityMeters?: boolean;
}) => {
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
@@ -129,8 +127,8 @@ const initTelemetryInstrumentation = ({
})
];
- if (dropLegacyMeters) {
- LEGACY_METER_NAMES.forEach((meterName) => {
+ if (dropHighCardinalityMeters) {
+ HIGH_CARDINALITY_METER_NAMES.forEach((meterName) => {
views.push(new View({ meterName, aggregation: Aggregation.Drop() }));
});
}
@@ -156,7 +154,7 @@ const setupTelemetry = () => {
console.log("Initializing telemetry instrumentation");
initTelemetryInstrumentation({
...appCfg.OTEL,
- dropLegacyMeters: Boolean(appCfg.dropLegacyMeters)
+ dropHighCardinalityMeters: Boolean(appCfg.dropHighCardinalityMeters)
});
}
diff --git a/backend/src/lib/telemetry/metrics.ts b/backend/src/lib/telemetry/metrics.ts
index 8e329bf4cd..54c4a35722 100644
--- a/backend/src/lib/telemetry/metrics.ts
+++ b/backend/src/lib/telemetry/metrics.ts
@@ -57,8 +57,9 @@ const lazyMeter = (meterName: string): LazyMeter => ({
}
});
-// Legacy meter — kept for backwards compatibility. The pre-existing metrics below already ship with
-// high-cardinality labels documented in the docs.
+// High-cardinality, per-actor meter, kept on by default for self-hosted (where per-actor visibility is
+// useful and cardinality is bounded by a single org); dropped in multi-tenant/cloud via
+// OTEL_DROP_HIGH_CARDINALITY_METERS. The pre-existing metrics below ship with per-actor labels documented in the docs.
const infisicalMeter = lazyMeter("Infisical");
// The MeterProvider applies a strict attribute allowlist (View in
diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdx
index a37bf7dc8e..873c7890f5 100644
--- a/docs/self-hosting/configuration/envars.mdx
+++ b/docs/self-hosting/configuration/envars.mdx
@@ -870,8 +870,8 @@ If the export type is set to `otlp`, you will have to configure a value for `OTE
The password for authenticating with the telemetry collector.
</ParamField>
-<ParamField query="OTEL_DROP_LEGACY_METERS" type="string" default="false" optional>
- When set to `true`, the SDK discards all data points from the high-cardinality `Infisical` and `API` meters before aggregation. The instruments still exist in code (no errors), but nothing is stored or exported. Only bounded-cardinality `InfisicalCore` metrics are emitted. Useful for large or multi-tenant deployments where per-actor label cardinality is too expensive. See [Monitoring & Telemetry](/self-hosting/guides/monitoring-telemetry#available-metrics) for details.
+<ParamField query="OTEL_DROP_HIGH_CARDINALITY_METERS" type="string" default="false" optional>
+ When set to `true`, the SDK discards all data points from the high-cardinality, per-actor `Infisical`, `API`, `SecretSyncs`, `PkiSyncs`, and `Integrations` meters before aggregation. The instruments still exist in code (no errors), but nothing is stored or exported. Only bounded-cardinality `InfisicalCore` metrics are emitted. Useful for large or multi-tenant deployments where per-actor label cardinality is too expensive. See [Monitoring & Telemetry](/self-hosting/guides/monitoring-telemetry#available-metrics) for details.
</ParamField>
## Identity Auth Method
diff --git a/docs/self-hosting/guides/monitoring-telemetry.mdx b/docs/self-hosting/guides/monitoring-telemetry.mdx
index 19d968808d..ba982ce9f7 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.
-- **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.
+- **High-cardinality, per-actor meters:** 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 self-hosted deployments where you want per-user visibility directly in Grafana. May become expensive at large scale (many users, identities, or IPs) due to label cardinality.
- **`InfisicalCore` meter (bounded-cardinality):** all newer metrics (queue, audit log, 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.
-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.
+All meters emit at the same time. If you are a self-hosted instance and find the per-actor labels useful, keep using the high-cardinality metrics. For larger or multi-tenant 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 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`.
+To eliminate the in-memory cost of the high-cardinality meters entirely, set `OTEL_DROP_HIGH_CARDINALITY_METERS=true`. When enabled, the SDK discards all data points from the `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*.