@@ -567,7 +567,7 @@ func TestReporterCommmonTagsInternal(t *testing.T) {
567
567
go server .Serve ()
568
568
defer server .Close ()
569
569
570
- commonTagsInternal := map [string ]string {
570
+ internalTags := map [string ]string {
571
571
"internal1" : "test1" ,
572
572
"internal2" : "test2" ,
573
573
}
@@ -577,8 +577,9 @@ func TestReporterCommmonTagsInternal(t *testing.T) {
577
577
Service : "test-service" ,
578
578
CommonTags : defaultCommonTags ,
579
579
MaxQueueSize : queueSize ,
580
+ IncludeHost : true ,
580
581
MaxPacketSizeBytes : maxPacketSize ,
581
- CommonTagsInternal : commonTagsInternal ,
582
+ InternalTags : internalTags ,
582
583
})
583
584
require .NoError (t , err )
584
585
defer r .Close ()
@@ -595,14 +596,19 @@ func TestReporterCommmonTagsInternal(t *testing.T) {
595
596
for _ , metric := range metrics {
596
597
if strings .HasPrefix (metric .Name , "tally.internal" ) {
597
598
numInternalMetricsActual ++
598
- for k , v := range commonTagsInternal {
599
+ for k , v := range internalTags {
599
600
require .True (t , tagEquals (metric .Tags , k , v ))
600
601
}
601
602
} else {
602
603
require .Equal (t , "testCounter1" , metric .Name )
603
604
require .False (t , tagIncluded (metric .Tags , "internal1" ))
604
605
require .False (t , tagIncluded (metric .Tags , "internal2" ))
605
606
}
607
+ // The following tags should not be present as part of the individual metrics
608
+ // as they are common tags.
609
+ require .False (t , tagIncluded (metric .Tags , "host" ))
610
+ require .False (t , tagIncluded (metric .Tags , "instance" ))
611
+ require .False (t , tagIncluded (metric .Tags , "service" ))
606
612
}
607
613
require .Equal (t , internalMetrics , numInternalMetricsActual )
608
614
}
@@ -636,12 +642,12 @@ type fakeM3ServerPackets struct {
636
642
}
637
643
638
644
// newFakeM3Server creates a new fake M3 server that listens on a random port
639
- // and returns the address .
645
+ // and returns the server .
640
646
// The server will wait for the given wait group to be done before returning.
641
- // If countBatches is true, the server will wait for a batch to be received
642
- // before returning .
643
- // But if countBatches is false, the server will wait for a metric to be received
644
- // before returning .
647
+ // If countBatches is true, the server will wait consider the wg.Add()s to be
648
+ // representing batches and will do a eg.Done() for each encountered batch .
649
+ // But if countBatches is false, the server will do the same thing but for individual
650
+ // metrics instead of batches .
645
651
func newFakeM3Server (t * testing.T , wg * sync.WaitGroup , countBatches bool , protocol Protocol ) * fakeM3Server {
646
652
service := newFakeM3Service (wg , countBatches )
647
653
processor := m3thrift .NewM3Processor (service )
0 commit comments