Debian Codegraph @

pdata/internal/generated_proto_metric.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 internal
8
9 import (
10 "fmt"
11 "sync"
12
13 "go.opentelemetry.io/collector/pdata/internal/json"
14 "go.opentelemetry.io/collector/pdata/internal/proto"
15 )
16
17 func (m *Metric) GetData() any {
18 if m != nil {
19 return m.Data
20 }
21 return nil
22 }
23
24 type Metric_Gauge struct {
25 Gauge *Gauge
26 }
27
28 func (m *Metric) GetGauge() *Gauge {
29 if v, ok := m.GetData().(*Metric_Gauge); ok {
30 return v.Gauge
31 }
32 return nil
33 }
34
35 type Metric_Sum struct {
36 Sum *Sum
37 }
38
39 func (m *Metric) GetSum() *Sum {
40 if v, ok := m.GetData().(*Metric_Sum); ok {
41 return v.Sum
42 }
43 return nil
44 }
45
46 type Metric_Histogram struct {
47 Histogram *Histogram
48 }
49
50 func (m *Metric) GetHistogram() *Histogram {
51 if v, ok := m.GetData().(*Metric_Histogram); ok {
52 return v.Histogram
53 }
54 return nil
55 }
56
57 type Metric_ExponentialHistogram struct {
58 ExponentialHistogram *ExponentialHistogram
59 }
60
61 func (m *Metric) GetExponentialHistogram() *ExponentialHistogram {
62 if v, ok := m.GetData().(*Metric_ExponentialHistogram); ok {
63 return v.ExponentialHistogram
64 }
65 return nil
66 }
67
68 type Metric_Summary struct {
69 Summary *Summary
70 }
71
72 func (m *Metric) GetSummary() *Summary {
73 if v, ok := m.GetData().(*Metric_Summary); ok {
74 return v.Summary
75 }
76 return nil
77 }
78
79 // Metric represents one metric as a collection of datapoints.
80 // See Metric definition in OTLP: https://github.com/open-telemetry/opentelemetry-proto/blob/main/opentelemetry/proto/metrics/v1/metrics.proto
81 type Metric struct {
82 Name string
83 Description string
84 Unit string
85 Data any
86 Metadata []KeyValue
87 }
88
89 var (
90 protoPoolMetric = sync.Pool{
91 New: func() any {
92 return &Metric{}
93 },
94 }
95
96 ProtoPoolMetric_Gauge = sync.Pool{
97 New: func() any {
98 return &Metric_Gauge{}
99 },
100 }
101
102 ProtoPoolMetric_Sum = sync.Pool{
103 New: func() any {
104 return &Metric_Sum{}
105 },
106 }
107
108 ProtoPoolMetric_Histogram = sync.Pool{
109 New: func() any {
110 return &Metric_Histogram{}
111 },
112 }
113
114 ProtoPoolMetric_ExponentialHistogram = sync.Pool{
115 New: func() any {
116 return &Metric_ExponentialHistogram{}
117 },
118 }
119
120 ProtoPoolMetric_Summary = sync.Pool{
121 New: func() any {
122 return &Metric_Summary{}
123 },
124 }
125 )
126
127 func NewMetric() *Metric {
128 if !UseProtoPooling.IsEnabled() {
129 return &Metric{}
130 }
131 return protoPoolMetric.Get().(*Metric)
132 }
133
134 func DeleteMetric(orig *Metric, nullable bool) {
135 if orig == nil {
136 return
137 }
138
139 if !UseProtoPooling.IsEnabled() {
140 orig.Reset()
141 return
142 }
143
144 switch ov := orig.Data.(type) {
145 case *Metric_Gauge:
146 DeleteGauge(ov.Gauge, true)
147 ov.Gauge = nil
148 ProtoPoolMetric_Gauge.Put(ov)
149 case *Metric_Sum:
150 DeleteSum(ov.Sum, true)
151 ov.Sum = nil
152 ProtoPoolMetric_Sum.Put(ov)
153 case *Metric_Histogram:
154 DeleteHistogram(ov.Histogram, true)
155 ov.Histogram = nil
156 ProtoPoolMetric_Histogram.Put(ov)
157 case *Metric_ExponentialHistogram:
158 DeleteExponentialHistogram(ov.ExponentialHistogram, true)
159 ov.ExponentialHistogram = nil
160 ProtoPoolMetric_ExponentialHistogram.Put(ov)
161 case *Metric_Summary:
162 DeleteSummary(ov.Summary, true)
163 ov.Summary = nil
164 ProtoPoolMetric_Summary.Put(ov)
165
166 }
167 for i := range orig.Metadata {
168 DeleteKeyValue(&orig.Metadata[i], false)
169 }
170
171 orig.Reset()
172 if nullable {
173 protoPoolMetric.Put(orig)
174 }
175 }
176
177 func CopyMetric(dest, src *Metric) *Metric {
178 // If copying to same object, just return.
179 if src == dest {
180 return dest
181 }
182
183 if src == nil {
184 return nil
185 }
186
187 if dest == nil {
188 dest = NewMetric()
189 }
190 dest.Name = src.Name
191
192 dest.Description = src.Description
193
194 dest.Unit = src.Unit
195
196 switch t := src.Data.(type) {
197 case *Metric_Gauge:
198 var ov *Metric_Gauge
199 if !UseProtoPooling.IsEnabled() {
200 ov = &Metric_Gauge{}
201 } else {
202 ov = ProtoPoolMetric_Gauge.Get().(*Metric_Gauge)
203 }
204 ov.Gauge = NewGauge()
205 CopyGauge(ov.Gauge, t.Gauge)
206 dest.Data = ov
207
208 case *Metric_Sum:
209 var ov *Metric_Sum
210 if !UseProtoPooling.IsEnabled() {
211 ov = &Metric_Sum{}
212 } else {
213 ov = ProtoPoolMetric_Sum.Get().(*Metric_Sum)
214 }
215 ov.Sum = NewSum()
216 CopySum(ov.Sum, t.Sum)
217 dest.Data = ov
218
219 case *Metric_Histogram:
220 var ov *Metric_Histogram
221 if !UseProtoPooling.IsEnabled() {
222 ov = &Metric_Histogram{}
223 } else {
224 ov = ProtoPoolMetric_Histogram.Get().(*Metric_Histogram)
225 }
226 ov.Histogram = NewHistogram()
227 CopyHistogram(ov.Histogram, t.Histogram)
228 dest.Data = ov
229
230 case *Metric_ExponentialHistogram:
231 var ov *Metric_ExponentialHistogram
232 if !UseProtoPooling.IsEnabled() {
233 ov = &Metric_ExponentialHistogram{}
234 } else {
235 ov = ProtoPoolMetric_ExponentialHistogram.Get().(*Metric_ExponentialHistogram)
236 }
237 ov.ExponentialHistogram = NewExponentialHistogram()
238 CopyExponentialHistogram(ov.ExponentialHistogram, t.ExponentialHistogram)
239 dest.Data = ov
240
241 case *Metric_Summary:
242 var ov *Metric_Summary
243 if !UseProtoPooling.IsEnabled() {
244 ov = &Metric_Summary{}
245 } else {
246 ov = ProtoPoolMetric_Summary.Get().(*Metric_Summary)
247 }
248 ov.Summary = NewSummary()
249 CopySummary(ov.Summary, t.Summary)
250 dest.Data = ov
251
252 default:
253 dest.Data = nil
254 }
255 dest.Metadata = CopyKeyValueSlice(dest.Metadata, src.Metadata)
256
257 return dest
258 }
259
260 func CopyMetricSlice(dest, src []Metric) []Metric {
261 var newDest []Metric
262 if cap(dest) < len(src) {
263 newDest = make([]Metric, len(src))
264 } else {
265 newDest = dest[:len(src)]
266 // Cleanup the rest of the elements so GC can free the memory.
267 // This can happen when len(src) < len(dest) < cap(dest).
268 for i := len(src); i < len(dest); i++ {
269 DeleteMetric(&dest[i], false)
270 }
271 }
272 for i := range src {
273 CopyMetric(&newDest[i], &src[i])
274 }
275 return newDest
276 }
277
278 func CopyMetricPtrSlice(dest, src []*Metric) []*Metric {
279 var newDest []*Metric
280 if cap(dest) < len(src) {
281 newDest = make([]*Metric, len(src))
282 // Copy old pointers to re-use.
283 copy(newDest, dest)
284 // Add new pointers for missing elements from len(dest) to len(srt).
285 for i := len(dest); i < len(src); i++ {
286 newDest[i] = NewMetric()
287 }
288 } else {
289 newDest = dest[:len(src)]
290 // Cleanup the rest of the elements so GC can free the memory.
291 // This can happen when len(src) < len(dest) < cap(dest).
292 for i := len(src); i < len(dest); i++ {
293 DeleteMetric(dest[i], true)
294 dest[i] = nil
295 }
296 // Add new pointers for missing elements.
297 // This can happen when len(dest) < len(src) < cap(dest).
298 for i := len(dest); i < len(src); i++ {
299 newDest[i] = NewMetric()
300 }
301 }
302 for i := range src {
303 CopyMetric(newDest[i], src[i])
304 }
305 return newDest
306 }
307
308 func (orig *Metric) Reset() {
309 *orig = Metric{}
310 }
311
312 // MarshalJSON marshals all properties from the current struct to the destination stream.
313 func (orig *Metric) MarshalJSON(dest *json.Stream) {
314 dest.WriteObjectStart()
315 if orig.Name != "" {
316 dest.WriteObjectField("name")
317 dest.WriteString(orig.Name)
318 }
319 if orig.Description != "" {
320 dest.WriteObjectField("description")
321 dest.WriteString(orig.Description)
322 }
323 if orig.Unit != "" {
324 dest.WriteObjectField("unit")
325 dest.WriteString(orig.Unit)
326 }
327 switch orig := orig.Data.(type) {
328 case *Metric_Gauge:
329 if orig.Gauge != nil {
330 dest.WriteObjectField("gauge")
331 orig.Gauge.MarshalJSON(dest)
332 }
333 case *Metric_Sum:
334 if orig.Sum != nil {
335 dest.WriteObjectField("sum")
336 orig.Sum.MarshalJSON(dest)
337 }
338 case *Metric_Histogram:
339 if orig.Histogram != nil {
340 dest.WriteObjectField("histogram")
341 orig.Histogram.MarshalJSON(dest)
342 }
343 case *Metric_ExponentialHistogram:
344 if orig.ExponentialHistogram != nil {
345 dest.WriteObjectField("exponentialHistogram")
346 orig.ExponentialHistogram.MarshalJSON(dest)
347 }
348 case *Metric_Summary:
349 if orig.Summary != nil {
350 dest.WriteObjectField("summary")
351 orig.Summary.MarshalJSON(dest)
352 }
353 }
354 if len(orig.Metadata) > 0 {
355 dest.WriteObjectField("metadata")
356 dest.WriteArrayStart()
357 orig.Metadata[0].MarshalJSON(dest)
358 for i := 1; i < len(orig.Metadata); i++ {
359 dest.WriteMore()
360 orig.Metadata[i].MarshalJSON(dest)
361 }
362 dest.WriteArrayEnd()
363 }
364 dest.WriteObjectEnd()
365 }
366
367 // UnmarshalJSON unmarshals all properties from the current struct from the source iterator.
368 func (orig *Metric) UnmarshalJSON(iter *json.Iterator) {
369 for f := iter.ReadObject(); f != ""; f = iter.ReadObject() {
370 switch f {
371 case "name":
372 orig.Name = iter.ReadString()
373 case "description":
374 orig.Description = iter.ReadString()
375 case "unit":
376 orig.Unit = iter.ReadString()
377
378 case "gauge":
379 {
380 var ov *Metric_Gauge
381 if !UseProtoPooling.IsEnabled() {
382 ov = &Metric_Gauge{}
383 } else {
384 ov = ProtoPoolMetric_Gauge.Get().(*Metric_Gauge)
385 }
386 ov.Gauge = NewGauge()
387 ov.Gauge.UnmarshalJSON(iter)
388 orig.Data = ov
389 }
390
391 case "sum":
392 {
393 var ov *Metric_Sum
394 if !UseProtoPooling.IsEnabled() {
395 ov = &Metric_Sum{}
396 } else {
397 ov = ProtoPoolMetric_Sum.Get().(*Metric_Sum)
398 }
399 ov.Sum = NewSum()
400 ov.Sum.UnmarshalJSON(iter)
401 orig.Data = ov
402 }
403
404 case "histogram":
405 {
406 var ov *Metric_Histogram
407 if !UseProtoPooling.IsEnabled() {
408 ov = &Metric_Histogram{}
409 } else {
410 ov = ProtoPoolMetric_Histogram.Get().(*Metric_Histogram)
411 }
412 ov.Histogram = NewHistogram()
413 ov.Histogram.UnmarshalJSON(iter)
414 orig.Data = ov
415 }
416
417 case "exponentialHistogram", "exponential_histogram":
418 {
419 var ov *Metric_ExponentialHistogram
420 if !UseProtoPooling.IsEnabled() {
421 ov = &Metric_ExponentialHistogram{}
422 } else {
423 ov = ProtoPoolMetric_ExponentialHistogram.Get().(*Metric_ExponentialHistogram)
424 }
425 ov.ExponentialHistogram = NewExponentialHistogram()
426 ov.ExponentialHistogram.UnmarshalJSON(iter)
427 orig.Data = ov
428 }
429
430 case "summary":
431 {
432 var ov *Metric_Summary
433 if !UseProtoPooling.IsEnabled() {
434 ov = &Metric_Summary{}
435 } else {
436 ov = ProtoPoolMetric_Summary.Get().(*Metric_Summary)
437 }
438 ov.Summary = NewSummary()
439 ov.Summary.UnmarshalJSON(iter)
440 orig.Data = ov
441 }
442
443 case "metadata":
444 for iter.ReadArray() {
445 orig.Metadata = append(orig.Metadata, KeyValue{})
446 orig.Metadata[len(orig.Metadata)-1].UnmarshalJSON(iter)
447 }
448
449 default:
450 iter.Skip()
451 }
452 }
453 }
454
455 func (orig *Metric) SizeProto() int {
456 var n int
457 var l int
458 _ = l
459 l = len(orig.Name)
460 if l > 0 {
461 n += 1 + proto.Sov(uint64(l)) + l
462 }
463 l = len(orig.Description)
464 if l > 0 {
465 n += 1 + proto.Sov(uint64(l)) + l
466 }
467 l = len(orig.Unit)
468 if l > 0 {
469 n += 1 + proto.Sov(uint64(l)) + l
470 }
471 switch orig := orig.Data.(type) {
472 case nil:
473 _ = orig
474 break
475 case *Metric_Gauge:
476 if orig.Gauge != nil {
477 l = orig.Gauge.SizeProto()
478 n += 1 + proto.Sov(uint64(l)) + l
479 }
480 case *Metric_Sum:
481 if orig.Sum != nil {
482 l = orig.Sum.SizeProto()
483 n += 1 + proto.Sov(uint64(l)) + l
484 }
485 case *Metric_Histogram:
486 if orig.Histogram != nil {
487 l = orig.Histogram.SizeProto()
488 n += 1 + proto.Sov(uint64(l)) + l
489 }
490 case *Metric_ExponentialHistogram:
491 if orig.ExponentialHistogram != nil {
492 l = orig.ExponentialHistogram.SizeProto()
493 n += 1 + proto.Sov(uint64(l)) + l
494 }
495 case *Metric_Summary:
496 if orig.Summary != nil {
497 l = orig.Summary.SizeProto()
498 n += 1 + proto.Sov(uint64(l)) + l
499 }
500 }
501 for i := range orig.Metadata {
502 l = orig.Metadata[i].SizeProto()
503 n += 1 + proto.Sov(uint64(l)) + l
504 }
505 return n
506 }
507
508 func (orig *Metric) MarshalProto(buf []byte) int {
509 pos := len(buf)
510 var l int
511 _ = l
512 l = len(orig.Name)
513 if l > 0 {
514 pos -= l
515 copy(buf[pos:], orig.Name)
516 pos = proto.EncodeVarint(buf, pos, uint64(l))
517 pos--
518 buf[pos] = 0xa
519 }
520 l = len(orig.Description)
521 if l > 0 {
522 pos -= l
523 copy(buf[pos:], orig.Description)
524 pos = proto.EncodeVarint(buf, pos, uint64(l))
525 pos--
526 buf[pos] = 0x12
527 }
528 l = len(orig.Unit)
529 if l > 0 {
530 pos -= l
531 copy(buf[pos:], orig.Unit)
532 pos = proto.EncodeVarint(buf, pos, uint64(l))
533 pos--
534 buf[pos] = 0x1a
535 }
536 switch orig := orig.Data.(type) {
537 case *Metric_Gauge:
538 if orig.Gauge != nil {
539 l = orig.Gauge.MarshalProto(buf[:pos])
540 pos -= l
541 pos = proto.EncodeVarint(buf, pos, uint64(l))
542 pos--
543 buf[pos] = 0x2a
544 }
545 case *Metric_Sum:
546 if orig.Sum != nil {
547 l = orig.Sum.MarshalProto(buf[:pos])
548 pos -= l
549 pos = proto.EncodeVarint(buf, pos, uint64(l))
550 pos--
551 buf[pos] = 0x3a
552 }
553 case *Metric_Histogram:
554 if orig.Histogram != nil {
555 l = orig.Histogram.MarshalProto(buf[:pos])
556 pos -= l
557 pos = proto.EncodeVarint(buf, pos, uint64(l))
558 pos--
559 buf[pos] = 0x4a
560 }
561 case *Metric_ExponentialHistogram:
562 if orig.ExponentialHistogram != nil {
563 l = orig.ExponentialHistogram.MarshalProto(buf[:pos])
564 pos -= l
565 pos = proto.EncodeVarint(buf, pos, uint64(l))
566 pos--
567 buf[pos] = 0x52
568 }
569 case *Metric_Summary:
570 if orig.Summary != nil {
571 l = orig.Summary.MarshalProto(buf[:pos])
572 pos -= l
573 pos = proto.EncodeVarint(buf, pos, uint64(l))
574 pos--
575 buf[pos] = 0x5a
576 }
577 }
578 for i := len(orig.Metadata) - 1; i >= 0; i-- {
579 l = orig.Metadata[i].MarshalProto(buf[:pos])
580 pos -= l
581 pos = proto.EncodeVarint(buf, pos, uint64(l))
582 pos--
583 buf[pos] = 0x62
584 }
585 return len(buf) - pos
586 }
587
588 func (orig *Metric) UnmarshalProto(buf []byte) error {
589 var err error
590 var fieldNum int32
591 var wireType proto.WireType
592
593 l := len(buf)
594 pos := 0
595 for pos < l {
596 // If in a group parsing, move to the next tag.
597 fieldNum, wireType, pos, err = proto.ConsumeTag(buf, pos)
598 if err != nil {
599 return err
600 }
601 switch fieldNum {
602
603 case 1:
604 if wireType != proto.WireTypeLen {
605 return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType)
606 }
607 var length int
608 length, pos, err = proto.ConsumeLen(buf, pos)
609 if err != nil {
610 return err
611 }
612 startPos := pos - length
613 orig.Name = string(buf[startPos:pos])
614
615 case 2:
616 if wireType != proto.WireTypeLen {
617 return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType)
618 }
619 var length int
620 length, pos, err = proto.ConsumeLen(buf, pos)
621 if err != nil {
622 return err
623 }
624 startPos := pos - length
625 orig.Description = string(buf[startPos:pos])
626
627 case 3:
628 if wireType != proto.WireTypeLen {
629 return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType)
630 }
631 var length int
632 length, pos, err = proto.ConsumeLen(buf, pos)
633 if err != nil {
634 return err
635 }
636 startPos := pos - length
637 orig.Unit = string(buf[startPos:pos])
638
639 case 5:
640 if wireType != proto.WireTypeLen {
641 return fmt.Errorf("proto: wrong wireType = %d for field Gauge", wireType)
642 }
643 var length int
644 length, pos, err = proto.ConsumeLen(buf, pos)
645 if err != nil {
646 return err
647 }
648 startPos := pos - length
649 var ov *Metric_Gauge
650 if !UseProtoPooling.IsEnabled() {
651 ov = &Metric_Gauge{}
652 } else {
653 ov = ProtoPoolMetric_Gauge.Get().(*Metric_Gauge)
654 }
655 ov.Gauge = NewGauge()
656 err = ov.Gauge.UnmarshalProto(buf[startPos:pos])
657 if err != nil {
658 return err
659 }
660 orig.Data = ov
661
662 case 7:
663 if wireType != proto.WireTypeLen {
664 return fmt.Errorf("proto: wrong wireType = %d for field Sum", wireType)
665 }
666 var length int
667 length, pos, err = proto.ConsumeLen(buf, pos)
668 if err != nil {
669 return err
670 }
671 startPos := pos - length
672 var ov *Metric_Sum
673 if !UseProtoPooling.IsEnabled() {
674 ov = &Metric_Sum{}
675 } else {
676 ov = ProtoPoolMetric_Sum.Get().(*Metric_Sum)
677 }
678 ov.Sum = NewSum()
679 err = ov.Sum.UnmarshalProto(buf[startPos:pos])
680 if err != nil {
681 return err
682 }
683 orig.Data = ov
684
685 case 9:
686 if wireType != proto.WireTypeLen {
687 return fmt.Errorf("proto: wrong wireType = %d for field Histogram", wireType)
688 }
689 var length int
690 length, pos, err = proto.ConsumeLen(buf, pos)
691 if err != nil {
692 return err
693 }
694 startPos := pos - length
695 var ov *Metric_Histogram
696 if !UseProtoPooling.IsEnabled() {
697 ov = &Metric_Histogram{}
698 } else {
699 ov = ProtoPoolMetric_Histogram.Get().(*Metric_Histogram)
700 }
701 ov.Histogram = NewHistogram()
702 err = ov.Histogram.UnmarshalProto(buf[startPos:pos])
703 if err != nil {
704 return err
705 }
706 orig.Data = ov
707
708 case 10:
709 if wireType != proto.WireTypeLen {
710 return fmt.Errorf("proto: wrong wireType = %d for field ExponentialHistogram", wireType)
711 }
712 var length int
713 length, pos, err = proto.ConsumeLen(buf, pos)
714 if err != nil {
715 return err
716 }
717 startPos := pos - length
718 var ov *Metric_ExponentialHistogram
719 if !UseProtoPooling.IsEnabled() {
720 ov = &Metric_ExponentialHistogram{}
721 } else {
722 ov = ProtoPoolMetric_ExponentialHistogram.Get().(*Metric_ExponentialHistogram)
723 }
724 ov.ExponentialHistogram = NewExponentialHistogram()
725 err = ov.ExponentialHistogram.UnmarshalProto(buf[startPos:pos])
726 if err != nil {
727 return err
728 }
729 orig.Data = ov
730
731 case 11:
732 if wireType != proto.WireTypeLen {
733 return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType)
734 }
735 var length int
736 length, pos, err = proto.ConsumeLen(buf, pos)
737 if err != nil {
738 return err
739 }
740 startPos := pos - length
741 var ov *Metric_Summary
742 if !UseProtoPooling.IsEnabled() {
743 ov = &Metric_Summary{}
744 } else {
745 ov = ProtoPoolMetric_Summary.Get().(*Metric_Summary)
746 }
747 ov.Summary = NewSummary()
748 err = ov.Summary.UnmarshalProto(buf[startPos:pos])
749 if err != nil {
750 return err
751 }
752 orig.Data = ov
753
754 case 12:
755 if wireType != proto.WireTypeLen {
756 return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType)
757 }
758 var length int
759 length, pos, err = proto.ConsumeLen(buf, pos)
760 if err != nil {
761 return err
762 }
763 startPos := pos - length
764 orig.Metadata = append(orig.Metadata, KeyValue{})
765 err = orig.Metadata[len(orig.Metadata)-1].UnmarshalProto(buf[startPos:pos])
766 if err != nil {
767 return err
768 }
769 default:
770 pos, err = proto.ConsumeUnknown(buf, pos, wireType)
771 if err != nil {
772 return err
773 }
774 }
775 }
776 return nil
777 }
778
779 func GenTestMetric() *Metric {
780 orig := NewMetric()
781 orig.Name = "test_name"
782 orig.Description = "test_description"
783 orig.Unit = "test_unit"
784 orig.Data = &Metric_Gauge{Gauge: GenTestGauge()}
785 orig.Metadata = []KeyValue{{}, *GenTestKeyValue()}
786 return orig
787 }
788
789 func GenTestMetricPtrSlice() []*Metric {
790 orig := make([]*Metric, 5)
791 orig[0] = NewMetric()
792 orig[1] = GenTestMetric()
793 orig[2] = NewMetric()
794 orig[3] = GenTestMetric()
795 orig[4] = NewMetric()
796 return orig
797 }
798
799 func GenTestMetricSlice() []Metric {
800 orig := make([]Metric, 5)
801 orig[1] = *GenTestMetric()
802 orig[3] = *GenTestMetric()
803 return orig
804 }