History

Drop integration slugs from analytics events

Rhys Sullivan committed 3 months ago

Commit 668cec41 parent 49095aa4 files · +10 −16Browse files

Unified · Split

4 files
  1. apps/host-selfhost/src/execution.ts +1 −1
  2. apps/local/src/executor.ts +1 −1
  3. packages/core/analytics/src/analytics.test.ts +1 −4
  4. packages/core/analytics/src/events.ts +7 −10
apps/host-selfhost/src/execution.ts+1−1
@@ -58,7 +58,7 @@ export const SelfHostHostConfig: Layer.Layer<HostConfig> = Layer.sync(HostConfig · 57 unmodified lines
58 onIntegrationChange: (event) =>58 onIntegrationChange: (event) =>
59 selfHostAnalytics.record(59 selfHostAnalytics.record(
60 event.kind === "added" ? "integration_added" : "integration_removed",60 event.kind === "added" ? "integration_added" : "integration_removed",
61 { plugin_key: event.pluginKey, integration_slug: String(event.slug) },61 { plugin_key: event.pluginKey },
62 ),62 ),
63 };63 };
64});64});
apps/local/src/executor.ts+1−1
@@ -199,7 +199,7 @@ const createLocalExecutorLayer = (options: LocalExecutorOptions = {}) => { · 198 unmodified lines
199 onIntegrationChange: (event) =>199 onIntegrationChange: (event) =>
200 localAnalytics.record(200 localAnalytics.record(
201 event.kind === "added" ? "integration_added" : "integration_removed",201 event.kind === "added" ? "integration_added" : "integration_removed",
202 { plugin_key: event.pluginKey, integration_slug: String(event.slug) },202 { plugin_key: event.pluginKey },
203 ),203 ),
204 onElicitation: "accept-all",204 onElicitation: "accept-all",
205 oauthEndpointUrlPolicy: { allowHttp: true },205 oauthEndpointUrlPolicy: { allowHttp: true },
packages/core/analytics/src/analytics.test.ts+1−4
@@ -94,10 +94,7 @@ describe("Analytics", () => { · 93 unmodified lines
94 plane: "mcp",94 plane: "mcp",
95 toolkit: false,95 toolkit: false,
96 });96 });
97 yield* analytics.record("integration_added", {97 yield* analytics.record("integration_added", { plugin_key: "openapi" });
98 plugin_key: "openapi",
99 integration_slug: "github",
100 });
101 yield* analytics.flush;98 yield* analytics.flush;
102 99
103 const batches = yield* Ref.get(http.batches);100 const batches = yield* Ref.get(http.batches);
packages/core/analytics/src/events.ts+7−10
@@ -13,8 +13,11 @@ · 12 unmodified lines
13// - Never secrets, tokens, credentials, code, tool arguments or results.13// - Never secrets, tokens, credentials, code, tool arguments or results.
14// - Never user free text: no connection names, no tool addresses, no14// - Never user free text: no connection names, no tool addresses, no
15// toolkit slugs (user-entered labels — send booleans/counts instead).15// toolkit slugs (user-entered labels — send booleans/counts instead).
16// - Integration slugs and plugin keys ARE allowed (spec-derived vocabulary,16// - Plugin keys (`openapi`, `mcp`, `graphql`, ...) ARE allowed: a fixed,
17// matching the browser catalog's `integration_slug` / `plugin_key`).17// product-defined vocabulary. Integration slugs are NOT — stricter than
18// the browser catalog: these events leave the user's own infrastructure,
19// and WHICH integrations someone uses is their business, not ours. The
20// kind of integration is the product question; the slug is not.
18// - Identity is the anonymous per-install id only; no emails, no hostnames,21// - Identity is the anonymous per-install id only; no emails, no hostnames,
19// no person or org names.22// no person or org names.
20// ---------------------------------------------------------------------------23// ---------------------------------------------------------------------------
@@ -48,15 +51,9 @@ export interface AnalyticsEvents { · 27 unmodified lines
48 readonly toolkit: boolean;51 readonly toolkit: boolean;
49 };52 };
50 /** An integration row was created (upsert re-registers are not counted). */53 /** An integration row was created (upsert re-registers are not counted). */
51 integration_added: {54 integration_added: { readonly plugin_key: string };
52 readonly plugin_key: string;
53 readonly integration_slug: string;
54 };
55 /** An integration was removed by the user. */55 /** An integration was removed by the user. */
56 integration_removed: {56 integration_removed: { readonly plugin_key: string };
57 readonly plugin_key: string;
58 readonly integration_slug: string;
59 };
60 /** A generative-UI artifact was saved as a new row. */57 /** A generative-UI artifact was saved as a new row. */
61 artifact_created: { readonly via: ArtifactVia };58 artifact_created: { readonly via: ArtifactVia };
62 /**59 /**