(traceID []byte, tr []byte, ts time.Time)
| 79 | } |
| 80 | |
| 81 | func (s *tenantStore) AppendTrace(traceID []byte, tr []byte, ts time.Time) error { |
| 82 | maxSz := s.overrides.MaxBytesPerTrace(s.tenantID) |
| 83 | |
| 84 | if err := s.liveTraces.PushWithTimestampAndLimits(ts, traceID, tr, 0, uint64(maxSz)); err != nil { |
| 85 | // Record dropped spans due to trace too large |
| 86 | // We have to unmarhal to count the number of spans. |
| 87 | // TODO - There might be a better way |
| 88 | t := &tempopb.Trace{} |
| 89 | if err := t.Unmarshal(tr); err != nil { |
| 90 | return err |
| 91 | } |
| 92 | count := 0 |
| 93 | for _, b := range t.ResourceSpans { |
| 94 | for _, ss := range b.ScopeSpans { |
| 95 | count += len(ss.Spans) |
| 96 | } |
| 97 | } |
| 98 | overrides.RecordDiscardedSpans(count, overrides.ReasonTraceTooLarge, s.tenantID) |
| 99 | } |
| 100 | |
| 101 | return nil |
| 102 | } |
| 103 | |
| 104 | func (s *tenantStore) Flush(ctx context.Context, r tempodb.Reader, w tempodb.Writer, c tempodb.Compactor) error { |
| 105 | ctx, span := tracer.Start(ctx, "tenantStore.Flush", trace.WithAttributes(attribute.String("tenant", s.tenantID))) |
nothing calls this directly
no test coverage detected