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

Method WriteTempoProtoTraces

integration/util/harness_api_writes.go:111–133  ·  integration/util/harness_api_writes.go::TempoHarness.WriteTempoProtoTraces
(traces *tempopb.Trace, tenant string)

Source from the content-addressed store, hash-verified

109}
110
111func (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
135func newOtelGRPCExporterWithAuth(endpoint, orgID, basicAuthToken string, useTLS bool) (exporter.Traces, error) {
136 factory := otlpexporter.NewFactory()

Callers 2

TestLimitsPartialSuccessFunction · 0.80
TestWriteMetricsFunction · 0.80

Calls 5

recordWriteMethod · 0.95
MarshalMethod · 0.65
ShutdownMethod · 0.65
ConsumeTracesMethod · 0.45

Tested by 2

TestLimitsPartialSuccessFunction · 0.64
TestWriteMetricsFunction · 0.64