mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description <!-- Issue number if applicable --> #### Link to tracking issue Fixes # <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.--> Signed-off-by: Bogdan Drutu <[email protected]> Co-authored-by: Alex Boten <[email protected]>
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package pref // import "go.opentelemetry.io/collector/pdata/xpdata/pref"
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"go.opentelemetry.io/collector/pdata/internal"
|
|
pmetadata "go.opentelemetry.io/collector/pdata/internal/metadata"
|
|
"go.opentelemetry.io/collector/pdata/ptrace"
|
|
)
|
|
|
|
// MarkPipelineOwnedTraces marks the ptrace.Traces data as owned by the pipeline, returns true if the data were
|
|
// previously not owned by the pipeline, otherwise false.
|
|
func MarkPipelineOwnedTraces(td ptrace.Traces) bool {
|
|
return internal.GetTracesState(internal.TracesWrapper(td)).MarkPipelineOwned()
|
|
}
|
|
|
|
func RefTraces(td ptrace.Traces) {
|
|
internal.GetTracesState(internal.TracesWrapper(td)).Ref()
|
|
}
|
|
|
|
func UnrefTraces(td ptrace.Traces) {
|
|
if !internal.GetTracesState(internal.TracesWrapper(td)).Unref() {
|
|
return
|
|
}
|
|
// Don't call DeleteExportLogsServiceRequest without the gate because we reset the data and that may still cause issues.
|
|
if pmetadata.PdataUseProtoPoolingFeatureGate.IsEnabled() {
|
|
internal.DeleteExportTraceServiceRequest(internal.GetTracesOrig(internal.TracesWrapper(td)), true)
|
|
}
|
|
}
|
|
|
|
// TODO: Generate this in pdata.
|
|
|
|
func EqualTraces(td1, td2 ptrace.Traces) bool {
|
|
return reflect.DeepEqual(internal.GetTracesOrig(internal.TracesWrapper(td1)), internal.GetTracesOrig(internal.TracesWrapper(td2)))
|
|
}
|