Skip to content

Commit

Permalink
Correct telemetry log use (#12)
Browse files Browse the repository at this point in the history
* Correct telemetry log use

* Add supported node types to README.md
  • Loading branch information
hsoerensen authored Aug 17, 2024
1 parent e7d5b40 commit 4b5450c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ run a Voi node.

- Relay node
- Archiver node
- Developer node
- Participation node

Node type will default to 'relay' if not specified.
Node configuration will use testnet defaults unless otherwise provided at image build time.
Expand Down
2 changes: 2 additions & 0 deletions tools/start-node/start-node.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ func main() {
if err != nil {
log.Fatalf("Failed to set telemetry state: %v", err)
}

log.Printf("Telemetry %s. Telemetry Name: %s", map[bool]string{true: "enabled", false: "disabled"}[telemetrySet], telemetryName)
}

done = pu.StartProcess(algodCmd, "-d", algodDataDir)
Expand Down
10 changes: 3 additions & 7 deletions tools/utils/file_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,18 @@ func (fu FileUtils) EnsureGUIDExists(filePath string) error {
func (fu FileUtils) SetTelemetryState(filePath, telemetryName string, enabled bool) error {
err := fu.UpdateJSONAttribute(filePath, "Enable", enabled)
if err != nil {
log.Printf("failed to set telemetry enabled state: %v", err)
return err
return fmt.Errorf("failed to set telemetry enabled state: %v", err)
}
err = fu.UpdateJSONAttribute(filePath, "Name", telemetryName)
if err != nil {
log.Printf("failed to set telemetry name: %v", err)
return err
return fmt.Errorf("failed to set telemetry name: %v", err)
}

err = fu.EnsureGUIDExists(filePath)
if err != nil {
log.Printf("failed to ensure GUID exists: %v", err)
return err
return fmt.Errorf("failed to ensure GUID exists: %v", err)
}

log.Printf("Telemetry %s. Telemetry Name: %s", map[bool]string{true: "enabled", false: "disabled"}[enabled], telemetryName)
return nil
}

Expand Down

0 comments on commit 4b5450c

Please sign in to comment.