From 155b29edbec033b4cd75ad9b299e9f9eb19bad45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20BUISSON?= Date: Fri, 21 Nov 2025 16:09:54 +0100 Subject: [PATCH] Add documentation about checkNewVersion --- cmd/traefik/traefik.go | 33 +++++--- docs/content/contributing/data-collection.md | 87 ++++++++++++++------ 2 files changed, 87 insertions(+), 33 deletions(-) diff --git a/cmd/traefik/traefik.go b/cmd/traefik/traefik.go index 8c2cab62c..32e88791e 100644 --- a/cmd/traefik/traefik.go +++ b/cmd/traefik/traefik.go @@ -114,9 +114,7 @@ func runCmd(staticConfiguration *static.Configuration) error { log.Debug().RawJSON("staticConfiguration", []byte(redactedStaticConfiguration)).Msg("Static configuration loaded [json]") } - if staticConfiguration.Global.CheckNewVersion { - checkNewVersion() - } + checkNewVersion(staticConfiguration) stats(staticConfiguration) @@ -614,13 +612,28 @@ func setupTracing(ctx context.Context, conf *static.Tracing) (*tracing.Tracer, i return tracer, closer } -func checkNewVersion() { - ticker := time.Tick(24 * time.Hour) - safe.Go(func() { - for time.Sleep(10 * time.Minute); ; <-ticker { - version.CheckNewVersion() - } - }) +func checkNewVersion(staticConfiguration *static.Configuration) { + logger := log.With().Logger() + + if staticConfiguration.Global.CheckNewVersion { + logger.Info().Msg(`Version check is enabled.`) + logger.Info().Msg(`Traefik checks for new releases to notify you if your version is out of date.`) + logger.Info().Msg(`It also collects usage data during this process.`) + logger.Info().Msg(`Check the documentation to get more info: https://doc.traefik.io/traefik/contributing/data-collection/`) + + ticker := time.Tick(24 * time.Hour) + safe.Go(func() { + for time.Sleep(10 * time.Minute); ; <-ticker { + version.CheckNewVersion() + } + }) + } else { + logger.Info().Msg(` +Version check is disabled. +You will not be notified if a new version is available. +More details: https://doc.traefik.io/traefik/contributing/data-collection/ +`) + } } func stats(staticConfiguration *static.Configuration) { diff --git a/docs/content/contributing/data-collection.md b/docs/content/contributing/data-collection.md index 645170b58..5153b038c 100644 --- a/docs/content/contributing/data-collection.md +++ b/docs/content/contributing/data-collection.md @@ -1,17 +1,72 @@ --- title: "Traefik Data Collection Documentation" -description: "To learn more about how Traefik is being used and improve it, we collect anonymous usage statistics from running instances. Read the technical documentation." +description: "Learn what data Traefik shares, how it is used, and how you can control it. This documentation explains both version check and anonymous usage statistics data. Read the technical documentation." --- # Data Collection -Understanding How Traefik is Being Used +Understanding the data Traefik shares and how it is used {: .subtitle } -## Configuration Example +## Introduction -Understanding how you use Traefik is very important to us: it helps us improve the solution in many different ways. -For this very reason, the sendAnonymousUsage option is mandatory: we want you to take time to consider whether or not you wish to share anonymous data with us, so we can benefit from your experience and use cases. +Protecting user privacy is essential to Traefik Labs, and we design every data-sharing mechanism with transparency and minimalism in mind. +This page describes the two types of data exchanged by Traefik and how to configure them. + +For more details on how your data is handled, please refer to our [Privacy and Cookie Policy](https://traefik.io/legal/privacy-and-cookie-policy). + +## Configuration Overview + +Traefik provides two independent mechanisms: + +- `checkNewVersion`, enabled by default. You may disable it at any time. +- `sendAnonymousUsage`, which requires explicit opt‑in. + +Examples below show how to activate or deactivate both of them. + +```yaml tab="YAML" +global: + checkNewVersion: true # set to false to disable + sendAnonymousUsage: false # set to true to enable +``` + +```toml tab="TOML" +[global] + checkNewVersion = true # set to false to disable + sendAnonymousUsage = false # set to true to enable +``` + +```bash tab="CLI" +--global.checkNewVersion=true # set to false to disable +--global.sendAnonymousUsage=false # set to true to enable +``` + +A log message at startup clearly indicates whether each of those options are enabled or disabled. + +## Version Check (`checkNewVersion`) – Opt-out + +Traefik periodically contacts `update.traefik.io` to determine whether a newer version is available. +When this request is made, Traefik shares the **running version** and the **public IP** of the instance. +The IP is used to build global usage statistics and does not influence the version comparison. + +This mechanism helps you stay informed about updates and provides TraefikLabs with a broad view of which versions are deployed in the wild. + +The collected IP addresses are also used for marketing purposes, specifically to detect companies running Traefik and offer them adapted support contracts, enterprise features, and tailored services. + +If you want to explore the implementation, you can read the version check source code: [version.go](https://github.com/traefik/traefik/blob/master/pkg/version/version.go) + +## Anonymous Usage Data (`sendAnonymousUsage`) – Opt‑in + +Traefik can also collect anonymous usage statistics once per day, starting 10 minutes after it starts running. +These statistics include: + +- the Traefik version, +- a hash of the configuration, +- an anonymized version of the static configuration (all sensitive fields removed: tokens, passwords, URLs, IP addresses, domains, emails, etc.). + +This feature comes from this [public proposal](https://github.com/traefik/traefik/issues/2369). + +This information helps TraefikLabs understand how Traefik is used in general and prioritize features and provider support accordingly. Dynamic configuration (routers and services) is never collected. !!! example "Enabling Data Collection" @@ -32,21 +87,6 @@ For this very reason, the sendAnonymousUsage option is mandatory: we want you to --global.sendAnonymousUsage ``` -## Collected Data - -This feature comes from this [public proposal](https://github.com/traefik/traefik/issues/2369). - -In order to help us learn more about how Traefik is being used and improve it, we collect anonymous usage statistics from running instances. -Those data help us prioritize our developments and focus on what's important for our users (for example, which provider is popular, and which is not). - -### What's collected / when ? - -Once a day (the first call begins 10 minutes after the start of Traefik), we collect: - -- the Traefik version number -- a hash of the configuration -- an **anonymized version** of the static configuration (token, username, password, URL, IP, domain, email, etc., are removed). - !!! info - We do not collect the dynamic configuration information (routers & services). @@ -93,8 +133,9 @@ providers: insecureSkipVerify: true ``` -## The Code for Data Collection +### The Code for Anonymous Usage Collection -If you want to dig into more details, here is the source code of the collecting system: [collector.go](https://github.com/traefik/traefik/blob/master/pkg/collector/collector.go) +If you want to explore the implementation, you can read the collector source code: +[collector.go](https://github.com/traefik/traefik/blob/master/pkg/collector/collector.go) -By default, we anonymize all configuration fields, except fields tagged with `export=true`. +Traefik anonymizes all configuration fields by default, except those explicitly marked with `export=true`.