|
@@ -16,7 +16,6 @@ package profile
|
16
|
16
|
|
17
|
17
|
import (
|
18
|
18
|
"fmt"
|
19
|
|
- "reflect"
|
20
|
19
|
"sort"
|
21
|
20
|
"strconv"
|
22
|
21
|
"strings"
|
|
@@ -420,7 +419,7 @@ func combineHeaders(srcs []*Profile) (*Profile, error) {
|
420
|
419
|
// returns nil if the profiles are compatible; otherwise an error with
|
421
|
420
|
// details on the incompatibility.
|
422
|
421
|
func (p *Profile) compatible(pb *Profile) error {
|
423
|
|
- if !reflect.DeepEqual(p.PeriodType, pb.PeriodType) {
|
|
422
|
+ if !equalValueType(p.PeriodType, pb.PeriodType) {
|
424
|
423
|
return fmt.Errorf("incompatible period types %v and %v", p.PeriodType, pb.PeriodType)
|
425
|
424
|
}
|
426
|
425
|
|
|
@@ -429,10 +428,16 @@ func (p *Profile) compatible(pb *Profile) error {
|
429
|
428
|
}
|
430
|
429
|
|
431
|
430
|
for i := range p.SampleType {
|
432
|
|
- if !reflect.DeepEqual(p.SampleType[i], pb.SampleType[i]) {
|
|
431
|
+ if !equalValueType(p.SampleType[i], pb.SampleType[i]) {
|
433
|
432
|
return fmt.Errorf("incompatible sample types %v and %v", p.SampleType, pb.SampleType)
|
434
|
433
|
}
|
435
|
434
|
}
|
436
|
435
|
|
437
|
436
|
return nil
|
438
|
437
|
}
|
|
438
|
+
|
|
439
|
+// equalValueType returns true if the two value types are semantically
|
|
440
|
+// equal. It ignores the internal fields used during encode/decode.
|
|
441
|
+func equalValueType(st1, st2 *ValueType) bool {
|
|
442
|
+ return st1.Type == st2.Type && st1.Unit == st2.Unit
|
|
443
|
+}
|