-
Notifications
You must be signed in to change notification settings - Fork 14
feat(appkit): send internal telemetry via AppkitLog schema #332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
59458ca
feat(appkit): send internal telemetry via AppkitLog schema
calvarjorge 4e720ed
fix(playground): bind DATABRICKS_JOB_ID in app.yaml
calvarjorge af6f6f3
fix(appkit): use /telemetry-ext and resolve redirect locations
calvarjorge e45773b
refactor(appkit): drop legacy observability_log startup telemetry
calvarjorge b207f28
fix(appkit): read app_id from DATABRICKS_CLIENT_ID
calvarjorge 986c42f
refactor(appkit): rename internal telemetry kill-switch env var
calvarjorge f7ac315
refactor(appkit): inline sender.ts into reporter
calvarjorge 651377d
docs: add public internal-telemetry page
calvarjorge 688059e
fix(appkit): harden telemetry dispatch + revert knip cdxgen change
calvarjorge eab7c4b
refactor(appkit): hoist redirect body.cancel() out of the branch
calvarjorge 08378b9
chore(appkit): drop redirect-follow logic to test endpoint behavior
calvarjorge f955015
chore(appkit): drop redirect handling and dev-playground doc section
calvarjorge 6e80df3
chore(appkit): drop public TelemetryReporter exports + dev-playground…
calvarjorge fb4e05a
docs(appkit): rename internal-telemetry page to Privacy + DO_NOT_TRACK
calvarjorge db00fcd
chore(appkit): drop .js suffixes from internal-telemetry imports
calvarjorge 9547764
docs(appkit): trim Privacy page
calvarjorge ce2e36e
chore(playground): drop appkit.plugins.json
calvarjorge a9f6a18
chore(appkit): send empty bodies for APP_STARTUP and HEARTBEAT
calvarjorge be24186
refactor(appkit): send telemetry via client.apiClient.request
calvarjorge 6894085
fix(appkit): stop telemetry reporter on graceful shutdown + cover mid…
calvarjorge 90fcb58
chore(appkit): remove dead consoledonottrack.com link
calvarjorge 5776907
chore: drop .superset/config.json from gitignore
calvarjorge ea682b7
Merge branch 'main' into jorge.calvar/send_telemetry
calvarjorge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| --- | ||
| sidebar_position: 99 | ||
| --- | ||
|
|
||
| # Privacy | ||
|
|
||
| AppKit sends a small amount of anonymized usage telemetry to Databricks | ||
| so the team can understand how the SDK is used and prioritize | ||
| improvements. This page documents exactly what is sent, when, and how | ||
| to turn it off. | ||
|
|
||
| ## What we collect | ||
|
|
||
| Every event is a single record with three top-level fields: | ||
|
|
||
| | Field | Type | Source | | ||
| | ---------------- | ------ | ----------------------------------- | | ||
| | `event_name` | enum | One of `APP_STARTUP`, `HEARTBEAT`, `REQUEST_METRICS` | | ||
| | `app_id` | string | The app's OAuth client UUID (`DATABRICKS_CLIENT_ID`) | | ||
| | `appkit_version` | string | The AppKit SDK version | | ||
|
|
||
| Each event also carries one of three event-specific bodies: | ||
|
|
||
| - **`APP_STARTUP`** — emitted once when `createApp` finishes booting. | ||
| Empty body. | ||
| - **`HEARTBEAT`** — emitted every five minutes from a running app. | ||
| Empty body. | ||
| - **`REQUEST_METRICS`** — emitted once per minute, one record per HTTP | ||
| endpoint that received traffic in the window. Each record contains: | ||
| - `endpoint` — the route template (e.g. `GET /api/genie/:space_id/messages`), | ||
| never the raw request URL or any user-provided values. | ||
| - `request_count` | ||
| - `request_latency_ms_avg` | ||
| - `response_count_http4xx` | ||
| - `response_count_http5xx` | ||
|
|
||
| ## How to opt out | ||
|
|
||
| Set any one of the following: | ||
|
|
||
| ```sh | ||
| DISABLE_APPKIT_INTERNAL_TELEMETRY=true | ||
| DO_NOT_TRACK=1 | ||
| ``` | ||
|
|
||
| Either fully disables the reporter — no events are emitted and no | ||
| network calls are made. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // IMPORTANT: keep this file in sync with the AppkitLog proto schema served by | ||
| // the Databricks client telemetry endpoint. Field names use proto JSON | ||
| // conventions (snake_case) so the wire format matches the backend. | ||
|
|
||
| export type AppkitEventName = | ||
| | "APPKIT_EVENT_NAME_UNSPECIFIED" | ||
| | "APP_STARTUP" | ||
| | "HEARTBEAT" | ||
| | "REQUEST_METRICS"; | ||
|
|
||
| export type AppStartupEvent = Record<string, never>; | ||
|
|
||
| export type HeartbeatEvent = Record<string, never>; | ||
|
|
||
| export interface RequestMetricsEvent { | ||
| endpoint?: string; | ||
| request_count?: number; | ||
| request_latency_ms_avg?: number; | ||
| response_count_http4xx?: number; | ||
| response_count_http5xx?: number; | ||
| } | ||
|
|
||
| export interface AppkitLog { | ||
|
calvarjorge marked this conversation as resolved.
|
||
| event_name: AppkitEventName; | ||
| app_id?: string; | ||
| appkit_version?: string; | ||
| app_startup_event?: AppStartupEvent; | ||
| heartbeat_event?: HeartbeatEvent; | ||
| request_metrics_event?: RequestMetricsEvent; | ||
| } | ||
|
|
||
| interface AppkitLogEnvelope { | ||
| frontend_log_event_id: string; | ||
| inferred_timestamp_millis: number; | ||
| entry: { appkit_log: AppkitLog }; | ||
| } | ||
|
|
||
| interface TelemetryPayload { | ||
| uploadTime: number; | ||
| items: never[]; | ||
| protoLogs: string[]; | ||
| } | ||
|
|
||
| export function wrapAppkitLog(log: AppkitLog): AppkitLogEnvelope { | ||
| return { | ||
| frontend_log_event_id: `appkit-${log.event_name.toLowerCase()}-${crypto.randomUUID()}`, | ||
| inferred_timestamp_millis: Date.now(), | ||
| entry: { appkit_log: log }, | ||
| }; | ||
| } | ||
|
|
||
| export function buildAppkitPayload(logs: AppkitLog[]): TelemetryPayload { | ||
| return { | ||
| uploadTime: Date.now(), | ||
| items: [], | ||
| protoLogs: logs.map((log) => JSON.stringify(wrapAppkitLog(log))), | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /** | ||
| * Checks whether internal telemetry is enabled. | ||
| * Shared across all telemetry event types (startup, heartbeat, metrics, etc.). | ||
| */ | ||
| export function isInternalTelemetryEnabled(opts?: { | ||
| disableInternalTelemetry?: boolean; | ||
| }): boolean { | ||
| if (opts?.disableInternalTelemetry) return false; | ||
| if (process.env.DISABLE_APPKIT_INTERNAL_TELEMETRY === "true") return false; | ||
| if (process.env.DO_NOT_TRACK === "1") return false; | ||
| return true; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // Internal telemetry: APP_STARTUP, HEARTBEAT, and REQUEST_METRICS events | ||
| // POSTed to /telemetry-ext so the Databricks team can prioritize SDK work. | ||
| // Disable with disableInternalTelemetry: true on createApp, | ||
| // DISABLE_APPKIT_INTERNAL_TELEMETRY=true, or DO_NOT_TRACK=1. | ||
| // Full data inventory: docs/docs/privacy.mdx. | ||
|
|
||
| export { isInternalTelemetryEnabled } from "./config"; | ||
| export { TelemetryReporter } from "./reporter"; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.