| 109 | } |
| 110 | |
| 111 | func (h *TempoHarness) WriteTempoProtoTraces(traces *tempopb.Trace, tenant string) error { |
| 112 | b, err := traces.Marshal() |
| 113 | if err != nil { |
| 114 | return err |
| 115 | } |
| 116 | |
| 117 | // unmarshal into otlp proto |
| 118 | otlpTraces, err := (&ptrace.ProtoUnmarshaler{}).UnmarshalTraces(b) |
| 119 | if err != nil { |
| 120 | return err |
| 121 | } |
| 122 | |
| 123 | endpoint := h.Services[ServiceDistributor].Endpoint(4317) |
| 124 | exporter, err := newOtelGRPCExporterWithAuth(endpoint, tenant, "", false) |
| 125 | if err != nil { |
| 126 | return err |
| 127 | } |
| 128 | if err := exporter.ConsumeTraces(context.Background(), otlpTraces); err != nil { |
| 129 | return err |
| 130 | } |
| 131 | h.recordWrite() |
| 132 | return exporter.Shutdown(context.Background()) |
| 133 | } |
| 134 | |
| 135 | func newOtelGRPCExporterWithAuth(endpoint, orgID, basicAuthToken string, useTLS bool) (exporter.Traces, error) { |
| 136 | factory := otlpexporter.NewFactory() |