| 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 |
// SummaryDataPoint is a single data point in a timeseries that describes the time-varying values of a Summary of double 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 NewSummaryDataPoint function to create new instances. |
| 20 |
// Important: zero-initialized instance is not valid for use. |
| 21 |
type SummaryDataPoint struct { |
| 22 |
orig *internal.SummaryDataPoint |
| 23 |
state *internal.State |
| 24 |
} |
| 25 |
|
| 26 |
func newSummaryDataPoint(orig *internal.SummaryDataPoint, state *internal.State) SummaryDataPoint { |
| 27 |
return SummaryDataPoint{orig: orig, state: state} |
| 28 |
} |
| 29 |
|
| 30 |
// NewSummaryDataPoint creates a new empty SummaryDataPoint. |
| 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 NewSummaryDataPoint() SummaryDataPoint { |
| 35 |
return newSummaryDataPoint(internal.NewSummaryDataPoint(), 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 SummaryDataPoint) MoveTo(dest SummaryDataPoint) { |
| 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.DeleteSummaryDataPoint(dest.orig, false) |
| 48 |
*dest.orig, *ms.orig = *ms.orig, *dest.orig |
| 49 |
} |
| 50 |
|
| 51 |
// Attributes returns the Attributes associated with this SummaryDataPoint. |
| 52 |
func (ms SummaryDataPoint) Attributes() pcommon.Map { |
| 53 |
return pcommon.Map(internal.NewMapWrapper(&ms.orig.Attributes, ms.state)) |
| 54 |
} |
| 55 |
|
| 56 |
// StartTimestamp returns the starttimestamp associated with this SummaryDataPoint. |
| 57 |
func (ms SummaryDataPoint) StartTimestamp() pcommon.Timestamp { |
| 58 |
return pcommon.Timestamp(ms.orig.StartTimeUnixNano) |
| 59 |
} |
| 60 |
|
| 61 |
// SetStartTimestamp replaces the starttimestamp associated with this SummaryDataPoint. |
| 62 |
func (ms SummaryDataPoint) SetStartTimestamp(v pcommon.Timestamp) { |
| 63 |
ms.state.AssertMutable() |
| 64 |
ms.orig.StartTimeUnixNano = uint64(v) |
| 65 |
} |
| 66 |
|
| 67 |
// Timestamp returns the timestamp associated with this SummaryDataPoint. |
| 68 |
func (ms SummaryDataPoint) Timestamp() pcommon.Timestamp { |
| 69 |
return pcommon.Timestamp(ms.orig.TimeUnixNano) |
| 70 |
} |
| 71 |
|
| 72 |
// SetTimestamp replaces the timestamp associated with this SummaryDataPoint. |
| 73 |
func (ms SummaryDataPoint) SetTimestamp(v pcommon.Timestamp) { |
| 74 |
ms.state.AssertMutable() |
| 75 |
ms.orig.TimeUnixNano = uint64(v) |
| 76 |
} |
| 77 |
|
| 78 |
// Count returns the count associated with this SummaryDataPoint. |
| 79 |
func (ms SummaryDataPoint) Count() uint64 { |
| 80 |
return ms.orig.Count |
| 81 |
} |
| 82 |
|
| 83 |
// SetCount replaces the count associated with this SummaryDataPoint. |
| 84 |
func (ms SummaryDataPoint) SetCount(v uint64) { |
| 85 |
ms.state.AssertMutable() |
| 86 |
ms.orig.Count = v |
| 87 |
} |
| 88 |
|
| 89 |
// Sum returns the sum associated with this SummaryDataPoint. |
| 90 |
func (ms SummaryDataPoint) Sum() float64 { |
| 91 |
return ms.orig.Sum |
| 92 |
} |
| 93 |
|
| 94 |
// SetSum replaces the sum associated with this SummaryDataPoint. |
| 95 |
func (ms SummaryDataPoint) SetSum(v float64) { |
| 96 |
ms.state.AssertMutable() |
| 97 |
ms.orig.Sum = v |
| 98 |
} |
| 99 |
|
| 100 |
// QuantileValues returns the QuantileValues associated with this SummaryDataPoint. |
| 101 |
func (ms SummaryDataPoint) QuantileValues() SummaryDataPointValueAtQuantileSlice { |
| 102 |
return newSummaryDataPointValueAtQuantileSlice(&ms.orig.QuantileValues, ms.state) |
| 103 |
} |
| 104 |
|
| 105 |
// Flags returns the flags associated with this SummaryDataPoint. |
| 106 |
func (ms SummaryDataPoint) Flags() DataPointFlags { |
| 107 |
return DataPointFlags(ms.orig.Flags) |
| 108 |
} |
| 109 |
|
| 110 |
// SetFlags replaces the flags associated with this SummaryDataPoint. |
| 111 |
func (ms SummaryDataPoint) SetFlags(v DataPointFlags) { |
| 112 |
ms.state.AssertMutable() |
| 113 |
ms.orig.Flags = uint32(v) |
| 114 |
} |
| 115 |
|
| 116 |
// CopyTo copies all properties from the current struct overriding the destination. |
| 117 |
func (ms SummaryDataPoint) CopyTo(dest SummaryDataPoint) { |
| 118 |
dest.state.AssertMutable() |
| 119 |
internal.CopySummaryDataPoint(dest.orig, ms.orig) |
| 120 |
} |