|
1 | 1 | import { BuildServerMetadata } from "@trigger.dev/core/v3"; |
2 | 2 |
|
3 | | -// Attribute names for the deployment telemetry events (see |
4 | | -// DEPLOYMENT_TELEMETRY_ATTRIBUTES.md next to this file). This module is the single owner of these names — Axiom |
5 | | -// queries, dashboards, and monitors reference them, so treat renames as |
6 | | -// breaking changes. |
| 3 | +/** |
| 4 | + * Attribute names for the `deployment.lifecycle` and `deployment.initialized` |
| 5 | + * telemetry events (emitted by services/recordDeploymentLifecycle.server.ts). |
| 6 | + * This module is the single owner of these names — external queries, |
| 7 | + * dashboards, and monitors reference them, so treat renames as breaking. |
| 8 | + * |
| 9 | + * Query gotchas: dedup with `arg_max(_time, *) by deployment.id` (job retries |
| 10 | + * can double-emit); the span's `_time` is the deployment's createdAt, so a |
| 11 | + * TIMED_OUT event lands backdated by up to the full deploy timeout — monitor |
| 12 | + * windows must exceed it; phase durations are omitted (not zero) when a |
| 13 | + * boundary timestamp is missing, and `total_ms` excludes local-bundle's |
| 14 | + * pre-init client work (esbuild + upload) until the CLI reports timings. |
| 15 | + */ |
7 | 16 | export const DeploymentTelemetryAttributes = { |
8 | 17 | ORG_ID: "$trigger.org.id", |
9 | 18 | PROJECT_ID: "$trigger.project.id", |
| 19 | + // Project external ref ("proj_…") |
10 | 20 | PROJECT_REF: "$trigger.project.ref", |
11 | 21 | ENV_ID: "$trigger.env.id", |
| 22 | + // PRODUCTION / STAGING / PREVIEW / DEVELOPMENT |
12 | 23 | ENV_TYPE: "$trigger.env.type", |
| 24 | + // Deployment friendly id — the dedup key |
13 | 25 | DEPLOYMENT_ID: "deployment.id", |
14 | 26 | VERSION: "deployment.version", |
| 27 | + // lifecycle: terminal status; initialized: initial status (PENDING/BUILDING) |
15 | 28 | STATUS: "deployment.status", |
| 29 | + // status === DEPLOYED; CANCELED is excluded from failure rates |
16 | 30 | SUCCESS: "deployment.success", |
| 31 | + // depot / native / local_bundle (see deriveBuildPath) |
17 | 32 | BUILD_PATH: "deployment.build_path", |
| 33 | + // V1 / MANAGED (run engine) |
18 | 34 | WORKER_TYPE: "deployment.worker_type", |
19 | 35 | RUNTIME: "deployment.runtime", |
| 36 | + // Set at indexing; null for pre-index failures |
20 | 37 | RUNTIME_VERSION: "deployment.runtime_version", |
| 38 | + // From x-trigger-cli-version at init; null for pre-column history |
21 | 39 | CLI_VERSION: "deployment.cli_version", |
22 | 40 | TRIGGERED_VIA: "deployment.triggered_via", |
23 | 41 | COMMIT_SHA: "deployment.commit_sha", |
| 42 | + // error.* only on FAILED/TIMED_OUT; CANCELED uses canceled_reason |
24 | 43 | ERROR_NAME: "deployment.error.name", |
25 | 44 | ERROR_MESSAGE: "deployment.error.message", |
26 | 45 | CANCELED_REASON: "deployment.canceled_reason", |
| 46 | + // createdAt → terminal (also the span's own duration) |
27 | 47 | DURATION_TOTAL_MS: "deployment.duration.total_ms", |
| 48 | + // createdAt → startedAt; ≈0 when created directly in BUILDING (depot) |
28 | 49 | DURATION_QUEUE_MS: "deployment.duration.queue_ms", |
| 50 | + // startedAt → installedAt; build-server paths only (depot never sets it) |
29 | 51 | DURATION_INSTALL_MS: "deployment.duration.install_ms", |
| 52 | + // (installedAt ?? startedAt) → builtAt |
30 | 53 | DURATION_BUILDING_MS: "deployment.duration.building_ms", |
| 54 | + // builtAt → terminal; for depot dominated by the server-side registry push |
31 | 55 | DURATION_DEPLOYING_MS: "deployment.duration.deploying_ms", |
32 | 56 | } as const; |
33 | 57 |
|
|
0 commit comments