telemetry: add visibility into stats worker reference underflow (#4856)
* telemetry: add visibility into stats worker reference underflow Log the paths that can leave a stats worker with no references, so the `-1` never-closed cases seen in production can be traced to their origin. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * telemetry: guard StatsWorker.MarshalLogObject against a nil receiver The new worker-created log passes the existing worker, which is a typed nil when there is none. Mirror ReferenceGuard.MarshalLogObject. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
adf44a2eb6
commit
d2405a72b1
@@ -4,6 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
func TestStatsWorker(t *testing.T) {
|
||||
@@ -60,4 +61,9 @@ func TestStatsWorker(t *testing.T) {
|
||||
require.Equal(t, 0, survivor.refCount.count)
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("logging a nil worker does not panic", func(t *testing.T) {
|
||||
var w *StatsWorker
|
||||
require.NoError(t, w.MarshalLogObject(zapcore.NewMapObjectEncoder()))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user