MCPcopy Create free account
hub / github.com/cortexproject/cortex / Size

Method Size

pkg/cortexpb/cortex.pb.go:3857–3920  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3855}
3856
3857func (m *Histogram) Size() (n int) {
3858 if m == nil {
3859 return 0
3860 }
3861 var l int
3862 _ = l
3863 if m.Count != nil {
3864 n += m.Count.Size()
3865 }
3866 if m.Sum != 0 {
3867 n += 9
3868 }
3869 if m.Schema != 0 {
3870 n += 1 + sozCortex(uint64(m.Schema))
3871 }
3872 if m.ZeroThreshold != 0 {
3873 n += 9
3874 }
3875 if m.ZeroCount != nil {
3876 n += m.ZeroCount.Size()
3877 }
3878 if len(m.NegativeSpans) > 0 {
3879 for _, e := range m.NegativeSpans {
3880 l = e.Size()
3881 n += 1 + l + sovCortex(uint64(l))
3882 }
3883 }
3884 if len(m.NegativeDeltas) > 0 {
3885 l = 0
3886 for _, e := range m.NegativeDeltas {
3887 l += sozCortex(uint64(e))
3888 }
3889 n += 1 + sovCortex(uint64(l)) + l
3890 }
3891 if len(m.NegativeCounts) > 0 {
3892 n += 1 + sovCortex(uint64(len(m.NegativeCounts)*8)) + len(m.NegativeCounts)*8
3893 }
3894 if len(m.PositiveSpans) > 0 {
3895 for _, e := range m.PositiveSpans {
3896 l = e.Size()
3897 n += 1 + l + sovCortex(uint64(l))
3898 }
3899 }
3900 if len(m.PositiveDeltas) > 0 {
3901 l = 0
3902 for _, e := range m.PositiveDeltas {
3903 l += sozCortex(uint64(e))
3904 }
3905 n += 1 + sovCortex(uint64(l)) + l
3906 }
3907 if len(m.PositiveCounts) > 0 {
3908 n += 1 + sovCortex(uint64(len(m.PositiveCounts)*8)) + len(m.PositiveCounts)*8
3909 }
3910 if m.ResetHint != 0 {
3911 n += 1 + sovCortex(uint64(m.ResetHint))
3912 }
3913 if m.TimestampMs != 0 {
3914 n += 1 + sovCortex(uint64(m.TimestampMs))

Callers 3

XXX_SizeMethod · 0.95
MarshalMethod · 0.95
MarshalToMethod · 0.95

Calls 3

sozCortexFunction · 0.85
sovCortexFunction · 0.85
SizeMethod · 0.65

Tested by

no test coverage detected