@@ -11,6 +11,11 @@ import (
1111 "github.com/stackvista/stackstate-cli/internal/printer"
1212)
1313
14+ const (
15+ metricsKey = "metrics"
16+ errorsKey = "errors"
17+ )
18+
1419type StatusArgs struct {
1520 Urn string
1621 SubStream string
@@ -105,8 +110,8 @@ func RunStreamStatus(cli *di.Deps, api *stackstate_api.APIClient, args *StatusAr
105110 if cli .IsJson () {
106111 json := map [string ]interface {}{
107112 "consistency-model" : status .ConsistencyModel ,
108- "metrics" : streamMetricsToJson (status .AggregateMetrics ),
109- "errors" : streamErrorsToJson (status .GlobalErrors ),
113+ metricsKey : streamMetricsToJson (status .AggregateMetrics ),
114+ errorsKey : streamErrorsToJson (status .GlobalErrors ),
110115 }
111116 if status .HasMainStreamStatus () {
112117 json ["main-stream" ] = subStreamStatusToJson (* status .MainStreamStatus )
@@ -148,7 +153,7 @@ func streamMetricsToTable(metrics stackstate_api.HealthStreamMetrics) printer.Ta
148153 printer .MetricBucketToRow ("updates per seconds" , metrics .UpdatesPerSecond ),
149154 printer .MetricBucketToRow ("deletes per seconds" , metrics .DeletesPerSecond ),
150155 },
151- MissingTableDataMsg : printer.NotFoundMsg {Types : "metrics" },
156+ MissingTableDataMsg : printer.NotFoundMsg {Types : metricsKey },
152157 }
153158}
154159
@@ -174,7 +179,7 @@ func streamErrorsToTable(errors []stackstate_api.HealthStreamError) printer.Tabl
174179 return printer.TableData {
175180 Header : []string {"Message" , "Count" },
176181 Data : data ,
177- MissingTableDataMsg : printer.NotFoundMsg {Types : "errors" },
182+ MissingTableDataMsg : printer.NotFoundMsg {Types : errorsKey },
178183 }
179184}
180185
@@ -233,7 +238,7 @@ func streamConsistencyStateToTable(state stackstate_api.HealthSubStreamConsisten
233238 Data : [][]interface {}{
234239 {repeatInterval , expiryInterval , snapshotRepeatInterval , snapshotExpiryInterval , checkpointOffset , checkpointBatchIndex },
235240 },
236- MissingTableDataMsg : printer.NotFoundMsg {Types : "errors" },
241+ MissingTableDataMsg : printer.NotFoundMsg {Types : errorsKey },
237242 }
238243}
239244
@@ -251,8 +256,8 @@ func subStreamStatusToJson(status stackstate_api.HealthSubStreamStatus) map[stri
251256 return map [string ]interface {}{
252257 "check-state-count" : status .CheckStateCount ,
253258 "consistency-state" : streamConsistencyStateToJson (status .SubStreamState ),
254- "metrics" : streamMetricsToJson (status .Metrics ),
255- "errors" : streamErrorsToJson (status .Errors ),
259+ metricsKey : streamMetricsToJson (status .Metrics ),
260+ errorsKey : streamErrorsToJson (status .Errors ),
256261 }
257262}
258263
0 commit comments