Introducing a new way to review your PRs.

Read the announcement

bruin-data / dac

DaC is a dashboard-as-code tool. Build interactive dashboards using YAML and JSX. Built-in semantic layer. Get your agents to build standardized, reviewable dashboards.

View on GitHub

20 documents · Updated Nov 23, 2026

docs / updates-versioning-and-telemetry

Updates, versioning, and telemetry

DAC uses release metadata to identify the running CLI, checks for a suitable newer release without slowing normal commands, and sends anonymous usage signals when telemetry is enabled. These services support the CLI lifecycle from release build to user upgrade while keeping command output and command execution independent of network or telemetry problems.

The broader delivery context is described in Platform operations and delivery.

Version identity

Version identity gives users and support systems a stable way to identify a DAC binary. A build carries a version and an optional commit value, and the CLI exposes the same version through its app metadata and its version command.

Build metadata

Release builds receive the version and commit from the release tag. Development builds use a dev version, so they do not present themselves as a released build to the update service. The release setup also marks stable releases as the latest release and keeps edge releases separate.

References: .goreleaser.yaml• L1-35 main.go• L19-31 cmd/root.go• L14-17

Version reporting

The dac version command prints the version and adds the commit when one is available. The command stays free of telemetry hooks, and the process does not print an update nudge for version or help output.

References: cmd/version.go• L10-24 cmd/root.go• L19-25 main.go• L63-99

Update lifecycle

The update service helps an interactive user learn about a newer release without turning update checking into a required part of a command. It selects the release stream from the current version, uses a short-lived local result when possible, and reports a one-line action only after the command finishes.

Release channels

DAC supports a stable channel and an edge channel. Stable builds follow the latest normal release. Edge builds follow the newest matching edge release, which lets users test changes without mixing edge versions into the stable stream.

The dac upgrade command uses the current binary to choose its default channel. Users can select stable or edge, or pass a tag to install a specific version. The update nudge uses the same channel when it suggests the upgrade command.

References: pkg/…/check.go• L32-46 pkg/…/check.go• L176-213 cmd/upgrade.go• L19-50 cmd/upgrade.go• L130-136 pkg/…/nudge.go• L23-28

Update check flow

The check runs in the background while the requested CLI command runs. A fresh local result avoids a network request; otherwise the service asks GitHub for the latest release in the selected channel and stores the result for later runs.

This diagram shows how the check stays optional and how its result reaches the user without blocking the command.

flowchart TD
    A[Start DAC] --> B{Eligible build and no opt out?}
    B -- No --> C[Skip check]
    B -- Yes --> D[Start background check]
    D --> E{Fresh channel cache?}
    E -- Yes --> F[Use cached release]
    E -- No --> G[Read release data]
    G --> H{Request succeeds?}
    H -- No --> I[Close check without result]
    H -- Yes --> J[Save release result]
    F --> K[Compare with current version]
    J --> K
    K --> L{Command allows a nudge?}
    L -- No --> M[End with clean output]
    L -- Yes --> N{Result arrives before short wait?}
    N -- No --> O[End without nudge]
    N -- Yes --> P{Newer release?}
    P -- No --> Q[End without nudge]
    P -- Yes --> R[Print upgrade hint]

Checks do not run for development or test versions. DAC_NO_UPDATE_CHECK and DO_NOT_TRACK disable them. A failed request, an expired or invalid cache, and a missing home directory do not fail the user's command.

References: pkg/…/check.go• L66-143 pkg/…/check.go• L146-173 pkg/…/check.go• L215-247 main.go• L35-43

Update nudges

The nudge is a terminal-only hint that names the current and newer versions and gives the matching dac upgrade command. It is suppressed for version, help, upgrade, and update commands because those commands either need clean output or already address updates. It is also suppressed for non-terminal writers so scripts and CI logs stay stable.

References: main.go• L63-99 pkg/…/nudge.go• L9-29

Telemetry lifecycle

Telemetry gives the project anonymous signals about command use, timing, and failure without being part of the command's business result. It is enabled only when a build has a telemetry write key and the user has not opted out; initialization and event delivery are best effort, and the client hides its own log output so a telemetry problem does not add noise to the user's terminal.

Telemetry state

On the first enabled run, DAC creates an install record under ~/…/telemetry.json. The record keeps an anonymous install ID, its creation time, and the version first used. Later runs reuse that record, which lets events relate to one installation without storing a user identity.

