Revert "Fix: Change TTFB metric type to histogram (#20999)"

This reverts commit 8d223e07fb7f8593ae56dfd2f4a0688fe1ee8a17.
This commit is contained in:
Harshavardhana 2025-04-23 13:56:18 -07:00
parent 2d8ba15b9e
commit 2780778c10
2 changed files with 5 additions and 33 deletions

View File

@ -319,7 +319,6 @@ type MetricDescription struct {
Name MetricName `json:"MetricName"` Name MetricName `json:"MetricName"`
Help string `json:"Help"` Help string `json:"Help"`
Type MetricTypeV2 `json:"Type"` Type MetricTypeV2 `json:"Type"`
Buckets []float64 `json:"Buckets,omitempty"`
} }
// MetricV2 captures the details for a metric // MetricV2 captures the details for a metric
@ -1544,8 +1543,7 @@ func getS3TTFBDistributionMD() MetricDescription {
Subsystem: ttfbSubsystem, Subsystem: ttfbSubsystem,
Name: ttfbDistribution, Name: ttfbDistribution,
Help: "Distribution of time to first byte across API calls", Help: "Distribution of time to first byte across API calls",
Type: histogramMetric, Type: gaugeMetric,
Buckets: []float64{0.01, 0.05, 0.1, 0.5, 1.0, 2.0, 5.0},
} }
} }
@ -1555,8 +1553,7 @@ func getBucketTTFBDistributionMD() MetricDescription {
Subsystem: ttfbSubsystem, Subsystem: ttfbSubsystem,
Name: ttfbDistribution, Name: ttfbDistribution,
Help: "Distribution of time to first byte across API calls per bucket", Help: "Distribution of time to first byte across API calls per bucket",
Type: histogramMetric, Type: gaugeMetric,
Buckets: []float64{0.01, 0.05, 0.1, 0.5, 1.0, 2.0, 5.0},
} }
} }

View File

@ -9,9 +9,9 @@ import (
// MarshalMsg implements msgp.Marshaler // MarshalMsg implements msgp.Marshaler
func (z *MetricDescription) MarshalMsg(b []byte) (o []byte, err error) { func (z *MetricDescription) MarshalMsg(b []byte) (o []byte, err error) {
o = msgp.Require(b, z.Msgsize()) o = msgp.Require(b, z.Msgsize())
// map header, size 6 // map header, size 5
// string "Namespace" // string "Namespace"
o = append(o, 0x86, 0xa9, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65) o = append(o, 0x85, 0xa9, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65)
o = msgp.AppendString(o, string(z.Namespace)) o = msgp.AppendString(o, string(z.Namespace))
// string "Subsystem" // string "Subsystem"
o = append(o, 0xa9, 0x53, 0x75, 0x62, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d) o = append(o, 0xa9, 0x53, 0x75, 0x62, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d)
@ -25,12 +25,6 @@ func (z *MetricDescription) MarshalMsg(b []byte) (o []byte, err error) {
// string "Type" // string "Type"
o = append(o, 0xa4, 0x54, 0x79, 0x70, 0x65) o = append(o, 0xa4, 0x54, 0x79, 0x70, 0x65)
o = msgp.AppendString(o, string(z.Type)) o = msgp.AppendString(o, string(z.Type))
// string "Buckets"
o = append(o, 0xa7, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x73)
o = msgp.AppendArrayHeader(o, uint32(len(z.Buckets)))
for za0001 := range z.Buckets {
o = msgp.AppendFloat64(o, z.Buckets[za0001])
}
return return
} }
@ -98,25 +92,6 @@ func (z *MetricDescription) UnmarshalMsg(bts []byte) (o []byte, err error) {
} }
z.Type = MetricTypeV2(zb0005) z.Type = MetricTypeV2(zb0005)
} }
case "Buckets":
var zb0006 uint32
zb0006, bts, err = msgp.ReadArrayHeaderBytes(bts)
if err != nil {
err = msgp.WrapError(err, "Buckets")
return
}
if cap(z.Buckets) >= int(zb0006) {
z.Buckets = (z.Buckets)[:zb0006]
} else {
z.Buckets = make([]float64, zb0006)
}
for za0001 := range z.Buckets {
z.Buckets[za0001], bts, err = msgp.ReadFloat64Bytes(bts)
if err != nil {
err = msgp.WrapError(err, "Buckets", za0001)
return
}
}
default: default:
bts, err = msgp.Skip(bts) bts, err = msgp.Skip(bts)
if err != nil { if err != nil {
@ -131,7 +106,7 @@ func (z *MetricDescription) UnmarshalMsg(bts []byte) (o []byte, err error) {
// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (z *MetricDescription) Msgsize() (s int) { func (z *MetricDescription) Msgsize() (s int) {
s = 1 + 10 + msgp.StringPrefixSize + len(string(z.Namespace)) + 10 + msgp.StringPrefixSize + len(string(z.Subsystem)) + 5 + msgp.StringPrefixSize + len(string(z.Name)) + 5 + msgp.StringPrefixSize + len(z.Help) + 5 + msgp.StringPrefixSize + len(string(z.Type)) + 8 + msgp.ArrayHeaderSize + (len(z.Buckets) * (msgp.Float64Size)) s = 1 + 10 + msgp.StringPrefixSize + len(string(z.Namespace)) + 10 + msgp.StringPrefixSize + len(string(z.Subsystem)) + 5 + msgp.StringPrefixSize + len(string(z.Name)) + 5 + msgp.StringPrefixSize + len(z.Help) + 5 + msgp.StringPrefixSize + len(string(z.Type))
return return
} }