Skip to content

Commit

Permalink
fixing testscripts test; using eng logger; using time.seconds const
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhuie19 committed Jan 10, 2025
1 parent 8b02f20 commit d4519a9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
7 changes: 3 additions & 4 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/plugins"
)

const ApplicationHeartbeatSeconds = 1
const Heartbeat = time.Second

// Application implements the common functions used in the core node.
type Application interface {
Expand Down Expand Up @@ -207,8 +207,7 @@ type ApplicationHeartbeat struct {

func NewApplicationHeartbeat(lggr logger.Logger) ApplicationHeartbeat {
h := ApplicationHeartbeat{
beat: ApplicationHeartbeatSeconds * time.Second,
lggr: lggr,
beat: Heartbeat,
}
h.Service, h.eng = commonservices.Config{
Name: "NodeHeartbeat",
Expand Down Expand Up @@ -242,7 +241,7 @@ func (h *ApplicationHeartbeat) start(_ context.Context) error {

err = cme.Emit(engCtx, "heartbeat")
if err != nil {
h.lggr.Errorw("heartbeat emit failed", "err", err)
h.eng.Errorw("heartbeat emit failed", "err", err)
}
}

Expand Down
14 changes: 9 additions & 5 deletions core/services/chainlink/config_telemetry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,21 @@ func TestTelemetryConfig_ResourceAttributes(t *testing.T) {
"DefaultAttributes",
toml.Telemetry{ResourceAttributes: nil},
map[string]string{
"service.name": "chainlink",
"service.version": static.Version,
"service.name": "chainlink",
"service.sha": "unset",
"service.shortversion": "unset",
"service.version": static.Version,
},
},
{
"CustomAttributes",
toml.Telemetry{ResourceAttributes: map[string]string{"custom.key": "custom.value"}},
map[string]string{
"service.name": "chainlink",
"service.version": static.Version,
"custom.key": "custom.value",
"service.name": "chainlink",
"service.sha": "unset",
"service.shortversion": "unset",
"service.version": static.Version,
"custom.key": "custom.value",
},
},
}
Expand Down
10 changes: 10 additions & 0 deletions testdata/scripts/health/default.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ok JobSpawner
ok Mailbox.Monitor
ok Mercury.WSRPCPool
ok Mercury.WSRPCPool.CacheSet
ok NodeHeartbeat
ok PipelineORM
ok PipelineRunner
ok PipelineRunner.BridgeCache
Expand Down Expand Up @@ -91,6 +92,15 @@ ok WorkflowDBStore
"output": ""
}
},
{
"type": "checks",
"id": "NodeHeartbeat",
"attributes": {
"name": "NodeHeartbeat",
"status": "passing",
"output": ""
}
},
{
"type": "checks",
"id": "PipelineORM",
Expand Down
10 changes: 10 additions & 0 deletions testdata/scripts/health/multi-chain.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ok JobSpawner
ok Mailbox.Monitor
ok Mercury.WSRPCPool
ok Mercury.WSRPCPool.CacheSet
ok NodeHeartbeat
ok PipelineORM
ok PipelineRunner
ok PipelineRunner.BridgeCache
Expand Down Expand Up @@ -299,6 +300,15 @@ ok WorkflowDBStore
"output": ""
}
},
{
"type": "checks",
"id": "NodeHeartbeat",
"attributes": {
"name": "NodeHeartbeat",
"status": "passing",
"output": ""
}
},
{
"type": "checks",
"id": "PipelineORM",
Expand Down

0 comments on commit d4519a9

Please sign in to comment.