Skip to content

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

rename to product analytics

Thiago Araujo da Silvae748fa0e9a6e
diff --git a/backend/CLAUDE.md b/backend/CLAUDE.md
index 928c4aa5d7..453b42ffb3 100644
--- a/backend/CLAUDE.md
+++ b/backend/CLAUDE.md
@@ -445,7 +445,7 @@ Two properties make the TTL safe to rely on:
- **It must stay above the retention window.** On a shard that is still being written the expiry is a second, coarser deadline racing the age trim. At 1 hour against 30 minutes the age trim always wins, and the TTL only ever fires on a shard that has gone quiet and that the cron no longer visits. Shortening it toward the retention window, or lengthening the cron's 10-minute interval past it, would start deleting shards out from under live writers.
- **It reaps, it does not migrate.** An orphaned shard's buffered entries are dropped, not drained. To hand an event type off cleanly, leave it in `POSTHOG_AGGREGATED_EVENTS` for one release so the cron empties it first.
-**Every bound above is silent when it bites, so all four limits are instrumented** (`recordTelemetryAggregation*Metric` in `lib/telemetry/metrics.ts`, labelled by event type only — the bucket id would multiply the series by 30). The retention trim reports how many entries it aged out, the parse step reports what it could not read back, and each drained shard reports the backlog it left behind, measured with `XLEN` after the drain trim (skipped entirely when OTel collection is off, since that round trip buys nothing else). Backlog is the leading signal: it rises before retention drops start, and a shard sitting near the `MAXLEN` cap is also shedding entries on write, which nothing can count. **Do not change one of these limits without reading those metrics first** — that is what they exist for, and the operator-facing version is in `docs/self-hosting/guides/monitoring-telemetry.mdx`.
+**Every bound above is silent when it bites, so all four limits are instrumented** (`recordProductAnalytics*Metric` in `lib/telemetry/metrics.ts`, labelled by event type only — the bucket id would multiply the series by 30). The retention trim reports how many entries it aged out, the parse step reports what it could not read back, and each drained shard reports the backlog it left behind, measured with `XLEN` after the drain trim (skipped entirely when OTel collection is off, since that round trip buys nothing else). Backlog is the leading signal: it rises before retention drops start, and a shard sitting near the `MAXLEN` cap is also shedding entries on write, which nothing can count. **Do not change one of these limits without reading those metrics first** — that is what they exist for, and the operator-facing version is in `docs/self-hosting/guides/monitoring-telemetry.mdx`.
Nothing reads the pre-stream `telemetry-event-*` keys, so a deploy that changes this layout drops whatever is still buffered. That is acceptable for product analytics, and it is the reason there is no migration path to maintain.
diff --git a/backend/src/lib/telemetry/metrics.ts b/backend/src/lib/telemetry/metrics.ts
index ab8a3dab10..be3bc6f8c7 100644
--- a/backend/src/lib/telemetry/metrics.ts
+++ b/backend/src/lib/telemetry/metrics.ts
@@ -688,30 +688,30 @@ export const recordAlertDispatchOutcomeMetric = (params: { resourceType: string;
});
};
-export enum TelemetryAggregationDropReason {
+export enum ProductAnalyticsDropReason {
Retention = "retention",
Unparseable = "unparseable"
}
-export const telemetryAggregationPublishedCounter = infisicalCoreMeter.createCounter(
- "infisical.telemetry_aggregation.published.count",
+export const productAnalyticsPublishedCounter = infisicalCoreMeter.createCounter(
+ "infisical.product_analytics.published.count",
{
- description: "Buffered telemetry events drained from Redis and published to PostHog, by event type.",
+ description: "Buffered product analytics events drained from Redis and published to PostHog, by event type.",
unit: "{event}"
}
);
-export const telemetryAggregationDroppedCounter = infisicalCoreMeter.createCounter(
- "infisical.telemetry_aggregation.dropped.count",
+export const productAnalyticsDroppedCounter = infisicalCoreMeter.createCounter(
+ "infisical.product_analytics.dropped.count",
{
description:
- "Buffered telemetry events dropped before reaching PostHog, by event type and reason. Occasional retention drops are tolerable; a sustained rate means the drain is not keeping up and the limits need tweaking.",
+ "Buffered product analytics events dropped before reaching PostHog, by event type and reason. Occasional retention drops are tolerable; a sustained rate means the drain is not keeping up and the limits need tweaking.",
unit: "{event}"
}
);
-export const telemetryAggregationBacklogHistogram = infisicalCoreMeter.createHistogram(
- "infisical.telemetry_aggregation.shard.backlog",
+export const productAnalyticsBacklogHistogram = infisicalCoreMeter.createHistogram(
+ "infisical.product_analytics.shard.backlog",
{
description:
"Entries left in a shard after its drain, by event type. Zero on a healthy run: a backlog that persists across runs is what precedes retention drops and, near the 100k MAXLEN, silent write-path eviction.",
@@ -719,30 +719,30 @@ export const telemetryAggregationBacklogHistogram = infisicalCoreMeter.createHis
}
);
-export const recordTelemetryAggregationPublishedMetric = (params: { eventType: string; count: number }) =>
+export const recordProductAnalyticsPublishedMetric = (params: { eventType: string; count: number }) =>
safely(() => {
if (!isTelemetryEnabled() || params.count === 0) return;
- telemetryAggregationPublishedCounter.add(params.count, { "telemetry_aggregation.event_type": params.eventType });
+ productAnalyticsPublishedCounter.add(params.count, { "product_analytics.event_type": params.eventType });
});
-export const recordTelemetryAggregationDroppedMetric = (params: {
+export const recordProductAnalyticsDroppedMetric = (params: {
eventType: string;
- reason: TelemetryAggregationDropReason;
+ reason: ProductAnalyticsDropReason;
count: number;
}) =>
safely(() => {
if (!isTelemetryEnabled() || params.count === 0) return;
- telemetryAggregationDroppedCounter.add(params.count, {
- "telemetry_aggregation.event_type": params.eventType,
- "telemetry_aggregation.drop_reason": params.reason
+ productAnalyticsDroppedCounter.add(params.count, {
+ "product_analytics.event_type": params.eventType,
+ "product_analytics.drop_reason": params.reason
});
});
-export const recordTelemetryAggregationBacklogMetric = (params: { eventType: string; backlog: number }) =>
+export const recordProductAnalyticsBacklogMetric = (params: { eventType: string; backlog: number }) =>
safely(() => {
if (!isTelemetryEnabled()) return;
- telemetryAggregationBacklogHistogram.record(params.backlog, {
- "telemetry_aggregation.event_type": params.eventType
+ productAnalyticsBacklogHistogram.record(params.backlog, {
+ "product_analytics.event_type": params.eventType
});
});
diff --git a/backend/src/lib/telemetry/telemetry-attributes.ts b/backend/src/lib/telemetry/telemetry-attributes.ts
index 6ecf8ed7e8..a6e47a43e3 100644
--- a/backend/src/lib/telemetry/telemetry-attributes.ts
+++ b/backend/src/lib/telemetry/telemetry-attributes.ts
@@ -19,8 +19,8 @@ export const INFISICAL_CORE_METER_ATTRIBUTES = [
"audit_log.actor_type",
"audit_log.backend",
"audit_log.drop_reason",
- "telemetry_aggregation.event_type",
- "telemetry_aggregation.drop_reason",
+ "product_analytics.event_type",
+ "product_analytics.drop_reason",
"audit_log_stream.provider",
"audit_log_stream.id",
"scim.operation",
diff --git a/backend/src/services/telemetry/telemetry-service.test.ts b/backend/src/services/telemetry/telemetry-service.test.ts
index 6b4b229c2a..c63ba65b5b 100644
--- a/backend/src/services/telemetry/telemetry-service.test.ts
+++ b/backend/src/services/telemetry/telemetry-service.test.ts
@@ -42,15 +42,15 @@ vi.mock("posthog-node", () => ({
// The drain's health signals: what it published, what it lost, and what it left behind. Spied here
// because a limit (MAXLEN, collect ceiling, retention window) can only be tuned against them.
const metrics = vi.hoisted(() => ({
- recordTelemetryAggregationPublishedMetric: vi.fn(),
- recordTelemetryAggregationDroppedMetric: vi.fn(),
- recordTelemetryAggregationBacklogMetric: vi.fn(),
+ recordProductAnalyticsPublishedMetric: vi.fn(),
+ recordProductAnalyticsDroppedMetric: vi.fn(),
+ recordProductAnalyticsBacklogMetric: vi.fn(),
isTelemetryEnabled: vi.fn(() => true)
}));
vi.mock("@app/lib/telemetry/metrics", () => ({
...metrics,
- TelemetryAggregationDropReason: { Retention: "retention", Unparseable: "unparseable" }
+ ProductAnalyticsDropReason: { Retention: "retention", Unparseable: "unparseable" }
}));
// eslint-disable-next-line import/first
@@ -414,7 +414,7 @@ describe("telemetry aggregated event storage", () => {
await telemetryService.processAggregatedEvents();
- expect(metrics.recordTelemetryAggregationDroppedMetric).toHaveBeenCalledWith({
+ expect(metrics.recordProductAnalyticsDroppedMetric).toHaveBeenCalledWith({
eventType: PostHogEventTypes.SecretPulled,
reason: "retention",
count: 4
@@ -435,12 +435,12 @@ describe("telemetry aggregated event storage", () => {
await telemetryService.processAggregatedEvents();
- expect(metrics.recordTelemetryAggregationDroppedMetric).toHaveBeenCalledWith({
+ expect(metrics.recordProductAnalyticsDroppedMetric).toHaveBeenCalledWith({
eventType: PostHogEventTypes.SecretPulled,
reason: "unparseable",
count: 1
});
- expect(metrics.recordTelemetryAggregationPublishedMetric).toHaveBeenCalledWith({
+ expect(metrics.recordProductAnalyticsPublishedMetric).toHaveBeenCalledWith({
eventType: PostHogEventTypes.SecretPulled,
count: 1
});
@@ -465,11 +465,11 @@ describe("telemetry aggregated event storage", () => {
// Only the drained shard is measured; an empty shard reports zero without spending a round trip.
expect(keyStore.streamLength).toHaveBeenCalledTimes(1);
expect(trimmedBeforeLength).toEqual([true]);
- expect(metrics.recordTelemetryAggregationBacklogMetric).toHaveBeenCalledWith({
+ expect(metrics.recordProductAnalyticsBacklogMetric).toHaveBeenCalledWith({
eventType: PostHogEventTypes.SecretPulled,
backlog: 12
});
- expect(metrics.recordTelemetryAggregationBacklogMetric).toHaveBeenCalledWith({
+ expect(metrics.recordProductAnalyticsBacklogMetric).toHaveBeenCalledWith({
eventType: PostHogEventTypes.SecretPulled,
backlog: 0
});
diff --git a/backend/src/services/telemetry/telemetry-service.ts b/backend/src/services/telemetry/telemetry-service.ts
index 217f85146d..60779fd22f 100644
--- a/backend/src/services/telemetry/telemetry-service.ts
+++ b/backend/src/services/telemetry/telemetry-service.ts
@@ -15,10 +15,10 @@ import { RequestContextKey } from "@app/lib/request-context/request-context-keys
import { requestMemoize } from "@app/lib/request-context/request-memoizer";
import {
isTelemetryEnabled as isOtelMetricsEnabled,
- recordTelemetryAggregationBacklogMetric,
- recordTelemetryAggregationDroppedMetric,
- recordTelemetryAggregationPublishedMetric,
- TelemetryAggregationDropReason
+ ProductAnalyticsDropReason,
+ recordProductAnalyticsBacklogMetric,
+ recordProductAnalyticsDroppedMetric,
+ recordProductAnalyticsPublishedMetric
} from "@app/lib/telemetry/metrics";
import { ActorType } from "@app/services/auth/auth-type";
import { TOrgDALFactory } from "@app/services/org/org-dal";
@@ -591,15 +591,15 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
if (entries.length >= TELEMETRY_EVENT_STREAM_COLLECT_CEILING) {
logger.warn(
- `Telemetry aggregation hit the collection ceiling for bucket ${bucketId} of ${eventType} [collected=${entries.length}] [ceiling=${TELEMETRY_EVENT_STREAM_COLLECT_CEILING}] [maxLen=${TELEMETRY_EVENT_STREAM_MAX_ENTRIES}] — the shard is backing up; the excess is dropped once it ages past the retention window or the stream hits its MAXLEN cap`
+ `Product analytics aggregation hit the collection ceiling for bucket ${bucketId} of ${eventType} [collected=${entries.length}] [ceiling=${TELEMETRY_EVENT_STREAM_COLLECT_CEILING}] [maxLen=${TELEMETRY_EVENT_STREAM_MAX_ENTRIES}] — the shard is backing up; the excess is dropped once it ages past the retention window or the stream hits its MAXLEN cap`
);
}
const events = parseEventPayloads(entries, `event=${eventType} bucket=${bucketId}`);
- recordTelemetryAggregationDroppedMetric({
+ recordProductAnalyticsDroppedMetric({
eventType,
- reason: TelemetryAggregationDropReason.Unparseable,
+ reason: ProductAnalyticsDropReason.Unparseable,
count: entries.length - events.length
});
@@ -616,7 +616,7 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
if (!isOtelMetricsEnabled()) return;
try {
- recordTelemetryAggregationBacklogMetric({ eventType, backlog: await keyStore.streamLength(streamKey) });
+ recordProductAnalyticsBacklogMetric({ eventType, backlog: await keyStore.streamLength(streamKey) });
} catch (error) {
logger.error(error, `Failed to measure backlog on bucket ${bucketId} for ${eventType}`);
}
@@ -636,9 +636,9 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
let expired = 0;
try {
expired = await keyStore.streamTrim(streamKey, `${Date.now() - TELEMETRY_EVENT_STREAM_RETENTION_MS}-0`);
- recordTelemetryAggregationDroppedMetric({
+ recordProductAnalyticsDroppedMetric({
eventType,
- reason: TelemetryAggregationDropReason.Retention,
+ reason: ProductAnalyticsDropReason.Retention,
count: expired
});
} catch (error) {
@@ -649,7 +649,7 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
const { events, collected, lastId } = await collectShardEvents(streamKey, eventType, bucketId);
if (collected === 0 || !lastId) {
- recordTelemetryAggregationBacklogMetric({ eventType, backlog: 0 });
+ recordProductAnalyticsBacklogMetric({ eventType, backlog: 0 });
return { published: 0, expired };
}
@@ -661,7 +661,7 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
await keyStore.streamTrim(streamKey, lastId, true);
- recordTelemetryAggregationPublishedMetric({ eventType, count: events.length });
+ recordProductAnalyticsPublishedMetric({ eventType, count: events.length });
await recordShardBacklog(streamKey, eventType, bucketId);
logger.info(`Processed ${events.length} events from bucket ${bucketId} for ${eventType}`);
@@ -696,7 +696,7 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
if (totalExpired > 0) {
logger.warn(
- `Telemetry aggregation dropped ${totalExpired} events for ${eventType} that aged past the ${
+ `Product analytics aggregation dropped ${totalExpired} events for ${eventType} that aged past the ${
TELEMETRY_EVENT_STREAM_RETENTION_MS / 60_000
}-minute retention window before they could be published`
);
diff --git a/docs/self-hosting/guides/monitoring-telemetry.mdx b/docs/self-hosting/guides/monitoring-telemetry.mdx
index 798b24e732..113db35cbd 100644
--- a/docs/self-hosting/guides/monitoring-telemetry.mdx
+++ b/docs/self-hosting/guides/monitoring-telemetry.mdx
@@ -879,7 +879,7 @@ High-volume product analytics events (secret pulls, machine identity logins, cer
<AccordionGroup>
<Accordion title="Aggregation Published">
- **Metric Name**: `infisical.telemetry_aggregation.published.count`
+ **Metric Name**: `infisical.product_analytics.published.count`
**Type**: Counter
@@ -888,11 +888,11 @@ High-volume product analytics events (secret pulls, machine identity logins, cer
**Description**: Buffered events drained from Redis and sent upstream. Use it as the denominator for the drop rate below.
**Attributes**:
- - `telemetry_aggregation.event_type` (string): the buffered event, e.g. `secrets pulled`
+ - `product_analytics.event_type` (string): the buffered event, e.g. `secrets pulled`
</Accordion>
<Accordion title="Aggregation Dropped">
- **Metric Name**: `infisical.telemetry_aggregation.dropped.count`
+ **Metric Name**: `infisical.product_analytics.dropped.count`
**Type**: Counter
@@ -901,12 +901,12 @@ High-volume product analytics events (secret pulls, machine identity logins, cer
**Description**: Buffered events discarded before they were sent. `retention` means the event aged past the 30-minute buffer window while the roll-up was behind; `unparseable` means its payload could not be read back and points at a bug rather than at capacity.
**Attributes**:
- - `telemetry_aggregation.event_type` (string)
- - `telemetry_aggregation.drop_reason` (string): `retention` or `unparseable`
+ - `product_analytics.event_type` (string)
+ - `product_analytics.drop_reason` (string): `retention` or `unparseable`
</Accordion>
<Accordion title="Aggregation Shard Backlog">
- **Metric Name**: `infisical.telemetry_aggregation.shard.backlog`
+ **Metric Name**: `infisical.product_analytics.shard.backlog`
**Type**: Histogram
@@ -915,7 +915,7 @@ High-volume product analytics events (secret pulls, machine identity logins, cer
**Description**: Entries left in a buffer shard after the roll-up finished with it. Zero on a healthy run.
**Attributes**:
- - `telemetry_aggregation.event_type` (string)
+ - `product_analytics.event_type` (string)
</Accordion>
</AccordionGroup>