Debian Codegraph @

pdata/xpdata/pref/traces.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 package pref // import "go.opentelemetry.io/collector/pdata/xpdata/pref"
5
6 import (
7 "reflect"
8
9 "go.opentelemetry.io/collector/pdata/internal"
10 "go.opentelemetry.io/collector/pdata/ptrace"
11 )
12
13 // MarkPipelineOwnedTraces marks the ptrace.Traces data as owned by the pipeline, returns true if the data were
14 // previously not owned by the pipeline, otherwise false.
15 func MarkPipelineOwnedTraces(td ptrace.Traces) bool {
16 return internal.GetTracesState(internal.TracesWrapper(td)).MarkPipelineOwned()
17 }
18
19 func RefTraces(td ptrace.Traces) {
20 internal.GetTracesState(internal.TracesWrapper(td)).Ref()
21 }
22
23 func UnrefTraces(td ptrace.Traces) {
24 if EnableRefCounting.IsEnabled() {
25 if !internal.GetTracesState(internal.TracesWrapper(td)).Unref() {
26 return
27 }
28 // Don't call DeleteExportLogsServiceRequest without the gate because we reset the data and that may still cause issues.
29 if internal.UseProtoPooling.IsEnabled() {
30 internal.DeleteExportTraceServiceRequest(internal.GetTracesOrig(internal.TracesWrapper(td)), true)
31 }
32 }
33 }
34
35 // TODO: Generate this in pdata.
36
37 func EqualTraces(td1, td2 ptrace.Traces) bool {
38 return reflect.DeepEqual(internal.GetTracesOrig(internal.TracesWrapper(td1)), internal.GetTracesOrig(internal.TracesWrapper(td2)))
39 }