Skip to content

Implement time-boxed CLI telemetry with opt-out controls#4927

Draft
arturcic wants to merge 4 commits intoGitTools:next/v7from
arturcic:feature/telemetry
Draft

Implement time-boxed CLI telemetry with opt-out controls#4927
arturcic wants to merge 4 commits intoGitTools:next/v7from
arturcic:feature/telemetry

Conversation

@arturcic
Copy link
Copy Markdown
Member

Description

Introduces an optional telemetry pipeline to collect CLI usage data, featuring automated redaction of paths and sensitive values. Collection is restricted to a 3-month window following the release date and supports multiple opt-out mechanisms including environment variables and a CLI flag.

Related Issue

Resolves #XYZ

Motivation and Context

This change helps maintainers make data-driven OSS design decisions by understanding common CLI patterns and environment contexts while preserving user privacy through strict redaction and transparency notices.

How Has This Been Tested?

Tested via new unit test suites covering argument parsing, redaction logic, environment-based opt-out, and release window validation.

Screenshots (if appropriate):

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Implement a telemetry pipeline to collect redacted CLI usage data for OSS design decisions. Users can opt out via environment variables `DO_NOT_TRACK`, `GITVERSION_TELEMETRY_OPTOUT`, or the `--telemetry-opt-out` flag.
Embed release dates in assembly metadata during build and disable telemetry if the window has expired or metadata is missing.
Detect the current CI environment and identify whether the CLI was invoked directly or via GitVersion.MsBuild to better understand usage patterns.
…older

Organize the GitVersion.App project structure by grouping telemetry components into their own directory.
@arturcic arturcic requested review from HHobeck, asbjornu and gep13 April 29, 2026 15:41
@sonarqubecloud
Copy link
Copy Markdown

@arturcic
Copy link
Copy Markdown
Member Author

Here is a bit more context:

Implement time-boxed, privacy-focused telemetry for the GitVersion CLI.

Introduce a telemetry pipeline that collects narrow CLI usage data for a 3-month window following a release. This system includes automated redaction of sensitive paths and credentials while providing multiple opt-out mechanisms via environment variables and CLI flags.

Changes
Add CommandLineTelemetry model and TelemetryReporter to handle data collection and user disclosure.
Integrate telemetry tracking into both ArgumentParser and LegacyArgumentParser with automated PII redaction.
Update MSBuild targets to identify internal tool invocations via the GITVERSION_INTERNAL_CALLER environment variable.
Embed release date metadata into assemblies during build to enforce the three-month collection window.
Impact
Users receive a one-time disclosure notice in the console upon the first telemetry-eligible execution.
Enables maintainers to analyze CLI argument usage and CI provider distribution without collecting repository content.
Provides three opt-out methods: DO_NOT_TRACK, GITVERSION_TELEMETRY_OPTOUT, or the --telemetry-opt-out flag.
Introduces new dependencies on local application data storage for tracking the disclosure notice state.

What is left is to decide on the backend where all the usage is saved, preferable with some dashboard we can use to see the different usage types.

This is a follow up on the refactoring done for v7 where the new POSIX compliant cli was introduced. @asbjornu @gep13 @HHobeck, do you mind to have a look and suggest a backend solution for this? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant