Files
9ad1ad8543 Ingester/Generator Live trace cleanup (#4365)
* moved trace sizes somewhere shareable

Signed-off-by: Joe Elliott <[email protected]>

* use tracesizes in ingester

Signed-off-by: Joe Elliott <[email protected]>

* make tests work

Signed-off-by: Joe Elliott <[email protected]>

* trace bytes in generator

Signed-off-by: Joe Elliott <[email protected]>

* remove traceCount

Signed-off-by: Joe Elliott <[email protected]>

* live trace shenanigans

Signed-off-by: Joe Elliott <[email protected]>

* changelog

Signed-off-by: Joe Elliott <[email protected]>

* Update modules/generator/processor/localblocks/livetraces.go

Co-authored-by: Mario <[email protected]>

* Update modules/ingester/instance.go

Co-authored-by: Mario <[email protected]>

* Test cleanup. Add sz test, restore commented out and fix e2e

Signed-off-by: Joe Elliott <[email protected]>

* remove todo comment

Signed-off-by: Joe Elliott <[email protected]>

---------

Signed-off-by: Joe Elliott <[email protected]>
Co-authored-by: Mario <[email protected]>
2024-11-22 12:26:33 -05:00

45 lines
1.1 KiB
Go

package ingester
import (
"context"
"testing"
"github.com/grafana/tempo/pkg/model"
"github.com/grafana/tempo/pkg/tempopb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestTraceStartEndTime(t *testing.T) {
s := model.MustNewSegmentDecoder(model.CurrentEncoding)
tr := newTrace(nil)
// initial push
buff, err := s.PrepareForWrite(&tempopb.Trace{}, 10, 20)
require.NoError(t, err)
err = tr.Push(context.Background(), "test", buff)
require.NoError(t, err)
assert.Equal(t, uint32(10), tr.start)
assert.Equal(t, uint32(20), tr.end)
// overwrite start
buff, err = s.PrepareForWrite(&tempopb.Trace{}, 5, 15)
require.NoError(t, err)
err = tr.Push(context.Background(), "test", buff)
require.NoError(t, err)
assert.Equal(t, uint32(5), tr.start)
assert.Equal(t, uint32(20), tr.end)
// overwrite end
buff, err = s.PrepareForWrite(&tempopb.Trace{}, 15, 25)
require.NoError(t, err)
err = tr.Push(context.Background(), "test", buff)
require.NoError(t, err)
assert.Equal(t, uint32(5), tr.start)
assert.Equal(t, uint32(25), tr.end)
}