Debian Codegraph @

pdata/ptrace/generated_spanevent.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 // SpanEvent is a time-stamped annotation of the span, consisting of user-supplied
15 // text description and key-value pairs. See OTLP for event definition.
16 //
17 // This is a reference type, if passed by value and callee modifies it the
18 // caller will see the modification.
19 //
20 // Must use NewSpanEvent function to create new instances.
21 // Important: zero-initialized instance is not valid for use.
22 type SpanEvent struct {
23 orig *internal.SpanEvent
24 state *internal.State
25 }
26
27 func newSpanEvent(orig *internal.SpanEvent, state *internal.State) SpanEvent {
28 return SpanEvent{orig: orig, state: state}
29 }
30
31 // NewSpanEvent creates a new empty SpanEvent.
32 //
33 // This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
34 // OR directly access the member if this is embedded in another struct.
35 func NewSpanEvent() SpanEvent {
36 return newSpanEvent(internal.NewSpanEvent(), internal.NewState())
37 }
38
39 // MoveTo moves all properties from the current struct overriding the destination and
40 // resetting the current instance to its zero value
41 func (ms SpanEvent) MoveTo(dest SpanEvent) {
42 ms.state.AssertMutable()
43 dest.state.AssertMutable()
44 // If they point to the same data, they are the same, nothing to do.
45 if ms.orig == dest.orig {
46 return
47 }
48 internal.DeleteSpanEvent(dest.orig, false)
49 *dest.orig, *ms.orig = *ms.orig, *dest.orig
50 }
51
52 // Timestamp returns the timestamp associated with this SpanEvent.
53 func (ms SpanEvent) Timestamp() pcommon.Timestamp {
54 return pcommon.Timestamp(ms.orig.TimeUnixNano)
55 }
56
57 // SetTimestamp replaces the timestamp associated with this SpanEvent.
58 func (ms SpanEvent) SetTimestamp(v pcommon.Timestamp) {
59 ms.state.AssertMutable()
60 ms.orig.TimeUnixNano = uint64(v)
61 }
62
63 // Name returns the name associated with this SpanEvent.
64 func (ms SpanEvent) Name() string {
65 return ms.orig.Name
66 }
67
68 // SetName replaces the name associated with this SpanEvent.
69 func (ms SpanEvent) SetName(v string) {
70 ms.state.AssertMutable()
71 ms.orig.Name = v
72 }
73
74 // Attributes returns the Attributes associated with this SpanEvent.
75 func (ms SpanEvent) Attributes() pcommon.Map {
76 return pcommon.Map(internal.NewMapWrapper(&ms.orig.Attributes, ms.state))
77 }
78
79 // DroppedAttributesCount returns the droppedattributescount associated with this SpanEvent.
80 func (ms SpanEvent) DroppedAttributesCount() uint32 {
81 return ms.orig.DroppedAttributesCount
82 }
83
84 // SetDroppedAttributesCount replaces the droppedattributescount associated with this SpanEvent.
85 func (ms SpanEvent) SetDroppedAttributesCount(v uint32) {
86 ms.state.AssertMutable()
87 ms.orig.DroppedAttributesCount = v
88 }
89
90 // CopyTo copies all properties from the current struct overriding the destination.
91 func (ms SpanEvent) CopyTo(dest SpanEvent) {
92 dest.state.AssertMutable()
93 internal.CopySpanEvent(dest.orig, ms.orig)
94 }