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

Method PushBytes

modules/livestore/live_store.go:811–837  ·  view source on GitHub ↗

PushBytes ingests pre-marshaled traces directly into the local live-store.

(ctx context.Context, req *tempopb.PushBytesRequest)

Source from the content-addressed store, hash-verified

809
810// PushBytes ingests pre-marshaled traces directly into the local live-store.
811func (s *LiveStore) PushBytes(ctx context.Context, req *tempopb.PushBytesRequest) (*tempopb.PushResponse, error) {
812 if err := s.CheckReady(ctx); err != nil {
813 return nil, err
814 }
815 if req == nil {
816 return nil, errors.New("nil push bytes request")
817 }
818 if len(req.Traces) != len(req.Ids) {
819 return nil, fmt.Errorf("mismatched traces and ids length: traces=%d ids=%d", len(req.Traces), len(req.Ids))
820 }
821 if len(req.Traces) == 0 {
822 return &tempopb.PushResponse{}, nil
823 }
824
825 tenantID, err := validation.ExtractValidTenantID(ctx)
826 if err != nil {
827 return nil, err
828 }
829
830 inst, err := s.getOrCreateInstance(tenantID)
831 if err != nil {
832 return nil, err
833 }
834
835 inst.pushBytes(ctx, time.Now(), req)
836 return &tempopb.PushResponse{}, nil
837}
838
839// FindTraceByID implements tempopb.Querier
840func (s *LiveStore) FindTraceByID(ctx context.Context, req *tempopb.TraceByIDRequest) (*tempopb.TraceByIDResponse, error) {

Callers

nothing calls this directly

Calls 5

CheckReadyMethod · 0.95
getOrCreateInstanceMethod · 0.95
ExtractValidTenantIDFunction · 0.92
pushBytesMethod · 0.65
NowMethod · 0.65

Tested by

no test coverage detected