Skip to content

Commit

Permalink
Fix go linter errors (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajkiranrbala authored Mar 30, 2022
1 parent 3bc7180 commit b8f30e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func FormatBucketOptions(bounds []float64) *metricspb.DistributionValue_BucketOp
// MakeBuckets generates a proto representation of a distribution containing a single value.
// bounds defines the bucket boundaries of the distribution.
func MakeBuckets(values, bounds []float64) []*metricspb.DistributionValue_Bucket {
buckets := make([]*metricspb.DistributionValue_Bucket, len(bounds)+1, len(bounds)+1)
buckets := make([]*metricspb.DistributionValue_Bucket, len(bounds)+1)
for i := 0; i <= len(bounds); i++ {
buckets[i] = &metricspb.DistributionValue_Bucket{}
}
Expand All @@ -88,7 +88,7 @@ func getBucketIndex(val float64, bounds []float64) int {
}

func formatBuckets(distribution []int64) []*metricspb.DistributionValue_Bucket {
buckets := make([]*metricspb.DistributionValue_Bucket, len(distribution), len(distribution))
buckets := make([]*metricspb.DistributionValue_Bucket, len(distribution))
for i := 0; i < len(distribution); i++ {
buckets[i] = &metricspb.DistributionValue_Bucket{
Count: distribution[i],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ func TestParseInputTimesError(t *testing.T) {
assert.Equal(t, tc.buildDateError, collector.buildDateError)
assert.Equal(t, tc.vmStartTimeError, collector.vmStartTimeError)
assert.Equal(t, tc.vmReadyTime, collector.vmReadyTime)
assert.Equal(t, tc.vmReadyTimeError, collector.vmReadyTimeError)
assert.Equal(t, tc.vmStartTimeError, collector.vmStartTimeError)
}
}

Expand Down Expand Up @@ -147,15 +149,15 @@ func TestScrapeAndExportVMImageAge(t *testing.T) {
assertMetricGreaterThan0Double(t, expectedDesc, c.storage.metrics)
}

func scrapeAndExportVMReadyTime(t *testing.T) {
func TestScrapeAndExportVMReadyTime(t *testing.T) {
consumer := fakeConsumer{storage: &metricsStore{}}
collector := NewVMAgeCollector(0, testVMImageBuildDate, testVMImageName, testVMStartTime, testVMReadyTime, consumer, zap.NewNop())
collector.setupCollection()

expectedDesc := &metricspb.MetricDescriptor{
Name: "vm_image_age",
Description: "The VM image age for the VM instance",
Unit: "Days",
Name: "vm_ready_time",
Description: "The amount of time from when Flex first started setting up the VM in the startup script to when it finished setting up all VM runtime components.",
Unit: "Seconds",
Type: metricspb.MetricDescriptor_GAUGE_DOUBLE,
LabelKeys: []*metricspb.LabelKey{{
Key: "vm_image_name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,4 @@ var vmReadyTimeMetric = &metricspb.MetricDescriptor{
Unit: "Seconds",
Type: metricspb.MetricDescriptor_GAUGE_DOUBLE,
LabelKeys: []*metricspb.LabelKey{vmImageNameLabel},
}

var (
numBounds = float64(8)
boundsBase = float64(2)
)
}

0 comments on commit b8f30e7

Please sign in to comment.