Skip to content

Commit

Permalink
fix: make static bug (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei authored Dec 16, 2024
1 parent 788adb4 commit 31dce3e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
3 changes: 2 additions & 1 deletion pkg/cmd/trace/chart/reconciliation_trace_chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"

tracev1 "github.com/apecloud/kubeblocks/apis/trace/v1"

"github.com/apecloud/kbcli/pkg/cmd/trace/chart/objecttree"
"github.com/apecloud/kbcli/pkg/cmd/trace/chart/richviewport"
"github.com/apecloud/kbcli/pkg/cmd/trace/chart/summary"
"github.com/apecloud/kbcli/pkg/cmd/trace/chart/timeserieslinechart"
tracev1 "github.com/apecloud/kubeblocks/apis/trace/v1"
)

var (
Expand Down
10 changes: 4 additions & 6 deletions pkg/cmd/trace/chart/timeserieslinechart/timeserieslinechart.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ type dataSet struct {
LineStyle runes.LineStyle // type of line runes to draw
Style lipgloss.Style

lastTime time.Time // last seen time value

// stores TimePoints as FloatPoint64{X:time.Time, Y: value}
// time.Time will be converted to seconds since epoch.
// both time and value will be scaled to fit the graphing area
Expand Down Expand Up @@ -272,7 +270,7 @@ func (m *Model) Push(t TimePoint) {
m.PushDataSet(DefaultDataSetName, t)
}

// Push will push a TimePoint data value to a data set
// PushDataSet will push a TimePoint data value to a data set
// to be displayed with Draw. Using given data set by name string.
func (m *Model) PushDataSet(n string, t TimePoint) {
f := canvas.Float64Point{X: float64(t.Time.Unix()), Y: t.Value}
Expand Down Expand Up @@ -479,7 +477,7 @@ func (m *Model) DrawBrailleDataSets(names []string) {
}
}

// DrawColumnRune draws a braille rune on to the canvas at given (X,Y) coordinates with given style.
// DrawBrailleRune draws a braille rune on to the canvas at given (X,Y) coordinates with given style.
// The function checks for existing braille runes already on the canvas and
// will draw a new braille pattern with the dot patterns of both the existing and given runes.
// Does nothing if given rune is Null or is not a braille rune.
Expand Down Expand Up @@ -521,7 +519,7 @@ func (m *Model) getLineSequence(points []canvas.Float64Point) []int {
// each index of the bucket corresponds to a graph column.
// each index value is the average of data point values
// that is mapped to that graph column.
buckets := make([]cAverage, width, width)
buckets := make([]cAverage, width)
for i := 0; i < dataLen; i++ {
j := i + 1
if j >= dataLen {
Expand All @@ -545,7 +543,7 @@ func (m *Model) getLineSequence(points []canvas.Float64Point) []int {
}
}
// populate sequence of Y values to for drawing
r := make([]int, width, width)
r := make([]int, width)
for i, v := range buckets {
r[i] = int(math.Round(v.Avg))
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/trace/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ import (
cmdutil "k8s.io/kubectl/pkg/cmd/util"
"k8s.io/kubectl/pkg/util/templates"

tracev1 "github.com/apecloud/kubeblocks/apis/trace/v1"

"github.com/apecloud/kbcli/pkg/cmd/trace/chart"
"github.com/apecloud/kbcli/pkg/types"
"github.com/apecloud/kbcli/pkg/util"
tracev1 "github.com/apecloud/kubeblocks/apis/trace/v1"
)

var (
Expand Down

0 comments on commit 31dce3e

Please sign in to comment.