diff --git a/core/services/chainlink/application.go b/core/services/chainlink/application.go index 44923037ab5..41c5f6c06de 100644 --- a/core/services/chainlink/application.go +++ b/core/services/chainlink/application.go @@ -202,7 +202,6 @@ type ApplicationHeartbeat struct { eng *commonservices.Engine beat time.Duration - lggr logger.Logger } func NewApplicationHeartbeat(lggr logger.Logger) ApplicationHeartbeat { @@ -231,26 +230,21 @@ func (h *ApplicationHeartbeat) start(_ context.Context) error { cme := custmsg.NewLabeler() // Define tick functions - beatFn := func(engCtx context.Context) { + beatFn := func(ctx context.Context) { // TODO allow override of tracer provider into engine for beholder - _, innerSpan := beholder.GetTracer().Start(engCtx, "heartbeat.beat") + _, innerSpan := beholder.GetTracer().Start(ctx, "heartbeat.beat") defer innerSpan.End() - gauge.Record(engCtx, 1) - count.Record(engCtx, 1) + gauge.Record(ctx, 1) + count.Record(ctx, 1) - err = cme.Emit(engCtx, "heartbeat") + err = cme.Emit(ctx, "heartbeat") if err != nil { h.eng.Errorw("heartbeat emit failed", "err", err) } } - // consistent tick period - constantTickFn := func() time.Duration { - return h.beat - } - - h.eng.GoTick(timeutil.NewTicker(constantTickFn), beatFn) + h.eng.GoTick(timeutil.NewTicker(h.getBeat), beatFn) return nil } @@ -258,6 +252,10 @@ func (h *ApplicationHeartbeat) close() error { return nil } +func (h *ApplicationHeartbeat) getBeat() time.Duration { + return h.beat +} + // NewApplication initializes a new store if one is not already // present at the configured root directory (default: ~/.chainlink), // the logger at the same directory and returns the Application to diff --git a/core/services/chainlink/config_telemetry_test.go b/core/services/chainlink/config_telemetry_test.go index d40f0e11bd7..0627da03fb4 100644 --- a/core/services/chainlink/config_telemetry_test.go +++ b/core/services/chainlink/config_telemetry_test.go @@ -99,7 +99,7 @@ func TestTelemetryConfig_ResourceAttributes(t *testing.T) { map[string]string{ "service.name": "chainlink", "service.sha": "unset", - "service.shortversion": "unset", + "service.shortversion": "unset@unset", "service.version": static.Version, }, }, @@ -109,7 +109,7 @@ func TestTelemetryConfig_ResourceAttributes(t *testing.T) { map[string]string{ "service.name": "chainlink", "service.sha": "unset", - "service.shortversion": "unset", + "service.shortversion": "unset@unset", "service.version": static.Version, "custom.key": "custom.value", },