diff --git a/src/metrics/aggregation/id_compress_test.go b/src/metrics/aggregation/id_compress_test.go index 466e0dd76b..426148d58e 100644 --- a/src/metrics/aggregation/id_compress_test.go +++ b/src/metrics/aggregation/id_compress_test.go @@ -66,7 +66,8 @@ func TestIDDecompressError(t *testing.T) { _, err := decompressor.Decompress([IDLen]uint64{1}) require.Error(t, err) - max, err := compressor.Compress([]Type{Last, Min, Max, Mean, Median, Count, Sum, SumSq, Stdev, P95, P99, P999, P9999}) + max, err := compressor.Compress( + []Type{Last, Min, Max, Mean, Median, Count, Sum, SumSq, Stdev, P95, P99, P999, P9999, P25, P75}) require.NoError(t, err) max[0] = max[0] << 1 diff --git a/src/metrics/aggregation/type.go b/src/metrics/aggregation/type.go index 0dad1bfe33..0850e65cf4 100644 --- a/src/metrics/aggregation/type.go +++ b/src/metrics/aggregation/type.go @@ -53,6 +53,8 @@ const ( P99 P999 P9999 + P25 + P75 nextTypeID = iota ) @@ -87,11 +89,13 @@ var ( Stdev: emptyStruct, P10: emptyStruct, P20: emptyStruct, + P25: emptyStruct, P30: emptyStruct, P40: emptyStruct, P50: emptyStruct, P60: emptyStruct, P70: emptyStruct, + P75: emptyStruct, P80: emptyStruct, P90: emptyStruct, P95: emptyStruct, @@ -114,11 +118,13 @@ var ( Stdev: []byte("stdev"), P10: []byte("p10"), P20: []byte("p20"), + P25: []byte("p25"), P30: []byte("p30"), P40: []byte("p40"), P50: []byte("p50"), P60: []byte("p60"), P70: []byte("p70"), + P75: []byte("p75"), P80: []byte("p80"), P90: []byte("p90"), P95: []byte("p95"), @@ -130,11 +136,13 @@ var ( typeQuantileBytes = map[Type][]byte{ P10: []byte("0.1"), P20: []byte("0.2"), + P25: []byte("0.25"), P30: []byte("0.3"), P40: []byte("0.4"), P50: []byte("0.5"), P60: []byte("0.6"), P70: []byte("0.7"), + P75: []byte("0.75"), P80: []byte("0.8"), P90: []byte("0.9"), P95: []byte("0.95"), @@ -204,6 +212,8 @@ func (a Type) Quantile() (float64, bool) { return 0.1, true case P20: return 0.2, true + case P25: + return 0.25, true case P30: return 0.3, true case P40: @@ -214,6 +224,8 @@ func (a Type) Quantile() (float64, bool) { return 0.6, true case P70: return 0.7, true + case P75: + return 0.75, true case P80: return 0.8, true case P90: diff --git a/src/metrics/aggregation/type_string.go b/src/metrics/aggregation/type_string.go index d62ed64c18..4ee7ce7b80 100644 --- a/src/metrics/aggregation/type_string.go +++ b/src/metrics/aggregation/type_string.go @@ -24,11 +24,11 @@ package aggregation import "fmt" -const _Type_name = "UnknownTypeLastMinMaxMeanMedianCountSumSumSqStdevP10P20P30P40P50P60P70P80P90P95P99P999P9999" +const _Type_name = "UnknownTypeLastMinMaxMeanMedianCountSumSumSqStdevP10P20P30P40P50P60P70P80P90P95P99P999P9999P25P75" -var _Type_name_bytes = []byte("UnknownTypeLastMinMaxMeanMedianCountSumSumSqStdevP10P20P30P40P50P60P70P80P90P95P99P999P9999") +var _Type_name_bytes = []byte("UnknownTypeLastMinMaxMeanMedianCountSumSumSqStdevP10P20P30P40P50P60P70P80P90P95P99P999P9999P25P75") -var _Type_index = [...]uint8{0, 11, 15, 18, 21, 25, 31, 36, 39, 44, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 86, 91} +var _Type_index = [...]uint8{0, 11, 15, 18, 21, 25, 31, 36, 39, 44, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 86, 91, 94, 97} func (i Type) String() string { if i < 0 || i >= Type(len(_Type_index)-1) { diff --git a/src/metrics/aggregation/type_test.go b/src/metrics/aggregation/type_test.go index 4a6301bc21..29d9fc3d55 100644 --- a/src/metrics/aggregation/type_test.go +++ b/src/metrics/aggregation/type_test.go @@ -33,13 +33,13 @@ import ( ) func TestTypeIsValid(t *testing.T) { - require.True(t, P9999.IsValid()) - require.False(t, Type(int(P9999)+1).IsValid()) + require.True(t, P75.IsValid()) + require.False(t, Type(int(P75)+1).IsValid()) } func TestTypeMaxID(t *testing.T) { - require.Equal(t, maxTypeID, P9999.ID()) - require.Equal(t, P9999, Type(maxTypeID)) + require.Equal(t, maxTypeID, P75.ID()) + require.Equal(t, P75, Type(maxTypeID)) require.Equal(t, maxTypeID, len(ValidTypes)) } @@ -303,8 +303,12 @@ func TestQuantiles(t *testing.T) { require.Nil(t, res3) require.False(t, ok) - res4, ok := Types{P10, P20, P30, P40, P50, Median, P60, P70, P80, P90, P95, P99, P999, P9999}.PooledQuantiles(p) - require.Equal(t, []float64{0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 0.999, 0.9999}, res4) + res4, ok := Types{P10, P20, P25, P30, P40, P50, Median, P60, P70, P75, P80, P90, P95, P99, P999, P9999}. + PooledQuantiles(p) + require.Equal( + t, + []float64{0.1, 0.2, 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.75, 0.8, 0.9, 0.95, 0.99, 0.999, 0.9999}, + res4) require.True(t, ok) } diff --git a/src/metrics/generated/proto/aggregationpb/aggregation.pb.go b/src/metrics/generated/proto/aggregationpb/aggregation.pb.go index 300cd31d18..4cd53dd643 100644 --- a/src/metrics/generated/proto/aggregationpb/aggregation.pb.go +++ b/src/metrics/generated/proto/aggregationpb/aggregation.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: github.com/m3db/m3/src/metrics/generated/proto/aggregationpb/aggregation.proto -// Copyright (c) 2020 Uber Technologies, Inc. +// Copyright (c) 2021 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -75,6 +75,8 @@ const ( AggregationType_P99 AggregationType = 20 AggregationType_P999 AggregationType = 21 AggregationType_P9999 AggregationType = 22 + AggregationType_P25 AggregationType = 23 + AggregationType_P75 AggregationType = 24 ) var AggregationType_name = map[int32]string{ @@ -101,6 +103,8 @@ var AggregationType_name = map[int32]string{ 20: "P99", 21: "P999", 22: "P9999", + 23: "P25", + 24: "P75", } var AggregationType_value = map[string]int32{ "UNKNOWN": 0, @@ -126,6 +130,8 @@ var AggregationType_value = map[string]int32{ "P99": 20, "P999": 21, "P9999": 22, + "P25": 23, + "P75": 24, } func (x AggregationType) String() string { @@ -388,25 +394,26 @@ func init() { } var fileDescriptorAggregation = []byte{ - // 320 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0xd1, 0x3d, 0x4e, 0xc3, 0x30, - 0x1c, 0x05, 0xf0, 0xba, 0xdf, 0x75, 0x69, 0xfb, 0xc7, 0x7c, 0x88, 0x29, 0x20, 0x26, 0xc4, 0x50, - 0x1b, 0x42, 0x81, 0x48, 0x2c, 0x81, 0x76, 0xa8, 0x20, 0x6e, 0x21, 0x09, 0x20, 0xb6, 0xa6, 0x89, - 0x42, 0x86, 0x34, 0x55, 0x1a, 0x06, 0x6e, 0xc1, 0xb1, 0x18, 0x39, 0x02, 0x0a, 0x37, 0xe0, 0x04, - 0xc8, 0xff, 0x0e, 0x94, 0x99, 0xed, 0xe7, 0xf7, 0x9e, 0x64, 0x4b, 0xa6, 0x32, 0x8c, 0xb2, 0xe7, - 0x17, 0xaf, 0x3b, 0x4d, 0x62, 0x1e, 0xeb, 0xbe, 0xc7, 0x63, 0x9d, 0x2f, 0xd2, 0x29, 0x8f, 0x83, - 0x2c, 0x8d, 0xa6, 0x0b, 0x1e, 0x06, 0xb3, 0x20, 0x9d, 0x64, 0x81, 0xcf, 0xe7, 0x69, 0x92, 0x25, - 0x7c, 0x12, 0x86, 0x69, 0x10, 0x4e, 0xb2, 0x28, 0x99, 0xcd, 0xbd, 0xd5, 0x53, 0x17, 0x7b, 0xd6, - 0xfa, 0x33, 0xd8, 0xdf, 0xa5, 0x2d, 0xf3, 0x37, 0x18, 0xf6, 0x59, 0x9b, 0x16, 0x23, 0x7f, 0x87, - 0xec, 0x91, 0x83, 0xf2, 0x5d, 0x31, 0xf2, 0x0f, 0xbf, 0x09, 0xed, 0xac, 0x2c, 0x9c, 0xd7, 0x79, - 0xc0, 0x9a, 0xb4, 0xe6, 0xca, 0x6b, 0x39, 0x7a, 0x90, 0x50, 0x60, 0x75, 0x5a, 0xbe, 0x31, 0x6d, - 0x07, 0x08, 0xab, 0xd1, 0x92, 0x35, 0x94, 0x50, 0x44, 0x98, 0x8f, 0x50, 0x52, 0x9d, 0x35, 0x30, - 0x25, 0x94, 0x19, 0xa5, 0x55, 0x6b, 0xd0, 0x1f, 0x9a, 0x12, 0x2a, 0xac, 0x41, 0x2b, 0x57, 0x23, - 0x57, 0x3a, 0x50, 0x55, 0x4b, 0xdb, 0xb5, 0xa0, 0xa6, 0x32, 0xdb, 0xb5, 0xec, 0x5b, 0xa8, 0x23, - 0x9d, 0xfe, 0xe0, 0x1e, 0x1a, 0xaa, 0x1e, 0x1f, 0x09, 0xa0, 0x88, 0x63, 0x01, 0x4d, 0x84, 0x2e, - 0x60, 0x0d, 0x71, 0x22, 0xa0, 0x85, 0xe8, 0x09, 0x68, 0x23, 0x4e, 0x05, 0x74, 0x10, 0x67, 0x02, - 0x00, 0x71, 0x2e, 0x60, 0x1d, 0x61, 0x08, 0x60, 0x4b, 0xf4, 0x60, 0x63, 0x09, 0x03, 0x36, 0xd5, - 0x13, 0xc7, 0x86, 0x61, 0xc0, 0x96, 0xba, 0x57, 0xc9, 0x80, 0xed, 0x4b, 0xf9, 0x9e, 0x6b, 0xe4, - 0x23, 0xd7, 0xc8, 0x67, 0xae, 0x91, 0xb7, 0x2f, 0xad, 0xf0, 0x74, 0xf1, 0x9f, 0x6f, 0xf0, 0xaa, - 0x18, 0xea, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x82, 0xc4, 0x3c, 0xea, 0xcd, 0x01, 0x00, 0x00, + // 328 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0xd1, 0xbb, 0x4e, 0xc3, 0x30, + 0x14, 0x06, 0xe0, 0x26, 0xbd, 0xbb, 0xb4, 0x3d, 0x98, 0x5b, 0xa7, 0x80, 0x98, 0x10, 0x43, 0x6d, + 0x08, 0x01, 0x22, 0xb1, 0x04, 0xda, 0xa1, 0x82, 0xb8, 0x85, 0x24, 0x80, 0xd8, 0x9a, 0xc6, 0x0a, + 0x19, 0xd2, 0x54, 0x69, 0x18, 0xd8, 0x79, 0x00, 0x1e, 0x8b, 0x91, 0x47, 0x40, 0xe1, 0x45, 0x90, + 0x9d, 0x81, 0x32, 0xb3, 0x7d, 0x3e, 0xff, 0x2f, 0x1f, 0x4b, 0x46, 0x2c, 0x8c, 0xb2, 0xe7, 0x17, + 0xbf, 0x3f, 0x4b, 0x62, 0x12, 0xeb, 0x81, 0x4f, 0x62, 0x9d, 0x2c, 0xd3, 0x19, 0x89, 0x79, 0x96, + 0x46, 0xb3, 0x25, 0x09, 0xf9, 0x9c, 0xa7, 0xd3, 0x8c, 0x07, 0x64, 0x91, 0x26, 0x59, 0x42, 0xa6, + 0x61, 0x98, 0xf2, 0x70, 0x9a, 0x45, 0xc9, 0x7c, 0xe1, 0xaf, 0x9e, 0xfa, 0x32, 0xc7, 0xed, 0x3f, + 0x85, 0xfd, 0x5d, 0xd4, 0xb6, 0x7e, 0x07, 0xa3, 0x01, 0xee, 0x20, 0x35, 0x0a, 0x7a, 0xca, 0x9e, + 0x72, 0x50, 0xb9, 0x53, 0xa3, 0xe0, 0xf0, 0x4d, 0x45, 0xdd, 0x95, 0x86, 0xfb, 0xba, 0xe0, 0xb8, + 0x85, 0xea, 0x1e, 0xbb, 0x66, 0xe3, 0x07, 0x06, 0x25, 0xdc, 0x40, 0x95, 0x1b, 0xcb, 0x71, 0x41, + 0xc1, 0x75, 0x54, 0xb6, 0x47, 0x0c, 0x54, 0x09, 0xeb, 0x11, 0xca, 0x22, 0xb3, 0x87, 0x16, 0x83, + 0x0a, 0x46, 0xa8, 0x66, 0x0f, 0x07, 0x23, 0x8b, 0x41, 0x15, 0x37, 0x51, 0xf5, 0x6a, 0xec, 0x31, + 0x17, 0x6a, 0xa2, 0xe9, 0x78, 0x36, 0xd4, 0xc5, 0xcc, 0xf1, 0x6c, 0xe7, 0x16, 0x1a, 0x92, 0xee, + 0x60, 0x78, 0x0f, 0x4d, 0x11, 0x4f, 0x8e, 0x28, 0x20, 0x89, 0x63, 0x0a, 0x2d, 0x09, 0x9d, 0xc2, + 0x9a, 0xc4, 0x09, 0x85, 0xb6, 0x84, 0x41, 0xa1, 0x23, 0x71, 0x4a, 0xa1, 0x2b, 0x71, 0x46, 0x01, + 0x24, 0xce, 0x29, 0xac, 0x4b, 0x98, 0x14, 0x70, 0x01, 0x03, 0x36, 0x0a, 0x98, 0xb0, 0x29, 0x9e, + 0x38, 0x31, 0x4d, 0x13, 0xb6, 0xc4, 0x5e, 0x21, 0x13, 0xb6, 0x8b, 0x75, 0x06, 0xec, 0x14, 0x57, + 0x19, 0xd0, 0xbb, 0x64, 0x1f, 0xb9, 0xa6, 0x7c, 0xe6, 0x9a, 0xf2, 0x95, 0x6b, 0xca, 0xfb, 0xb7, + 0x56, 0x7a, 0xba, 0xf8, 0xcf, 0xc7, 0xf8, 0x35, 0x39, 0xd4, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, + 0xe6, 0x7e, 0xf0, 0xe7, 0xdf, 0x01, 0x00, 0x00, } diff --git a/src/metrics/generated/proto/aggregationpb/aggregation.proto b/src/metrics/generated/proto/aggregationpb/aggregation.proto index 66b7eb8c6d..bf847dc594 100644 --- a/src/metrics/generated/proto/aggregationpb/aggregation.proto +++ b/src/metrics/generated/proto/aggregationpb/aggregation.proto @@ -48,6 +48,8 @@ enum AggregationType { P99 = 20; P999 = 21; P9999 = 22; + P25 = 23; + P75 = 24; } // AggregationID is a unique identifier uniquely identifying