Debian Codegraph @

pdata/ptrace/generated_spanlink.go

raw
1 // Copyright The OpenTelemetry Authors
2 // SPDX-License-Identifier: Apache-2.0
3
4 // Code generated by "internal/cmd/pdatagen/main.go". DO NOT EDIT.
5 // To regenerate this file run "make genpdata".
6
7 package ptrace
8
9 import (
10 "go.opentelemetry.io/collector/pdata/internal"
11 "go.opentelemetry.io/collector/pdata/pcommon"
12 )
13
14 // SpanLink is a pointer from the current span to another span in the same trace or in a
15 // different trace.
16 // See Link definition in OTLP: https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/trace/v1/trace.proto
17 //
18 // This is a reference type, if passed by value and callee modifies it the
19 // caller will see the modification.
20 //
21 // Must use NewSpanLink function to create new instances.
22 // Important: zero-initialized instance is not valid for use.
23 type SpanLink struct {
24 orig *internal.SpanLink
25 state *internal.State
26 }
27
28 func newSpanLink(orig *internal.SpanLink, state *internal.State) SpanLink {
29 return SpanLink{orig: orig, state: state}
30 }
31
32 // NewSpanLink creates a new empty SpanLink.
33 //
34 // This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
35 // OR directly access the member if this is embedded in another struct.
36 func NewSpanLink() SpanLink {
37 return newSpanLink(internal.NewSpanLink(), internal.NewState())
38 }
39
40 // MoveTo moves all properties from the current struct overriding the destination and
41 // resetting the current instance to its zero value
42 func (ms SpanLink) MoveTo(dest SpanLink) {
43 ms.state.AssertMutable()
44 dest.state.AssertMutable()
45 // If they point to the same data, they are the same, nothing to do.
46 if ms.orig == dest.orig {
47 return
48 }
49 internal.DeleteSpanLink(dest.orig, false)
50 *dest.orig, *ms.orig = *ms.orig, *dest.orig
51 }
52
53 // TraceID returns the traceid associated with this SpanLink.
54 func (ms SpanLink) TraceID() pcommon.TraceID {
55 return pcommon.TraceID(ms.orig.TraceId)
56 }
57
58 // SetTraceID replaces the traceid associated with this SpanLink.
59 func (ms SpanLink) SetTraceID(v pcommon.TraceID) {
60 ms.state.AssertMutable()
61 ms.orig.TraceId = internal.TraceID(v)
62 }
63
64 // SpanID returns the spanid associated with this SpanLink.
65 func (ms SpanLink) SpanID() pcommon.SpanID {
66 return pcommon.SpanID(ms.orig.SpanId)
67 }
68
69 // SetSpanID replaces the spanid associated with this SpanLink.
70 func (ms SpanLink) SetSpanID(v pcommon.SpanID) {
71 ms.state.AssertMutable()
72 ms.orig.SpanId = internal.SpanID(v)
73 }
74
75 // TraceState returns the tracestate associated with this SpanLink.
76 func (ms SpanLink) TraceState() pcommon.TraceState {
77 return pcommon.TraceState(internal.NewTraceStateWrapper(&ms.orig.TraceState, ms.state))
78 }
79
80 // Attributes returns the Attributes associated with this SpanLink.
81 func (ms SpanLink) Attributes() pcommon.Map {
82 return pcommon.Map(internal.NewMapWrapper(&ms.orig.Attributes, ms.state))
83 }
84
85 // DroppedAttributesCount returns the droppedattributescount associated with this SpanLink.
86 func (ms SpanLink) DroppedAttributesCount() uint32 {
87 return ms.orig.DroppedAttributesCount
88 }
89
90 // SetDroppedAttributesCount replaces the droppedattributescount associated with this SpanLink.
91 func (ms SpanLink) SetDroppedAttributesCount(v uint32) {
92 ms.state.AssertMutable()
93 ms.orig.DroppedAttributesCount = v
94 }
95
96 // Flags returns the flags associated with this SpanLink.
97 func (ms SpanLink) Flags() uint32 {
98 return ms.orig.Flags
99 }
100
101 // SetFlags replaces the flags associated with this SpanLink.
102 func (ms SpanLink) SetFlags(v uint32) {
103 ms.state.AssertMutable()
104 ms.orig.Flags = v
105 }
106
107 // CopyTo copies all properties from the current struct overriding the destination.
108 func (ms SpanLink) CopyTo(dest SpanLink) {
109 dest.state.AssertMutable()
110 internal.CopySpanLink(dest.orig, ms.orig)
111 }