diff --git a/diagnostics/diagnostics.go b/diagnostics/diagnostics.go
index 35d37f6cc..b836e4b37 100644
--- a/diagnostics/diagnostics.go
+++ b/diagnostics/diagnostics.go
@@ -30,14 +30,15 @@ type versionResponse struct {
// Diagnostics represents a client to the Pilosa cluster.
type Diagnostics struct {
- mu sync.Mutex
- wg sync.WaitGroup
- closing chan struct{}
- host string
- VersionURL string
- version string
- startTime int64
- start time.Time
+ mu sync.Mutex
+ wg sync.WaitGroup
+ closing chan struct{}
+ host string
+ VersionURL string
+ version string
+ lastVersion string
+ startTime int64
+ start time.Time
metrics map[string]interface{}
@@ -124,6 +125,8 @@ func (d *Diagnostics) Open() {
st.Timeout = d.interval * 2
}
d.cb = gobreaker.NewCircuitBreaker(st)
+
+ d.logger().Printf("Pilosa is currently configured to send small diagnostics reports to our team every hour. More information here: https://www.pilosa.com/docs/latest/administration/")
}
// Close notify goroutine to stop.
@@ -149,6 +152,12 @@ func (d *Diagnostics) CheckVersion() error {
return fmt.Errorf("json decode: %s", err)
}
+ // Same a version as last test
+ if rsp.Version == d.lastVersion {
+ return nil
+ }
+
+ d.lastVersion = rsp.Version
if err := d.CompareVersion(rsp.Version); err != nil {
d.logger().Printf("%s\n", err.Error())
}
@@ -162,9 +171,9 @@ func (d *Diagnostics) CompareVersion(value string) error {
localVersion := VersionSegments(d.version)
if localVersion[0] < currentVersion[0] { //Major
- return fmt.Errorf("Warning: You are running an older version of Pilosa %s. The latest Major release is %s", d.version, value)
+ return fmt.Errorf("Warning: You are running Pilosa %s, but a newer version is available %s", d.version, value)
} else if localVersion[1] < currentVersion[1] { // Minor
- return fmt.Errorf("Warning: You are running an older version of Pilosa %s. The latest Minor release is %s", d.version, value)
+ return fmt.Errorf("Warning: You are running Pilosa %s. The latest Minor release is %s", d.version, value)
} else if localVersion[2] < currentVersion[2] { // Patch
return fmt.Errorf("There is a new patch relese of Pilosa availbale: %s", value)
}
diff --git a/diagnostics/diagnostics_test.go b/diagnostics/diagnostics_test.go
index 81d6b7cf6..18ea8d38e 100644
--- a/diagnostics/diagnostics_test.go
+++ b/diagnostics/diagnostics_test.go
@@ -73,12 +73,16 @@ func TestDiagnosticsVersion_Compare(t *testing.T) {
d.Open()
defer d.Close()
- version := "0.1.1"
+ version := "v0.1.1"
d.SetVersion(version)
err := d.CompareVersion("1.7.0")
- if !strings.Contains(err.Error(), "The latest Major release is") {
- t.Fatalf("Expected Major Version Missmatch, actual error: %s", err)
+ if !strings.Contains(err.Error(), "a newer version is available ") {
+ t.Fatalf("Expected a newer version is available, actual error: %s", err)
+ }
+ err = d.CompareVersion("1.7.0")
+ if !strings.Contains(err.Error(), "a newer version is available ") {
+ t.Fatalf("Expected a newer version is available, actual error: %s", err)
}
err = d.CompareVersion("0.7.0")
if !strings.Contains(err.Error(), "The latest Minor release is") {
diff --git a/docs/administration.md b/docs/administration.md
index 8d8762086..23b5d17f0 100644
--- a/docs/administration.md
+++ b/docs/administration.md
@@ -131,7 +131,7 @@ Each Pilosa cluster is configured by default to share anonymous usage details wi
OpenFiles: Open file handle count.
GoRoutines: Go routine count.
-You can opt-out of the Pilosa diagnostics reporting by setting either the `metric.diagnostics` configuration option to false, using the `PILOSA_METRIC_DIAGNOSTICS` environment variable, or the TOML configuration file `[metric]` `diagnostics` option.
+You can opt-out of the Pilosa diagnostics reporting by setting either the command line configuration option `--metric.diagnostics=false`, use the `PILOSA_METRIC_DIAGNOSTICS` environment variable, or the TOML configuration file `[metric]` `diagnostics` option.
#### Metrics