mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
5942d38742
commit
001f8969f8
4 changed files with 7 additions and 7 deletions
|
@ -1226,7 +1226,7 @@ func (br *blockResult) getBucketedValue(s string, bf *byStatsField) string {
|
|||
|
||||
buf := br.a.b
|
||||
bufLen := len(buf)
|
||||
buf = marshalDuration(buf, nsecs)
|
||||
buf = marshalDurationString(buf, nsecs)
|
||||
br.a.b = buf
|
||||
return bytesutil.ToUnsafeString(buf[bufLen:])
|
||||
}
|
||||
|
|
|
@ -243,8 +243,8 @@ func (q *Query) String() string {
|
|||
func (q *Query) AddCountByTimePipe(step, off int64, fields []string) {
|
||||
{
|
||||
// add 'stats by (_time:step offset off, fields) count() hits'
|
||||
stepStr := string(marshalDuration(nil, step))
|
||||
offsetStr := string(marshalDuration(nil, off))
|
||||
stepStr := string(marshalDurationString(nil, step))
|
||||
offsetStr := string(marshalDurationString(nil, off))
|
||||
byFieldsStr := "_time:" + stepStr + " offset " + offsetStr
|
||||
for _, f := range fields {
|
||||
byFieldsStr += ", " + quoteTokenIfNeeded(f)
|
||||
|
|
|
@ -860,8 +860,8 @@ func tryParseDuration(s string) (int64, bool) {
|
|||
return nsecs, true
|
||||
}
|
||||
|
||||
// marshalDuration appends string representation of nsec duration to dst and returns the result.
|
||||
func marshalDuration(dst []byte, nsecs int64) []byte {
|
||||
// marshalDurationString appends string representation of nsec duration to dst and returns the result.
|
||||
func marshalDurationString(dst []byte, nsecs int64) []byte {
|
||||
if nsecs == 0 {
|
||||
return append(dst, '0')
|
||||
}
|
||||
|
|
|
@ -378,11 +378,11 @@ func TestTryParseDuration_Failure(t *testing.T) {
|
|||
f("2s 3ms")
|
||||
}
|
||||
|
||||
func TestMarshalDuration(t *testing.T) {
|
||||
func TestMarshalDurationString(t *testing.T) {
|
||||
f := func(nsecs int64, resultExpected string) {
|
||||
t.Helper()
|
||||
|
||||
result := marshalDuration(nil, nsecs)
|
||||
result := marshalDurationString(nil, nsecs)
|
||||
if string(result) != resultExpected {
|
||||
t.Fatalf("unexpected result; got %q; want %q", result, resultExpected)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue