TUN-6867: Clear spans right after they are serialized to avoid returning duplicate spans

This commit is contained in:
cthuang
2022-10-18 12:15:51 +01:00
committed by Chung-Ting
parent b1de2a74fa
commit c3c050aa79
3 changed files with 12 additions and 21 deletions

View File

@@ -157,7 +157,7 @@ func (cft *cfdTracer) GetSpans() (enc string) {
// GetProtoSpans returns the spans as the otlp traces in protobuf byte array.
func (cft *cfdTracer) GetProtoSpans() (proto []byte) {
proto, err := cft.exporter.ProtoSpans()
proto, err := cft.exporter.ExportProtoSpans()
switch err {
case nil:
break
@@ -189,10 +189,6 @@ func (cft *cfdTracer) AddSpans(headers http.Header) {
headers[CanonicalCloudflaredTracingHeader] = []string{enc}
}
func (cft *cfdTracer) ClearSpans() {
cft.exporter.ClearSpans()
}
// End will set the OK status for the span and then end it.
func End(span trace.Span) {
endSpan(span, -1, codes.Ok, nil)