sociomantic-tsunami / swarm

Asynchronous client/node framework library
Boost Software License 1.0
14 stars 26 forks source link

Log receipt of deprecated or unsupported requests #302

Closed gavin-norman-sociomantic closed 5 years ago

gavin-norman-sociomantic commented 6 years ago

Currently, there is no actual deprecation path for requests. A new request version is implemented, support for the old version continues for some time, then is simply removed. The only way that app developers know about a request being phased out is if node maintainers tell them.

The main problem is this: how do node maintainers know when it is safe to remove support for a request version? The only way, currently, is to manually check which protocol version is used by all known clients. This is very manual and error-prone.

A proposal for a much improved solution:

  1. The request handling framework is enhanced such that it is possible to specify a certain request version as deprecated.
  2. Upon handling a request version that is marked as deprecated, the node sets a flag.
  3. The value of the flag is output to the stats log, enabling alerts to be set on it.
  4. Once a day, the flag is reset.
  5. The types and versions of of deprecated requests that were handled is also tracked, along with the names of the responsible clients. This information is written to the log (at warning level) periodically (also once a day?).
gavin-norman-sociomantic commented 6 years ago

Moved to v5.1.0, in order to avoid merge conflicts (this will touch code that contains a lot of deprecations in v4.x.x).

gavin-norman-sociomantic commented 6 years ago

We should also keep track of deprecated requests that are active. Some types of request (e.g. DMQ Consume) are active for long periods, so if we just track when they start, they will seem to hardly ever occur.

gavin-norman-sociomantic commented 6 years ago

Updated proposal:

  1. The request handling framework is enhanced such that it is possible to specify a certain request version as deprecated.
  2. Per deprecated request, per client name, the node tracks:
    • The time when a request for the client is first started or finished.
    • The count of active requests for the client.
    • The count of requests handled (i.e. started then finished) for the client.
  3. The node logs when:
    • A deprecated request is first sent by each client.
    • A client has no activity with a deprecated request for a period of one hour. (No activity means: no active requests and no requests started or finished.)
  4. The node outputs a bool to the stats log: true if any client has had activity with a deprecated request within the last hour.
gavin-norman-sociomantic commented 6 years ago

Rough PR: https://github.com/sociomantic-tsunami/swarm/pull/312. Blocked on being able to test the code in a neo node.

gavin-norman-sociomantic commented 5 years ago

Done in #312.