From 3961f7fb1c2f2b1d170db287d092e8ef9ffe7271 Mon Sep 17 00:00:00 2001 From: Mikayla Toffler <46911781+mtoffl01@users.noreply.github.com> Date: Mon, 23 Dec 2024 14:49:50 -0500 Subject: [PATCH] chore: rename reportHealthMetrics function (#3040) --- ddtrace/tracer/metrics.go | 4 +++- ddtrace/tracer/metrics_test.go | 2 +- ddtrace/tracer/tracer.go | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ddtrace/tracer/metrics.go b/ddtrace/tracer/metrics.go index 409d8a439a..9cd17a968b 100644 --- a/ddtrace/tracer/metrics.go +++ b/ddtrace/tracer/metrics.go @@ -85,7 +85,9 @@ func (t *tracer) reportRuntimeMetrics(interval time.Duration) { } } -func (t *tracer) reportHealthMetrics(interval time.Duration) { +// reportHealthMetricsAtInterval reports noisy health metrics at the specified interval. +// The periodic reporting ensures metrics are delivered without overwhelming the system or logs. +func (t *tracer) reportHealthMetricsAtInterval(interval time.Duration) { ticker := time.NewTicker(interval) defer ticker.Stop() for { diff --git a/ddtrace/tracer/metrics_test.go b/ddtrace/tracer/metrics_test.go index 64548fce86..16a40e8492 100644 --- a/ddtrace/tracer/metrics_test.go +++ b/ddtrace/tracer/metrics_test.go @@ -43,7 +43,7 @@ func TestReportRuntimeMetrics(t *testing.T) { assert.Contains(calls, "runtime.go.gc_stats.pause_quantiles.75p") } -func TestReportHealthMetrics(t *testing.T) { +func TestReportHealthMetricsAtInterval(t *testing.T) { assert := assert.New(t) var tg statsdtest.TestStatsdClient diff --git a/ddtrace/tracer/tracer.go b/ddtrace/tracer/tracer.go index a345fd6366..25e08b7cb3 100644 --- a/ddtrace/tracer/tracer.go +++ b/ddtrace/tracer/tracer.go @@ -376,7 +376,7 @@ func newTracer(opts ...StartOption) *tracer { t.wg.Add(1) go func() { defer t.wg.Done() - t.reportHealthMetrics(statsInterval) + t.reportHealthMetricsAtInterval(statsInterval) }() t.stats.Start() return t