Comments (9)
@jcheroske as far as a 200 status, would this suffice? https://docs.factom.com/api#properties
As for accessing the ready state of the node, we do have plans in the refactor to expose more state related information, but determining a node is "ready" from a network point of view is difficult. I know some suggestions were made, and there is a new current-minute
call. You could use this to see when a node begins to sync minutes, indicating it is "alive" in some sense. I would need to look over the implementation, however there is information to determine if the minute is on a normal cadence or slow:
https://docs.factom.com/api#current-minute
from factomd.
- This is a good question, but it might open a can of worms. Some things are clearly invalid, and some are more subjective. Things might look valid to a node but become invalid. The other way is possible too. For example, if a commit is submitted to the node, but it doesn't have enough balance, it might be considered an error, because it is not doing what the API user expected, but ECs might be purchased a few seconds later which make the commit valid. At that point it would be sent out (after having sit in the queue for a few seconds) an would make it to the blockchain. Determining errors at the API level can be tricky. Some things, you are right, might be better to pair the json error with an HTTP error. I don't have a strong opinion on this. I would love to hear other's opinions on this.
2 & 3. This is going to be part of the diagnostic API. This is one of the deliverables in the protocol grant, and is being worked on. I don't know the release timing of that though.
The json structure we figured would be added to over time as more things were added to the API return object. JSON allows for more things to be added without breaking reverse compatibility.
Here is some partial work on the diagnostic API. I would love some feedback on the json structure.
https://github.com/FactomProject/factomd/compare/FD-705_DiagnosticAPI
from factomd.
I don't think the status should involve itself in issues such as EC balance. The node is healthy but a user is using it incorrectly.
Even if, at a minimum, there was just a way to hit the API with nothing more than a GET and all we got back was a 200 and a little JSON object that said "Hello World!" that would be an improvement over the current situation of getting a 400 back. We can wait for the diagnostic API to do the more heavy lifting, but the way it's working right now it's not really supporting generic health checks from services like CloudFlare in an elegant way. We've got a hack in place to make it work, but it's not ideal.
from factomd.
ah, I see where the problem lies now. I had never considered cloudflare being a frontend for the factomd API. This is completely new thinking for me.
I need to disappear for a bit, but I think I see where you are going with this. I don't know how easy it would be to have what you are asking for. it might be easy if there is something specific in one of the calls when something goes wrong. What are you trying to get a 200 code to represent?
If you want to know if everything is working correctly, then that is something the node cannot know, ont for sure at least. It would involve something like watching the End Of Minute messages and seeing them come in at a regular interval. "operating properly" sounds like a fairly big ask. Getting some elements of that in the diagnostic API will certainly be a thing, but this sounds like a hard problem. I suppose it can know if some things are incorrect, like if it is booting up.
There seems like a spectrum of (node definately not ready) through (everything seems to be chugging along fine as of now). Where to throw an error (since the Federated servers might be the ones having the problem, and your node is fine) is a hard problem.
from factomd.
Yeah, determining whether the node is healthy is complex, and requires information from outside the node. That's not really what we're looking for here. We just want a superficial, "I'm ok!" endpoint for now.
We have two different API clients that need information from the node:
- Cloudflare: Just a superficial OK is all it can handle.
- Node Pool Monitoring Bot: It wants detailed info from each node, so it can make a determination as to whether or not a given node belongs in the pool.
So two different clients with different needs. One just needs a simple GET endpoint, the other will use the diagnostic API when it comes along.
from factomd.
I'm curious if there has been any forward progress with this? Not having a GET health check URI on the API port is increasingly problematic for me. It's not just CloudFlare being difficult, but now Kubernetes also needs an endpoint that can be hit easily. Here is my new proposal:
Change the response code on the API port's /
URI to be 200
Right now, it returns a 404. That's it. If you could do that, I would have everything I need.
from factomd.
This is still on the radar - there is a version that returns status here
Lines 850 to 868 in aa0da08
NOTE: it was mentioned that it may be risky to poll the state repeatedly - it may impact performance
In the control panel we keep a cache of current state data
Lines 25 to 58 in aa0da08
Currently it's not an easy refactor to expose this to the RPC port but this source of data is safer to poll repeatedly than the global state object
Also note: as mentioned above it is is not straightforward to decide if a node is ready to use - however as part of FD-869 see #720 we extended the control panel to report Ignore mode alongside the other heights - I believe https://github.com/BedrockSolutions/factomd-api-proxy will be able to make use of this in the short term.
In the long term as part of a major refactor we'll try to get the proper status reported by the RCP endpoint
from factomd.
@Emyrk may have some fresh thoughts about this.
In discussing the items for refactor - on of the takeaways was wanting better isolation of state variables
from the RPC API & Control Panel - we also still have support for hashicorp go plugins which will require a similar interface
from factomd.
going into a rewrite - this is still on our radar
from factomd.
Related Issues (20)
- state.Pub is nil
- [Wax] Investigate MissingData spam HOT 3
- New API version (HTTP/3)
- Investigate why scheduled CircleCI full test fails most of the time HOT 2
- Missing anchors HOT 5
- [Wax] simTest unit tests don't run HOT 4
- Fix all issues reported by vet + add vet check to CI HOT 1
- Remove bogus "MinuteNumber.GetSigHash() returned a nil for IHash" error. HOT 2
- [Wax] ControlPanel doesn't work with multiple nodes
- [Wax] Node doesn't sync HOT 7
- anchors API to support anchors into FCT mainnet HOT 6
- Mismatching Fed/Auth counts in control panel off HOT 4
- Fix 2nd pass % shown in Control Panel HOT 2
- Out of memory when building FastBoot file. Is that process suposed to consume lots of memory? HOT 4
- [6.7.0] Balance Difference bug HOT 4
- [6.10] Changelog HOT 3
- Convert Replay Filter to view the past via blocks
- build/versioning issue with docker-compose setup HOT 1
- Code Hygiene: Config File management
- /bin/sh: 1: go: not found for sudo make
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from factomd.