-
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
Development monitoring #2045
Development monitoring #2045
Conversation
Make http request using axios
this is the generic class for checking if the service is alive create GridProxy class
add some types. add initializeServices add monitoring interval
now it return ServiceStatus
@@ -0,0 +1,56 @@ | |||
import { events } from "../helpers/events"; |
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.
I don't uderstand why we didn't do it like this
class ServiceMonitor {
constructor(services: Array<IService>, interval) {
...
}
private checkLivenessOnce {
}
private checkHealthOnce {
}
monitor() {
withInterval do your checkLivenessOnce and checkHealthOnce
}
}
…ns all needed events and thier handlers
- update example script - move disconnect handler to serviceMonitor class
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.
new GridProxyMonitor("<FakeURL>"), | ||
new TFChainMonitor("wss://tfchain.dev.grid.tf/ws", "mnemonic", "sr25519"), | ||
new RMBMonitor("wss://relay.dev.grid.tf", "wss://tfchain.dev.grid.tf/ws", "mnemonic", "sr25519"), | ||
]; |
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.
Would be great if a check for graphql was added to the example.
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.
I am afraid about disconnecting the clients cause it's only one static instance per url on the client, so if it will be used in the dashboard it might disconnect the client while deploying something.
packages/monitoring/package.json
Outdated
@@ -0,0 +1,32 @@ | |||
{ | |||
"name": "monitoring", |
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.
any package's name added to this sdk should start with @threefold/
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.
i notice the license also is missing, which license should we use ?
packages/monitoring/package.json
Outdated
}, | ||
"dependencies": { | ||
"axios": "^0.27.2", | ||
"@polkadot/api": "^8.9.1", |
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.
no need to add this package if you are using tfchain client
private tfClient: TFClient; | ||
constructor(tfChainUrl: string, mnemonic: string, keypairType: KeypairType) { | ||
this.url = tfChainUrl; | ||
this.tfClient = new TFClient({ url: this.url, mnemonicOrSecret: mnemonic, keypairType: keypairType }); |
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.
why are we using TFClient here? it requires a mnemonic and a keypair type. Instead, we can use the queryClient which requires only the url
Description
This package provides service monitoring; currently, check if the service is alive
ServiceMonitor
classcheckServiceAliveness
: accepts array ofIServiceAliveness
andCreates an instance of ServiceMonitor.
This class have three public functions
monitorService
: Monitors the services at a regular interval and returns a function to exit and disconnect the monitoring.pingService
: check the liveness of the services and disconnectdisconnect
: disconnect the services that have disconnect handlerILivenessChecker
Interfaceeach instance of the classes that implements
ILivenessChecker
interface have its own logic to create the connection andcheck the service's aliveness
Evenets
we expose an instance of
MonitorEventEmitter
that make emitting events more easierChanges
added new package
monitoring
Related Issues
Checklist