# How to use Less method of gauge Package

Best Gauge code snippet using gauge.Less

local_sink_test.go

Source:local_sink_test.go

1package metrics2import (3 "fmt"4 "math"5 "math/rand"6 "strings"7 "testing"8 "github.com/stretchr/testify/assert"9)10var (11 perMetricCumulativeHistogramBounds = PerMetricCumulativeHistogramBounds{12 {13 "scope.latency_us",14 []int64{15 250 * 1000,16 500 * 1000,17 1 * 1000 * 1000,18 5 * 1000 * 1000,19 15 * 1000 * 1000,20 30 * 1000 * 1000,21 60 * 1000 * 1000,22 },23 },24 }25)26func BenchmarkLocalSinkCounters(b *testing.B) {27 sink := NewLocalSink(NullSink, 1e18, nil)28 for i := 0; i < b.N; i++ {29 sink.Handle(fmt.Sprintf("metric_%d", rand.Intn(10)), Tags{30 "a": "A",31 "b": "B",32 }, rand.Float64(), "ct")33 }34}35func BenchmarkLocalSinkStats(b *testing.B) {36 sink := NewLocalSink(NullSink, 1e18, nil)37 for i := 0; i < b.N; i++ {38 sink.Handle(fmt.Sprintf("metric_%d", rand.Intn(10)), Tags{39 "a": "A",40 "b": "B",41 }, rand.Float64(), "h")42 }43}44func BenchmarkLocalSinkFlush(b *testing.B) {45 sink := NewLocalSink(NullSink, 1e18, nil)46 for i := 0; i < 1000; i++ {47 sink.Handle(fmt.Sprintf("counter_%d", i), nil, 1.0, "ct")48 sink.Handle(fmt.Sprintf("stat_%d", i), nil, rand.Float64(), "h")49 }50 for i := 0; i < b.N; i++ {51 sink.Flush()52 }53}54func TestLocalSinkCounter(t *testing.T) {55 local, test := newLocalTestSink()56 local.Handle("test", nil, 1, metricTypeCounter)57 local.Handle("test", nil, 1, metricTypeCounter)58 local.Flush()59 assert.Equal(t, 1, len(test.stats))60 assert.Equal(t, formatMetric("test", nil, 2, metricTypeGauge), test.stats[0])61}62func TestLocalSinkCounterWithFlushThreshold(t *testing.T) {63 test := &testSink{}64 local := NewLocalSink(test, 1, nil)65 local.Handle("test", nil, 1, metricTypeCounter)66 local.Flush()67 // The second flush should be a no-op because the value hasn't changed68 assert.Equal(t, 1, len(test.stats))69 assert.Equal(t, formatMetric("test", nil, 1, metricTypeGauge), test.stats[0])70 local.Flush()71 // The second flush should be a no-op because the value hasn't changed72 assert.Equal(t, 1, len(test.stats))73 assert.Equal(t, formatMetric("test", nil, 1, metricTypeGauge), test.stats[0])74 local.Handle("test", nil, 1, metricTypeCounter)75 local.Flush()76 assert.Equal(t, 2, len(test.stats))77 assert.Equal(t, formatMetric("test", nil, 2, metricTypeGauge), test.stats[1])78}79func TestLocalSinkCounterWithTags(t *testing.T) {80 local, test := newLocalTestSink()81 local.Handle("test", Tags{"a": "b"}, 1, metricTypeCounter)82 local.Handle("test", Tags{"a": "b"}, 1, metricTypeCounter)83 local.Handle("test", Tags{"a": "c"}, 1, metricTypeCounter)84 local.Flush()85 mp := map[string]bool{86 formatMetric("test", Tags{"a": "b"}, 2, metricTypeGauge): true,87 formatMetric("test", Tags{"a": "c"}, 1, metricTypeGauge): true,88 }89 assert.Equal(t, 2, len(test.stats))90 assert.Equal(t, true, mp[test.stats[0]])91 assert.Equal(t, true, mp[test.stats[1]])92 assert.NotEqual(t, test.stats[0], test.stats[1])93}94func TestLocalSinkGauge(t *testing.T) {95 local, test := newLocalTestSink()96 local.Handle("test", nil, 1, metricTypeGauge)97 local.Handle("test", nil, 2, metricTypeGauge)98 local.Flush()99 assert.Equal(t, 1, len(test.stats))100 assert.Equal(t, formatMetric("test", nil, 2, metricTypeGauge), test.stats[0])101 local.Handle("test", nil, 3, metricTypeGauge)102 local.Flush()103 assert.Equal(t, 2, len(test.stats))104 assert.Equal(t, formatMetric("test", nil, 3, metricTypeGauge), test.stats[1])105}106func TestLocalSinkGaugeWithTags(t *testing.T) {107 local, test := newLocalTestSink()108 local.Handle("test", Tags{"a": "b"}, 1, metricTypeGauge)109 local.Handle("test", Tags{"a": "c"}, 2, metricTypeGauge)110 local.Flush()111 mp := map[string]bool{112 formatMetric("test", Tags{"a": "b"}, 1, metricTypeGauge): true,113 formatMetric("test", Tags{"a": "c"}, 2, metricTypeGauge): true,114 }115 assert.Equal(t, 2, len(test.stats))116 assert.Equal(t, true, mp[test.stats[0]])117 assert.Equal(t, true, mp[test.stats[1]])118 assert.NotEqual(t, test.stats[0], test.stats[1])119}120func unpackFlushed(s string) (string, float64, string) {121 var v float64122 split := strings.Split(s, " ")123 fmt.Sscanf(split[2], "%g", &v)124 return split[0], v, split[3]125}126func TestLocalSinkStat(t *testing.T) {127 local, test := newLocalTestSink()128 for i := 1; i <= 100; i++ {129 local.Handle("test", nil, float64(i), metricTypeStat)130 }131 local.Flush()132 mp := map[string]bool{133 formatMetric("test.count", nil, 100, metricTypeGauge): true,134 formatMetric("test.avg", nil, 50, metricTypeGauge): true,135 formatMetric("test.max", nil, 100, metricTypeGauge): true,136 formatMetric("test.min", nil, 1, metricTypeGauge): true,137 formatMetric("test.median", nil, 50, metricTypeGauge): true,138 formatMetric("test.90percentile", nil, 90, metricTypeGauge): true,139 formatMetric("test.99percentile", nil, 99, metricTypeGauge): true,140 }141 mpStats := make(map[string]bool)142 for _, s := range test.stats {143 name, value, mt := unpackFlushed(s)144 mpStats[formatMetric(name, nil, float64(math.Floor(value)), metricType(mt))] = true145 }146 assert.Equal(t, mp, mpStats)147}148func TestLocalSinkStatWithTags(t *testing.T) {149 local, test := newLocalTestSink()150 for i := 1; i <= 100; i++ {151 local.Handle("test", Tags{"a": "b"}, float64(i), metricTypeStat)152 }153 local.Flush()154 mp := map[string]bool{155 formatMetric("test.count", Tags{"a": "b"}, 100, metricTypeGauge): true,156 formatMetric("test.avg", Tags{"a": "b"}, 50, metricTypeGauge): true,157 formatMetric("test.max", Tags{"a": "b"}, 100, metricTypeGauge): true,158 formatMetric("test.min", Tags{"a": "b"}, 1, metricTypeGauge): true,159 formatMetric("test.median", Tags{"a": "b"}, 50, metricTypeGauge): true,160 formatMetric("test.90percentile", Tags{"a": "b"}, 90, metricTypeGauge): true,161 formatMetric("test.99percentile", Tags{"a": "b"}, 99, metricTypeGauge): true,162 }163 mpStats := make(map[string]bool)164 for _, s := range test.stats {165 name, value, mt := unpackFlushed(s)166 mpStats[formatMetric(name, Tags{"a": "b"}, float64(math.Floor(value)), metricType(mt))] = true167 }168 assert.Equal(t, mp, mpStats)169}170func TestLocalSinkCumulativeFrequency(t *testing.T) {171 local, test := newLocalTestSink()172 for i := 100000; i <= 100000000; i *= 2 {173 // Cumulative frequency counters should be created for this metric.174 local.Handle("scope.latency_us", Tags{"a": "b"}, float64(i), metricTypeStat)175 // No cumulative frequency counters should be created for this metrics.176 local.Handle("foo", Tags{"a": "b"}, float64(i), metricTypeStat)177 }178 local.Flush()179 metric := "scope.latency_us"180 expected := map[string]bool{181 formatMetric(metric+".less_than.250000", Tags{"a": "b"}, 2, metricTypeGauge): true,182 formatMetric(metric+".less_than.500000", Tags{"a": "b"}, 3, metricTypeGauge): true,183 formatMetric(metric+".less_than.1000000", Tags{"a": "b"}, 4, metricTypeGauge): true,184 formatMetric(metric+".less_than.5000000", Tags{"a": "b"}, 6, metricTypeGauge): true,185 formatMetric(metric+".less_than.15000000", Tags{"a": "b"}, 8, metricTypeGauge): true,186 formatMetric(metric+".less_than.30000000", Tags{"a": "b"}, 9, metricTypeGauge): true,187 formatMetric(metric+".less_than.60000000", Tags{"a": "b"}, 10, metricTypeGauge): true,188 formatMetric(metric+".less_than.inf", Tags{"a": "b"}, 10, metricTypeGauge): true,189 }190 notExpected := map[string]bool{191 formatMetric("foo.less_than.250000", Tags{"a": "b"}, 2, metricTypeGauge): true,192 formatMetric("foo.less_than.500000", Tags{"a": "b"}, 3, metricTypeGauge): true,193 formatMetric("foo.less_than.1000000", Tags{"a": "b"}, 4, metricTypeGauge): true,194 formatMetric("foo.less_than.5000000", Tags{"a": "b"}, 6, metricTypeGauge): true,195 formatMetric("foo.less_than.15000000", Tags{"a": "b"}, 8, metricTypeGauge): true,196 formatMetric("foo.less_than.30000000", Tags{"a": "b"}, 9, metricTypeGauge): true,197 formatMetric("foo.less_than.60000000", Tags{"a": "b"}, 10, metricTypeGauge): true,198 formatMetric("foo.less_than.inf", Tags{"a": "b"}, 10, metricTypeGauge): true,199 }200 actual := make(map[string]bool)201 for _, s := range test.stats {202 name, value, mt := unpackFlushed(s)203 actual[formatMetric(name, Tags{"a": "b"}, float64(math.Floor(value)), metricType(mt))] = true204 }205 for key := range expected {206 assert.Contains(t, actual, key)207 }208 for key := range notExpected {209 assert.NotContains(t, actual, key)210 }211}212func newLocalTestSink() (Sink, *testSink) {213 dst := &testSink{}214 local := NewLocalSink(dst, 1e18, perMetricCumulativeHistogramBounds)215 return local, dst216}217type testSink struct {218 stats []string219}220func formatMetric(metric string, tags Tags, value float64, metricType metricType) string {221 return fmt.Sprintf("%s %s %g %s", metric, FormatTags(tags), value, metricType)222}223func (sink *testSink) Handle(metric string, tags Tags, value float64, metricType metricType) error {224 sink.stats = append(sink.stats, formatMetric(metric, tags, value, metricType))225 return nil226}227func (sink *testSink) Flush() error { return nil }228func (sink *testSink) Close() {}...

prometheus_report_strategies.go

Source:prometheus_report_strategies.go

...29 var totalTime time.Duration30 var maxTime time.Duration31 var minTime time.Duration32 var totalAboveThreshold int6433 var totalLessThanMin int6434 var totalInMiddle int6435 for _, t := range results.GetPassedTests(name) {36 totalRequests++37 totalTime = totalTime + t.Duration()38 if t.Duration() > maxTime {39 maxTime = t.Duration()40 }41 if minTime == 0 || t.Duration() < minTime {42 minTime = t.Duration()43 }44 if t.Duration() <= p.MinTimeThreshold {45 totalLessThanMin++46 } else if t.Duration() > p.MinTimeThreshold && t.Duration() <= p.MaxTimeThreshold {47 totalInMiddle++48 }49 if t.Duration() > p.MaxTimeThreshold {50 totalAboveThreshold++51 }52 }53 avgRequestTime := int64(totalTime/time.Millisecond) / totalRequests54 lessThanPercent := (float64(totalLessThanMin) / float64(totalRequests)) * float64(100)55 middlePercent := (float64(totalInMiddle) / float64(totalRequests)) * float64(100)56 thresholdPercent := (float64(totalAboveThreshold) / float64(totalRequests)) * float64(100)57 concurrentRequestsGuage := promauto.NewGauge(prometheus.GaugeOpts{58 Name: "perf_concurrent_requests",59 })60 pusher.Collector(concurrentRequestsGuage)61 concurrentRequestsGuage.Set(float64(concurrentRequests))62 totalRequestsGuage := promauto.NewGauge(prometheus.GaugeOpts{63 Name: "perf_total_requests",64 })65 pusher.Collector(totalRequestsGuage)66 totalRequestsGuage.Set(float64(totalRequests))67 durationGuage := promauto.NewGauge(prometheus.GaugeOpts{68 Name: "perf_duration_s",69 })70 pusher.Collector(durationGuage)71 durationGuage.Set(float64(testDurationSec))72 totalTimeGuage := promauto.NewGauge(prometheus.GaugeOpts{73 Name: "perf_total_time_ms",74 })75 pusher.Collector(totalTimeGuage)76 totalTimeGuage.Set(float64(totalTime))77 passedGuage := promauto.NewGauge(prometheus.GaugeOpts{78 Name: "perf_passed_tests",79 })80 pusher.Collector(passedGuage)81 passedGuage.Set(float64(len(results.GetPassedTests(name))))82 failedGuage := promauto.NewGauge(prometheus.GaugeOpts{83 Name: "perf_failed_tests",84 })85 pusher.Collector(failedGuage)86 failedGuage.Set(float64(len(results.GetFailedTests(name))))87 avgTimeGuage := promauto.NewGauge(prometheus.GaugeOpts{88 Name: "perf_avg_request_time_ms",89 })90 pusher.Collector(avgTimeGuage)91 avgTimeGuage.Set(float64(avgRequestTime))92 minTimeGuage := promauto.NewGauge(prometheus.GaugeOpts{93 Name: "perf_min_request_time_ms",94 })95 pusher.Collector(minTimeGuage)96 minTimeGuage.Set(float64(minTime / time.Millisecond))97 maxTimeGuage := promauto.NewGauge(prometheus.GaugeOpts{98 Name: "perf_max_request_time_ms",99 })100 pusher.Collector(maxTimeGuage)101 maxTimeGuage.Set(float64(maxTime / time.Millisecond))102 countBelowGuage := promauto.NewGauge(prometheus.GaugeOpts{103 Name: "perf_count_below_threshold",104 })105 pusher.Collector(countBelowGuage)106 countBelowGuage.Set(float64(totalLessThanMin))107 countMiddleGuage := promauto.NewGauge(prometheus.GaugeOpts{108 Name: "perf_count_within_threshold",109 })110 pusher.Collector(countMiddleGuage)111 countMiddleGuage.Set(float64(totalInMiddle))112 countAboveGuage := promauto.NewGauge(prometheus.GaugeOpts{113 Name: "perf_count_above_threshold",114 })115 pusher.Collector(countAboveGuage)116 countAboveGuage.Set(float64(totalAboveThreshold))117 percentBelowGuage := promauto.NewGauge(prometheus.GaugeOpts{118 Name: "perf_percent_below_threshold",119 })120 pusher.Collector(percentBelowGuage)...

gauge.go

Source:gauge.go

...9 // DeltaSame represents no difference.10 DeltaSame delta = iota11 // DeltaMore represents a higher value.12 DeltaMore13 // DeltaLess represents a lower value.14 DeltaLess15 gaugeFmt = "0%dd"16)17type delta int18// Gauge represents a gauge component.19type Gauge struct {20 *Component21 data Metric22 resolution int23 deltaOk, deltaS2 delta24}25// NewGauge returns a new gauge.26func NewGauge(id string) *Gauge {27 return &Gauge{28 Component: NewComponent(id),29 }30}31// SetResolution overrides the default number of digits to display.32func (g *Gauge) SetResolution(n int) {33 g.resolution = n34}35// IsDial returns true if chart is a dial.36func (g *Gauge) IsDial() bool {37 return true38}39// Add adds a new metric.40func (g *Gauge) Add(m Metric) {41 g.mx.Lock()42 defer g.mx.Unlock()43 g.deltaOk, g.deltaS2 = computeDelta(g.data.S1, m.S1), computeDelta(g.data.S2, m.S2)44 g.data = m45}46type number struct {47 ok bool48 val int6449 str string50 delta delta51}52// Draw draws the primitive.53func (g *Gauge) Draw(sc tcell.Screen) {54 g.Component.Draw(sc)55 g.mx.RLock()56 defer g.mx.RUnlock()57 rect := g.asRect()58 mid := image.Point{X: rect.Min.X + rect.Dx()/2, Y: rect.Min.Y + rect.Dy()/2 - 1}59 style := tcell.StyleDefault.Background(g.bgColor)60 style = style.Foreground(tcell.ColorYellow)61 sc.SetContent(mid.X, mid.Y, 'â ', nil, style)62 max := g.data.MaxDigits()63 if max < g.resolution {64 max = g.resolution65 }66 var (67 fmat = "%" + fmt.Sprintf(gaugeFmt, max)68 o = image.Point{X: mid.X, Y: mid.Y - 1}69 )70 s1C, s2C := g.colorForSeries()71 d1, d2 := fmt.Sprintf(fmat, g.data.S1), fmt.Sprintf(fmat, g.data.S2)72 o.X -= len(d1) * 373 g.drawNum(sc, o, number{ok: true, val: g.data.S1, delta: g.deltaOk, str: d1}, style.Foreground(s1C).Dim(false))74 o.X = mid.X + 175 g.drawNum(sc, o, number{ok: false, val: g.data.S2, delta: g.deltaS2, str: d2}, style.Foreground(s2C).Dim(false))76 if rect.Dx() > 0 && rect.Dy() > 0 && g.legend != "" {77 legend := g.legend78 if g.HasFocus() {79 legend = fmt.Sprintf("[%s:%s:]", g.focusFgColor, g.focusBgColor) + g.legend + "[::]"80 }81 tview.Print(sc, legend, rect.Min.X, o.Y+3, rect.Dx(), tview.AlignCenter, tcell.ColorWhite)82 }83}84func (g *Gauge) drawNum(sc tcell.Screen, o image.Point, n number, style tcell.Style) {85 c1, _ := g.colorForSeries()86 if n.ok {87 style = style.Foreground(c1)88 printDelta(sc, n.delta, o, style)89 }90 dm, significant := NewDotMatrix(), n.val == 091 if significant {92 style = g.dimmed93 }94 for i := 0; i < len(n.str); i++ {95 if n.str[i] == '0' && !significant {96 g.drawDial(sc, dm.Print(int(n.str[i]-48)), o, g.dimmed)97 } else {98 significant = true99 g.drawDial(sc, dm.Print(int(n.str[i]-48)), o, style)100 }101 o.X += 3102 }103 if !n.ok {104 o.X++105 printDelta(sc, n.delta, o, style)106 }107}108func (g *Gauge) drawDial(sc tcell.Screen, m Matrix, o image.Point, style tcell.Style) {109 for r := 0; r < len(m); r++ {110 for c := 0; c < len(m[r]); c++ {111 dot := m[r][c]112 if dot == dots[0] {113 sc.SetContent(o.X+c, o.Y+r, dots[1], nil, g.dimmed)114 } else {115 sc.SetContent(o.X+c, o.Y+r, dot, nil, style)116 }117 }118 }119}120// ----------------------------------------------------------------------------121// Helpers...122func computeDelta(d1, d2 int64) delta {123 if d2 == 0 {124 return DeltaSame125 }126 d := d2 - d1127 switch {128 case d > 0:129 return DeltaMore130 case d < 0:131 return DeltaLess132 default:133 return DeltaSame134 }135}136func printDelta(sc tcell.Screen, d delta, o image.Point, s tcell.Style) {137 s = s.Dim(false)138 // nolint:exhaustive139 switch d {140 case DeltaLess:141 sc.SetContent(o.X-1, o.Y+1, 'â', nil, s)142 case DeltaMore:143 sc.SetContent(o.X-1, o.Y+1, 'â', nil, s)144 }145}...

Less

Using AI Code Generation

1import "fmt"2type gauge struct {3}4func (g gauge) area() float64 {5}6func (g gauge) perimeter() float64 {7 return 2 * (g.length + g.width)8}9func (g gauge) less(g2 gauge) bool {10 return g.area() < g2.area()11}12func main() {13 g1 := gauge{length: 10, width: 20}14 g2 := gauge{length: 30, width: 40}15 fmt.Println("g1 is less than g2: ", g1.less(g2))16 fmt.Println("g2 is less than g1: ", g2.less(g1))17}18import "fmt"19type gauge struct {20}21func (g gauge) area() float64 {22}23func (g gauge) perimeter() float64 {24 return 2 * (g.length + g.width)25}26func (g gauge) less(g2 gauge) bool {27 return g.area() < g2.area()28}29func main() {30 g1 := gauge{length: 10, width: 20}31 g2 := gauge{length: 30, width: 40}32 fmt.Println("g1 is less than g2: ", g1.less(g2))33 fmt.Println("g2 is less than g1: ", g2.less(g1))34}35import "fmt"36type gauge struct {37}38func (g gauge) area() float64 {39}40func (g gauge) perimeter() float64 {41 return 2 * (g.length + g.width)42}43func (g gauge) less(g2 gauge) bool {44 return g.area() < g2.area()

Less

Using AI Code Generation

1import (2type Gauge struct {3}4func (g GaugeList) Len() int {5 return len(g)6}7func (g GaugeList) Less(i, j int) bool {8}9func (g GaugeList) Swap(i, j int) {10}11func main() {12 g := GaugeList{13 Gauge{Pressure: 1.2, Temp: 2.3},14 Gauge{Pressure: 3.4, Temp: 4.5},15 Gauge{Pressure: 5.6, Temp: 6.7},16 }17 fmt.Println("Before sorting: ", g)18 sort.Sort(g)19 fmt.Println("After sorting: ", g)20}

Less

Using AI Code Generation

1import (2type gauge struct {3}4func (g gauge) Less(other gauge) bool {5}6func main() {7 g1 := gauge{value: 2.5}8 g2 := gauge{value: 3.5}9 g3 := gauge{value: 3.5}10 g4 := gauge{value: 2.5}11 g5 := gauge{value: 1.5}12}

Less

Using AI Code Generation

1import "fmt"2type gauge struct {3}4type gauge1 struct {5}6func (g gauge) Less(g1 gauge1) bool {7 if g.length < g1.length && g.width < g1.width {8 }9}10func main() {11 g := gauge{10, 20}12 g1 := gauge1{10, 20}13 fmt.Println(g.Less(g1))14}

Less

Using AI Code Generation

1import (2type Gauge struct {3}4func (g Gauge) Less(other Gauge) bool {5}6func main() {7 g1 := Gauge{value: rand.Intn(100)}8 g2 := Gauge{value: rand.Intn(100)}9 fmt.Println(g1.Less(g2))10}

Less

Using AI Code Generation

1import (2func main() {3 g1 = gauge.Gauge(4)4 g2 = gauge.Gauge(5)5 fmt.Println(g1.Less(g2))6}7import (8func TestLess(t *testing.T) {9 g1 = Gauge(4)10 g2 = Gauge(5)11 if !g1.Less(g2) {12 t.Error("Expected true, got false")13 }14}15import (16func main() {17 g1 = gauge.Gauge(4)18 g2 = gauge.Gauge(5)19 g1.Add(g2)20 fmt.Println(g1)21}22import (23func TestAdd(t *testing.T) {24 g1 = Gauge(4)25 g2 = Gauge(5)26 g1.Add(g2)27 if g1 != 9 {28 t.Error("Expected 9, got", g1)29 }30}31import (32func main() {33 g1 = gauge.Gauge(4)34 g1.Set(5)35 fmt.Println(g1)36}37import (38func TestSet(t *testing.T) {39 g1 = gauge.Gauge(4)40 g1.Set(5)

Less

Using AI Code Generation

1import (2func main() {3 g1 := gauge.NewGauge("g1", 10, 20)4 g2 := gauge.NewGauge("g2", 10, 20)5 if g1.Less(g2) == true {6 fmt.Println("g1 is less than g2")7 } else {8 fmt.Println("g1 is greater than g2")9 }10 g3 := gauge.NewGauge("g3", 10, 20)11 g4 := gauge.NewGauge("g4", 10, 20)12 err := g3.LessErr(g4)13 if err != nil {14 fmt.Println(err)15 os.Exit(0)16 }17 g5 := gauge.NewGauge("g5", 10, 20)18 g6 := gauge.NewGauge("g6", 10, 20)19 err = g5.LessTerr(g6)20 if err != nil {21 fmt.Println(err)22 os.Exit(0)23 }24 g7 := gauge.NewGauge("g7", 10, 20)25 g8 := gauge.NewGauge("g8", 10, 20)26 err = g7.LessTerrMsg(g8, "custom message")27 if err != nil {28 fmt.Println(err)29 os.Exit(0)30 }31 g9 := gauge.NewGauge("g9", 10, 20)32 g10 := gauge.NewGauge("g10", 10, 20)33 err = g9.LessTerrCodeMsg(g10, 100, "custom message")34 if err != nil {35 fmt.Println(err)36 os.Exit(0)37 }38 g11 := gauge.NewGauge("g11", 10, 20)39 g12 := gauge.NewGauge("g12", 10, 20)40 err = g11.LessTerrCodeDataMsg(g12, 100, "custom data", "custom message")41 if err != nil {42 fmt.Println(err)43 os.Exit(0)44 }

## Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.