I realised, by looking at the code only, that some stats about use appear to be sent by default to a remote database.
Although I understand the benefits of such stats as a tool builder, in particular during a beta, I find it problematic that it is not advertised clearly in the readme, with instructions to opt-out, or a completely opt-in operation instead (RGPD compliance etc).
I doubt most users will realise that (especially when using the Docker version), so I'm creating an issue to give a bit of visibility to this topic.
|
const ( |
|
influxURL = "https://europe-west1-1.gcp.cloud2.influxdata.com" |
|
influxToken = "ZgkcIAuMuoSM0KcG38iui5nLQrYv9oLiSCfJ2sin2exvxJnbMQjUea1kGQrsGteKCazgo_83thED1lS1O1XYEw==" |
|
influxOrg = "4b2adfedb7f7619e" |
|
influxBucket = "greenlight" |
|
) |
|
validateCmd.Flags().BoolP("telemetry", "", true, "Whether to collect and send information about execution time") |
|
viper.BindPFlag("telemetry", validateCmd.Flags().Lookup("telemetry")) |
|
if viper.GetBool("telemetry") { |
|
logTelemetry(validator, ctx.Results()) |
|
func logTelemetry(validator *greenlight.Validator, results []*greenlight.ValidationResult) { |
|
client := influxdb2.NewClient(influxURL, influxToken) |
|
defer client.Close() |
|
|
|
writeAPI := client.WriteAPI(influxOrg, influxBucket) |
|
|
|
for _, r := range results { |
|
if viper.GetBool("telemetry") { |
|
p := newPoint("document") |
|
p.AddField("schema_name", validator.SchemaPath()) |
|
p.AddField("schema_bytes", validator.SchemaSize()) |
|
p.AddField("execution_time_ms", r.ExecutionTime().Milliseconds()) |
|
p.AddField("name", r.Name) |
|
p.AddField("valid", r.Valid) |
|
writeAPI.WritePoint(p) |
|
|
|
for _, rule := range r.ValidationRules { |
|
p := newPoint("rule") |
|
p.AddField("schema_name", validator.SchemaPath()) |
|
p.AddField("schema_bytes", validator.SchemaSize()) |
|
p.AddField("execution_time_ms", rule.ExecutionTime().Milliseconds()) |
|
p.AddField("document_name", r.Name) |
|
p.AddTag("name", rule.Name) |
|
p.AddField("valid", rule.Valid) |
|
p.AddField("error_count", rule.ErrorCount) |
|
writeAPI.WritePoint(p) |
|
} |
|
} |
|
} |
|
|
|
writeAPI.Flush() |
|
} |