Skip to content

Commit

Permalink
Disable collect data by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored and traefiker committed Sep 16, 2019
1 parent e70c8a7 commit 47a9b08
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 39 deletions.
22 changes: 7 additions & 15 deletions cmd/traefik/traefik.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,24 +286,16 @@ func checkNewVersion() {
}

func stats(staticConfiguration *static.Configuration) {
if staticConfiguration.Global.SendAnonymousUsage == nil {
log.WithoutContext().Error(`
You haven't specified the sendAnonymousUsage option, it will be enabled by default.
`)
sendAnonymousUsage := true
staticConfiguration.Global.SendAnonymousUsage = &sendAnonymousUsage
}
logger := log.WithoutContext()

if *staticConfiguration.Global.SendAnonymousUsage {
log.WithoutContext().Info(`
Stats collection is enabled.
Many thanks for contributing to Traefik's improvement by allowing us to receive anonymous information from your configuration.
Help us improve Traefik by leaving this feature on :)
More details on: https://docs.traefik.io/v2.0/contributing/data-collection/
`)
if staticConfiguration.Global.SendAnonymousUsage {
logger.Info(`Stats collection is enabled.`)
logger.Info(`Many thanks for contributing to Traefik's improvement by allowing us to receive anonymous information from your configuration.`)
logger.Info(`Help us improve Traefik by leaving this feature on :)`)
logger.Info(`More details on: https://docs.traefik.io/v2.0/contributing/data-collection/`)
collect(staticConfiguration)
} else {
log.WithoutContext().Info(`
logger.Info(`
Stats collection is disabled.
Help us improve Traefik by turning this feature on :)
More details on: https://docs.traefik.io/v2.0/contributing/data-collection/
Expand Down
20 changes: 0 additions & 20 deletions docs/content/contributing/data-collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ Understanding How Traefik is Being Used
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.

!!! warning
Before the GA, leaving this option unset will not prevent Traefik from running but will generate an error log indicating that it enables data collection by default.

!!! example "Enabling Data Collection"

```toml tab="File (TOML)"
Expand Down Expand Up @@ -71,14 +68,6 @@ Once a day (the first call begins 10 minutes after the start of Traefik), we col
cert = "dockerCert"
key = "dockerKey"
insecureSkipVerify = true

[providers.ecs]
domain = "foo.bar"
exposedByDefault = true
clusters = ["foo-bar"]
region = "us-west-2"
accessKeyID = "AccessKeyID"
secretAccessKey = "SecretAccessKey"
```

??? example "Resulting Obfuscated Configuration"
Expand All @@ -92,7 +81,6 @@ Once a day (the first call begins 10 minutes after the start of Traefik), we col

[providers.docker]
endpoint = "xxxx"
domain = "xxxx"
exposedByDefault = true
swarmMode = true

Expand All @@ -101,14 +89,6 @@ Once a day (the first call begins 10 minutes after the start of Traefik), we col
cert = "xxxx"
key = "xxxx"
insecureSkipVerify = false

[providers.ecs]
domain = "xxxx"
exposedByDefault = true
clusters = []
region = "us-west-2"
accessKeyID = "xxxx"
secretAccessKey = "xxxx"
```

## The Code for Data Collection
Expand Down
3 changes: 1 addition & 2 deletions pkg/anonymize/anonymize_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ import (
func TestDo_globalConfiguration(t *testing.T) {
config := &static.Configuration{}

sendAnonymousUsage := true
config.Global = &static.Global{
CheckNewVersion: true,
SendAnonymousUsage: &sendAnonymousUsage,
SendAnonymousUsage: true,
}

config.AccessLog = &types.AccessLog{
Expand Down
4 changes: 2 additions & 2 deletions pkg/config/static/static_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ type CertificateResolver struct {

// Global holds the global configuration.
type Global struct {
CheckNewVersion bool `description:"Periodically check if a new version has been released." json:"checkNewVersion,omitempty" toml:"checkNewVersion,omitempty" yaml:"checkNewVersion,omitempty" label:"allowEmpty" export:"true"`
SendAnonymousUsage *bool `description:"Periodically send anonymous usage statistics. If the option is not specified, it will be enabled by default." json:"sendAnonymousUsage,omitempty" toml:"sendAnonymousUsage,omitempty" yaml:"sendAnonymousUsage,omitempty" label:"allowEmpty" export:"true"`
CheckNewVersion bool `description:"Periodically check if a new version has been released." json:"checkNewVersion,omitempty" toml:"checkNewVersion,omitempty" yaml:"checkNewVersion,omitempty" label:"allowEmpty" export:"true"`
SendAnonymousUsage bool `description:"Periodically send anonymous usage statistics. If the option is not specified, it will be enabled by default." json:"sendAnonymousUsage,omitempty" toml:"sendAnonymousUsage,omitempty" yaml:"sendAnonymousUsage,omitempty" label:"allowEmpty" export:"true"`
}

// ServersTransport options to configure communication between Traefik and the servers
Expand Down

0 comments on commit 47a9b08

Please sign in to comment.