Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Client: Structured logging #90

@gavofyork

Description

@gavofyork

Eventual aim: a highly detailed version of ethstats.net with clients (optionally!) directly contacting a central web server to provide it with real-time information that is collated and served to web pages.

This is a two-part project; one part is fitting the appropriate logging into the client in order to connect and stream JSON information on the client's operational statistics to a server. The second part is writing such a web app; the server part of the app would receive and collate this information in real time from many polkadot clients and then distribute the resulting information to web-browsers for display.

This issue only describes the first part.

Implementation

slog can provide the structured logging API. This should be combined with a lazy_static and a simple macro in order to get a global logging macro, much like trace! from the log crate except that it accepts key/value pairs rather than a formatted string.

This macro should be used throughout the client for all key events (block arrived from network/queued/validated/imported, transaction(s) submitted/arrived/mined, peer connected/disconnected, ...).

The output of the structured log should be directed to a JSON encoder and then sent via a websockets connection to a server (address/port configurable via CLI params ala polkadot --stats-server=ws://stats.polkadot.io). On opening the websockets connection, an initial dump of the nodes state should be made (current chain head number/hash, peers, transactions in the pool).

Metadata

Metadata

Labels

J0-enhancementAn additional feature request.U2-some_time_soonIssue is worth doing soon.Z2-mediumCan be fixed by a coder with good Rust knowledge but little knowledge of the codebase.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions