Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add heartbeat log #100

Merged
merged 3 commits into from
Oct 31, 2023
Merged

Add heartbeat log #100

merged 3 commits into from
Oct 31, 2023

Conversation

Siegrift
Copy link
Collaborator

Closes #96

@@ -183,3 +185,26 @@ export const signedApiResponse: Partial<AxiosResponse> = {
},
data: { count: 3 },
};

export const parseHeartbeatLog = (logMessage: string) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@metobom You will need to detect the heartbeat logs and then parse it. This would be the way to do that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw. one thing not mentioned (but you are probably aware) is that the hash of the config needs to be verified as well. In my implementation I only do that inside the test here.

packages/pusher/src/heartbeat/heartbeat.ts Show resolved Hide resolved
packages/pusher/src/heartbeat/index.ts Outdated Show resolved Hide resolved
Base automatically changed from add-stage to main October 31, 2023 11:43
@Siegrift Siegrift merged commit 406953d into main Oct 31, 2023
4 checks passed
@Siegrift Siegrift deleted the log-heartbeat branch October 31, 2023 11:56
rawConfigHash,
];
const heartbeatSignature = await signHeartbeat(airnodeWallet, heartbeatPayload);
const heartbeatLog = [...heartbeatPayload, heartbeatSignature].join(' - ');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't it better to have some words indicates that it is heartbeat log? Like:

[Heartbeat] - 0xdAD65588187bC1a76C482174e25ACcED1413d2a1 - dev - 0.1.0 - 1699020775 - 1699020712 - 0xe872866f40b6a397b5bb5fe86b94809ba72e237633200c05d18ed345631fbd3b - 0x52843fc7b68cf2bacc6084929e6d77dbd71541d9b83838d078aaa2d7522eefec75b85a9f7628db787263d2dec93cb6d4194111411ec747d3b91d133c26bcb8341c

and log doesn't self descriptive so I'd prefer to have:

{
"airnode": "0xdAD65588187bC1a76C482174e25ACcED1413d2a1",
"stage": "dev",
"nodeVersion": "0.1.0",
...
"configHash": "0x52843fc7b68cf2bacc6084929e6d77dbd71541d9b83838d078aaa2d7522eefec75b85a9f7628db787263d2dec93cb6d4194111411ec747d3b91d133c26bcb8341c"
}

Because I'm querying logs and searching this log type among all, it's not easy with this schema.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, no problem. I think that would be better.

I can make the log message to be "Sending heartbeat" and specify all those fields as log context (which is JSON so it should be queryable). I've created #107

@Siegrift Siegrift mentioned this pull request Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add logs to use as heartbeat
4 participants