MCPcopy
hub / github.com/grafana/tempo / createValidPushRequestStartEnd

Function createValidPushRequestStartEnd

modules/livestore/live_store_test.go:1047–1079  ·  view source on GitHub ↗
(t *testing.T, start, end time.Time)

Source from the content-addressed store, hash-verified

1045}
1046
1047func createValidPushRequestStartEnd(t *testing.T, start, end time.Time) []byte {
1048 id := test.ValidTraceID(nil)
1049 tr := &tempopb.Trace{
1050 ResourceSpans: []*v1_trace.ResourceSpans{
1051 {
1052 Resource: &v1_resource.Resource{},
1053 ScopeSpans: []*v1_trace.ScopeSpans{
1054 {
1055 Spans: []*v1_trace.Span{
1056 {
1057 TraceId: id,
1058 StartTimeUnixNano: uint64(start.UnixNano()),
1059 EndTimeUnixNano: uint64(end.UnixNano()),
1060 },
1061 },
1062 },
1063 },
1064 },
1065 },
1066 }
1067 traceBytes, err := proto.Marshal(tr)
1068 require.NoError(t, err)
1069
1070 req := &tempopb.PushBytesRequest{
1071 Traces: []tempopb.PreallocBytes{{Slice: traceBytes}},
1072 Ids: [][]byte{id},
1073 }
1074
1075 records, err := ingest.Encode(0, testTenantID, req, 1_000_000)
1076 require.NoError(t, err)
1077
1078 return records[0].Value
1079}
1080
1081func pushToLiveStore(t *testing.T, liveStore *LiveStore) ([]byte, *tempopb.Trace) {
1082 // create trace

Calls 3

ValidTraceIDFunction · 0.92
EncodeFunction · 0.92
MarshalMethod · 0.65

Tested by

no test coverage detected