Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

Commit 3a6a7c8

Browse files
committed
Added Stringer() interface to observers so that they list correctly in debug
1 parent be60394 commit 3a6a7c8

File tree

7 files changed

+35
-0
lines changed

7 files changed

+35
-0
lines changed

internal/configuration/configuration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var (
3535
type Observer interface {
3636
Init(configuration models.DeviceConfigurationMessage) error
3737
Update(configuration models.DeviceConfigurationMessage) error
38+
String() string
3839
}
3940

4041
type Manager struct {

internal/configuration/configuration_mock.go

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/logs/workload.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,7 @@ func (w *WorkloadsLogsTarget) WorkloadStarted(workloadName string, report []*pod
205205
log.Error("Cannot start workload logs", err)
206206
}
207207
}
208+
209+
func (w *WorkloadsLogsTarget) String() string {
210+
return "workload logs"
211+
}

internal/metrics/remote_write.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,3 +533,7 @@ func toTimeSeries(series []Series) (timeSeries []prompb.TimeSeries, lowest time.
533533
highest = fromDbTime(maxt)
534534
return
535535
}
536+
537+
func (r *RemoteWrite) String() string {
538+
return "remote write"
539+
}

internal/metrics/workload.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ func (wrkM *WorkloadMetrics) WorkloadStarted(workloadName string, report []*podm
8484
}
8585
}
8686

87+
func (wrKM *WorkloadMetrics) String() string {
88+
return "workload metrics"
89+
}
90+
8791
func getWorkloadUrls(report *podman.PodReport, config *models.Workload) []string {
8892
res := []string{}
8993
metricsPath := config.Metrics.Path

internal/mount/mount.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,7 @@ func getDefaultMountOptions() string {
170170
}
171171
return fmt.Sprintf("gid=%s,uid=%s", group.Gid, usr.Uid)
172172
}
173+
174+
func (m *Manager) String() string {
175+
return "mount"
176+
}

internal/os/os.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,7 @@ func (o *OS) updateGreenbootScripts() error {
207207

208208
return nil
209209
}
210+
211+
func (o *OS) String() string {
212+
return "rpm-ostree"
213+
}

0 commit comments

Comments
 (0)