-
Notifications
You must be signed in to change notification settings - Fork 702
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stats): Adds Telemetry validator, which prints a new Info level …
…message that will get printed during all hal config telemetry enable|disable and hal deploy apply invocations
- Loading branch information
Travis Tomsu
committed
Dec 9, 2019
1 parent
6545631
commit 099960c
Showing
6 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...ig/src/main/java/com/netflix/spinnaker/halyard/config/validate/v1/TelemetryValidator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.netflix.spinnaker.halyard.config.validate.v1; | ||
|
||
import com.netflix.spinnaker.halyard.config.model.v1.node.Telemetry; | ||
import com.netflix.spinnaker.halyard.config.model.v1.node.Validator; | ||
import com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemSetBuilder; | ||
import com.netflix.spinnaker.halyard.core.problem.v1.Problem.Severity; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@Slf4j | ||
public class TelemetryValidator extends Validator<Telemetry> { | ||
|
||
@Override | ||
public void validate(ConfigProblemSetBuilder p, Telemetry t) { | ||
StringBuilder msg = new StringBuilder(); | ||
msg.append("Telemetry is currently "); | ||
if (t.getEnabled()) { | ||
msg.append("ENABLED. Usage statistics are being collected—Thank you! "); | ||
msg.append("These stats inform improvements to the product, and that helps the community. "); | ||
msg.append("To disable, run `hal config telemetry disable`. "); | ||
} else { | ||
msg.append("DISABLED. Usage statistics are not being collected. "); | ||
msg.append("Please consider enabling statistic collection. "); | ||
msg.append("These stats inform improvements to the product, and that helps the community. "); | ||
msg.append("To enable, run `hal config telemetry enable`. "); | ||
} | ||
|
||
msg.append("To learn more about what and how telemetry data is used, please see "); | ||
msg.append("https://www.spinnaker.io/community/stats."); | ||
p.addProblem(Severity.INFO, msg.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters