-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add heartbeat log #100
Conversation
290044d
to
1a92b46
Compare
@@ -183,3 +185,26 @@ export const signedApiResponse: Partial<AxiosResponse> = { | |||
}, | |||
data: { count: 3 }, | |||
}; | |||
|
|||
export const parseHeartbeatLog = (logMessage: string) => { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
1a92b46
to
6397183
Compare
rawConfigHash, | ||
]; | ||
const heartbeatSignature = await signHeartbeat(airnodeWallet, heartbeatPayload); | ||
const heartbeatLog = [...heartbeatPayload, heartbeatSignature].join(' - '); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Closes #96