From: Mathias Gibbens <gibmat@debian.org>
Date: Mon, 18 Aug 2025 13:40:07 +0200
Subject: Fix atomic alignment on 32bit systems

Forwarded: https://github.com/uber-go/tally/issues/223
---
 m3/reporter.go | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/m3/reporter.go b/m3/reporter.go
index 32c0d42..851c657 100644
--- a/m3/reporter.go
+++ b/m3/reporter.go
@@ -105,6 +105,12 @@ type Reporter interface {
 // remote M3 collector, metrics are batched together and emitted
 // via either thrift compact or binary protocol in batch UDP packets.
 type reporter struct {
+	now             atomic.Int64
+	pending         atomic.Uint64
+	numBatches      atomic.Int64
+	numMetrics      atomic.Int64
+	numWriteErrors  atomic.Int64
+	done            atomic.Bool
 	bucketIDTagName string
 	bucketTagName   string
 	bucketValFmt    string
@@ -114,24 +120,18 @@ type reporter struct {
 	calcProto       thrift.TProtocol
 	client          *m3thrift.M3Client
 	commonTags      []m3thrift.MetricTag
-	done            atomic.Bool
 	donech          chan struct{}
 	freeBytes       int32
 	metCh           chan sizedMetric
-	now             atomic.Int64
 	overheadBytes   int32
-	pending         atomic.Uint64
 	resourcePool    *resourcePool
 	stringInterner  *cache.StringInterner
 	tagCache        *cache.TagCache
 	wg              sync.WaitGroup
 
 	batchSizeHistogram    tally.CachedHistogram
-	numBatches            atomic.Int64
 	numBatchesCounter     tally.CachedCount
-	numMetrics            atomic.Int64
 	numMetricsCounter     tally.CachedCount
-	numWriteErrors        atomic.Int64
 	numWriteErrorsCounter tally.CachedCount
 	numTagCacheCounter    tally.CachedCount
 }
