Debian Codegraph @

pdata/pmetric/generated_histogramdatapoint.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 pmetric
8
9 import (
10 "go.opentelemetry.io/collector/pdata/internal"
11 "go.opentelemetry.io/collector/pdata/pcommon"
12 )
13
14 // HistogramDataPoint is a single data point in a timeseries that describes the time-varying values of a Histogram of values.
15 //
16 // This is a reference type, if passed by value and callee modifies it the
17 // caller will see the modification.
18 //
19 // Must use NewHistogramDataPoint function to create new instances.
20 // Important: zero-initialized instance is not valid for use.
21 type HistogramDataPoint struct {
22 orig *internal.HistogramDataPoint
23 state *internal.State
24 }
25
26 func newHistogramDataPoint(orig *internal.HistogramDataPoint, state *internal.State) HistogramDataPoint {
27 return HistogramDataPoint{orig: orig, state: state}
28 }
29
30 // NewHistogramDataPoint creates a new empty HistogramDataPoint.
31 //
32 // This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice,
33 // OR directly access the member if this is embedded in another struct.
34 func NewHistogramDataPoint() HistogramDataPoint {
35 return newHistogramDataPoint(internal.NewHistogramDataPoint(), internal.NewState())
36 }
37
38 // MoveTo moves all properties from the current struct overriding the destination and
39 // resetting the current instance to its zero value
40 func (ms HistogramDataPoint) MoveTo(dest HistogramDataPoint) {
41 ms.state.AssertMutable()
42 dest.state.AssertMutable()
43 // If they point to the same data, they are the same, nothing to do.
44 if ms.orig == dest.orig {
45 return
46 }
47 internal.DeleteHistogramDataPoint(dest.orig, false)
48 *dest.orig, *ms.orig = *ms.orig, *dest.orig
49 }
50
51 // Attributes returns the Attributes associated with this HistogramDataPoint.
52 func (ms HistogramDataPoint) Attributes() pcommon.Map {
53 return pcommon.Map(internal.NewMapWrapper(&ms.orig.Attributes, ms.state))
54 }
55
56 // StartTimestamp returns the starttimestamp associated with this HistogramDataPoint.
57 func (ms HistogramDataPoint) StartTimestamp() pcommon.Timestamp {
58 return pcommon.Timestamp(ms.orig.StartTimeUnixNano)
59 }
60
61 // SetStartTimestamp replaces the starttimestamp associated with this HistogramDataPoint.
62 func (ms HistogramDataPoint) SetStartTimestamp(v pcommon.Timestamp) {
63 ms.state.AssertMutable()
64 ms.orig.StartTimeUnixNano = uint64(v)
65 }
66
67 // Timestamp returns the timestamp associated with this HistogramDataPoint.
68 func (ms HistogramDataPoint) Timestamp() pcommon.Timestamp {
69 return pcommon.Timestamp(ms.orig.TimeUnixNano)
70 }
71
72 // SetTimestamp replaces the timestamp associated with this HistogramDataPoint.
73 func (ms HistogramDataPoint) SetTimestamp(v pcommon.Timestamp) {
74 ms.state.AssertMutable()
75 ms.orig.TimeUnixNano = uint64(v)
76 }
77
78 // Count returns the count associated with this HistogramDataPoint.
79 func (ms HistogramDataPoint) Count() uint64 {
80 return ms.orig.Count
81 }
82
83 // SetCount replaces the count associated with this HistogramDataPoint.
84 func (ms HistogramDataPoint) SetCount(v uint64) {
85 ms.state.AssertMutable()
86 ms.orig.Count = v
87 }
88
89 // Sum returns the sum associated with this HistogramDataPoint.
90 func (ms HistogramDataPoint) Sum() float64 {
91 return ms.orig.GetSum()
92 }
93
94 // HasSum returns true if the HistogramDataPoint contains a
95 // Sum value otherwise.
96 func (ms HistogramDataPoint) HasSum() bool {
97 return ms.orig.Sum_ != nil
98 }
99
100 // SetSum replaces the sum associated with this HistogramDataPoint.
101 func (ms HistogramDataPoint) SetSum(v float64) {
102 ms.state.AssertMutable()
103 ms.orig.Sum_ = &internal.HistogramDataPoint_Sum{Sum: v}
104 }
105
106 // RemoveSum removes the sum associated with this HistogramDataPoint.
107 func (ms HistogramDataPoint) RemoveSum() {
108 ms.state.AssertMutable()
109 ms.orig.Sum_ = nil
110 }
111
112 // BucketCounts returns the BucketCounts associated with this HistogramDataPoint.
113 func (ms HistogramDataPoint) BucketCounts() pcommon.UInt64Slice {
114 return pcommon.UInt64Slice(internal.NewUInt64SliceWrapper(&ms.orig.BucketCounts, ms.state))
115 }
116
117 // ExplicitBounds returns the ExplicitBounds associated with this HistogramDataPoint.
118 func (ms HistogramDataPoint) ExplicitBounds() pcommon.Float64Slice {
119 return pcommon.Float64Slice(internal.NewFloat64SliceWrapper(&ms.orig.ExplicitBounds, ms.state))
120 }
121
122 // Exemplars returns the Exemplars associated with this HistogramDataPoint.
123 func (ms HistogramDataPoint) Exemplars() ExemplarSlice {
124 return newExemplarSlice(&ms.orig.Exemplars, ms.state)
125 }
126
127 // Flags returns the flags associated with this HistogramDataPoint.
128 func (ms HistogramDataPoint) Flags() DataPointFlags {
129 return DataPointFlags(ms.orig.Flags)
130 }
131
132 // SetFlags replaces the flags associated with this HistogramDataPoint.
133 func (ms HistogramDataPoint) SetFlags(v DataPointFlags) {
134 ms.state.AssertMutable()
135 ms.orig.Flags = uint32(v)
136 }
137
138 // Min returns the min associated with this HistogramDataPoint.
139 func (ms HistogramDataPoint) Min() float64 {
140 return ms.orig.GetMin()
141 }
142
143 // HasMin returns true if the HistogramDataPoint contains a
144 // Min value otherwise.
145 func (ms HistogramDataPoint) HasMin() bool {
146 return ms.orig.Min_ != nil
147 }
148
149 // SetMin replaces the min associated with this HistogramDataPoint.
150 func (ms HistogramDataPoint) SetMin(v float64) {
151 ms.state.AssertMutable()
152 ms.orig.Min_ = &internal.HistogramDataPoint_Min{Min: v}
153 }
154
155 // RemoveMin removes the min associated with this HistogramDataPoint.
156 func (ms HistogramDataPoint) RemoveMin() {
157 ms.state.AssertMutable()
158 ms.orig.Min_ = nil
159 }
160
161 // Max returns the max associated with this HistogramDataPoint.
162 func (ms HistogramDataPoint) Max() float64 {
163 return ms.orig.GetMax()
164 }
165
166 // HasMax returns true if the HistogramDataPoint contains a
167 // Max value otherwise.
168 func (ms HistogramDataPoint) HasMax() bool {
169 return ms.orig.Max_ != nil
170 }
171
172 // SetMax replaces the max associated with this HistogramDataPoint.
173 func (ms HistogramDataPoint) SetMax(v float64) {
174 ms.state.AssertMutable()
175 ms.orig.Max_ = &internal.HistogramDataPoint_Max{Max: v}
176 }
177
178 // RemoveMax removes the max associated with this HistogramDataPoint.
179 func (ms HistogramDataPoint) RemoveMax() {
180 ms.state.AssertMutable()
181 ms.orig.Max_ = nil
182 }
183
184 // CopyTo copies all properties from the current struct overriding the destination.
185 func (ms HistogramDataPoint) CopyTo(dest HistogramDataPoint) {
186 dest.state.AssertMutable()
187 internal.CopyHistogramDataPoint(dest.orig, ms.orig)
188 }