The telemetry state is separate from the update cache. The update cache answers which release is current, while the telemetry state identifies the anonymous installation that produced an event.

References: pkg/…/state.go• L13-30 pkg/…/state.go• L33-54 pkg/…/telemetry.go• L57-95

Telemetry controls

The process reads TELEMETRY_OPTOUT and DO_NOT_TRACK before telemetry starts. A missing telemetry key also makes the client silent. If the telemetry client cannot start, initialization returns a no-op closer. In all of these cases, the CLI continues to run and does not send events.

Production and edge release jobs require the telemetry key before they build a release. Local builds can therefore remain silent while published builds have telemetry available.

References: main.go• L25-33 pkg/…/telemetry.go• L24-75 .github/…/release.yml• L32-49 .github/…/edge-release.yml• L63-81

Event handling

Real subcommands use command hooks to record a start event and an end event with the command name and duration. Command-specific actions add small, non-content signals such as the selected template, query source and outcome, or dashboard counts. Failures can produce a separate error event.

The event context contains the DAC version, operating system and architecture, an anonymous install ID, and a per-process run ID. It does not include SQL text, dashboard content, connection secrets, paths, or other project data. Events are queued for delivery, and a failed enqueue does not change the command result.

This diagram shows how command work and optional event work share a process but telemetry never controls the command result.

sequenceDiagram
    participant CLI as DAC process
    participant Hook as Command hooks
    participant State as Install state
    participant Client as Telemetry client
    participant Sink as Event service

    CLI->>State: Load or create anonymous install state
    State-->>CLI: Install identity or no state
    CLI->>Hook: Start real subcommand
    Hook->>Client: Queue command start
    CLI->>CLI: Run command action
    CLI->>Client: Queue domain event when useful
    Hook->>Client: Queue command end or error
    Client-->>Sink: Send events when enabled
    CLI->>CLI: Finish regardless of telemetry outcome

References: pkg/…/telemetry.go• L98-145 pkg/…/telemetry.go• L147-193 cmd/root.go• L19-63 README.md• L138-157

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the version value used by BuildInfo, the root CLI metadata, update eligibility, and telemetry app context aligned.
  • Keep stable and edge tag formats aligned between release workflows, channel detection, GitHub release lookup, and upgrade hints.
  • Keep the update cache channel-aware so a user who changes channels does not receive a result from the other stream.
  • Keep command hook coverage separate from clean-output commands so telemetry and update notices do not change version, help, or script output.
  • Keep telemetry field names and the anonymous install-state contract aligned when adding command-specific events.
  • Keep production and edge release key checks aligned with the build flag that embeds the telemetry key.
  • Keep telemetry client logging silent so initialization or delivery problems do not leak client messages into command output.

Important failure modes

TriggerConsequenceGuard
A release uses a version shape that does not identify its channelThe update check or upgrade command can follow the wrong release streamKeep edge tags in the expected edge form and stable tags distinct
GitHub is slow or unavailable during a commandNo update nudge appears, but the command still completesRun the check in the background and wait only for the short exit window
A stale, corrupt, or cross-channel update cache is presentThe check may need a fresh request instead of using the cached releaseValidate the cache data, age, and channel before use
Telemetry state cannot be read or writtenInstall and first-run events may be absentTreat state errors as non-fatal and continue the CLI
Telemetry client setup fails or its key is missingNo telemetry events are sent, and client output must remain absentUse the no-op fallback and silent client logger
Telemetry is opted outNo telemetry events are sentCheck both opt-out controls before enqueueing events

Key files

FileWhy to read it
main.goShows how version metadata, telemetry setup, background update checks, and exit-time nudges join the CLI lifecycle
cmd/root.goShows the public version metadata and which real subcommands receive telemetry hooks
cmd/version.goShows the user-facing version report
pkg/…/check.goShows channel selection, cache use, release lookup, and update comparison
pkg/…/nudge.goShows when an update hint is safe to print and how it maps to the upgrade command
cmd/upgrade.goShows channel selection and the user-facing upgrade path
pkg/…/telemetry.goShows telemetry controls, silent client setup, event context, command lifecycle events, and failure isolation
pkg/…/state.goShows the persistent anonymous installation state
.goreleaser.yamlShows how release metadata and the telemetry key enter published binaries
.github/…/release.ymlShows stable release checks for the telemetry key
.github/…/edge-release.ymlShows edge tag creation and edge release checks