A component of Sentinel, a collection of services which monitor the health and function of the Filecoin network.
A Visor process collects permanent Filecoin chain meterics from a Lotus daemon, and writes them to a TimescaleDB time-series and relational datastore.
Clone the repo and build the dependencies:
$ git clone [email protected]:filecoin-project/sentinel-visor.git
$ cd sentinel-visor
$ make deps
Build the sentinel-visor
binary to the root of the project directory:
$ make build
Install TimescaleDB v1.7.4:
In a separate shell, use docker-compose to start the appropriate version of Postgres with TimescaleDB. (Note: Visor requires TimescaleDB v1.7.x and will not work with v2.0.)
docker-compose up --build timescaledb
To quickly run tests, you can provide the VISOR_TEST_DB
envvar and execute make test
like so:
VISOR_TEST_DB="postgres://postgres:password@localhost:5432/postgres?sslmode=disable" make test
For more, manual test running, you could also prepare your environment in the following way:
Create a new DB in postgres for testing:
CREATE DATABASE visor_test;
Migrate the database to the latest schema:
visor --db "postgres://username@localhost/visor_test?sslmode=disable" migrate --latest
Run the tests:
VISOR_TEST_DB="postgres://username@localhost/visor_test?sslmode=disable" go test ./...
sentinel-visor [<flags>] <command>
Use 'sentinel-visor help <command>' to learn more about each command.
Use the following env vars to configure the lotus node that visor reads from, and the database that it writes to:
LOTUS_PATH
- path to the lotus data dir. default:~/.lotus
LOTUS_DB
- database connection . default:postgres://postgres:password@localhost:5432/postgres?sslmode=disable
The walk
and watch
commands expect a list of tasks to be provided. Each task is responsible for reading a particular type of data from the chain and persisting it to the database.
The mapping between available tasks and database tables is as follows:
Task Name | Database Tables |
---|---|
blocks | block_headers, block_parents, drand_block_entries |
messages | messages, receipts, block_messages, parsed_messages, derived_gas_outputs, message_gas_economy |
chaineconomics | chain_economics |
actorstatesraw | actors, actor_states |
actorstatespower | chain_powers, power_actor_claims |
actorstatesreward | chain_rewards |
actorstatesminer | miner_current_deadline_infos, miner_fee_debts, miner_locked_funds, miner_infos, miner_sector_posts, miner_pre_commit_infos, miner_sector_infos, miner_sector_events, miner_sector_deals |
actorstatesinit | id_addresses |
actorstatesmarket | market_deal_proposals, market_deal_states |
actorstatesmultisig | multisig_transactions |
The global flag --tracing=<bool>
turns tracing on or off. It is on by default.
Tracing expects a Jaeger server to be available. Configure the Jaeger settings using the following subset of the standard Jaeger environment variables:
JAEGER_SERVICE_NAME
- name of the service (defaults tosentinel-visor
).JAEGER_AGENT_HOST
- hostname for communicating with Jaeger agent via UDP (defaults tolocalhost
).JAEGER_AGENT_PORT
- port for communicating with Jaeger agent via UDP (defaults to6831
).JAEGER_SAMPLER_TYPE
- type of sampling to use, eitherprobabilistic
orconst
(defaults toprobabilistic
).JAEGER_SAMPLER_PARAM
- numeric parameter used to configure the sampler type (defaults to0.0001
).
These variables may also be set using equivalent cli flags.
By default visor uses probabilistic sampling with a rate of 0.0001. During testing it can be easier to override to remove sampling by setting the following environment variables:
JAEGER_SAMPLER_TYPE=const JAEGER_SAMPLER_PARAM=1
or by specifying the following flags:
--jaeger-sampler-type=const jaeger-sampler-param=1
Feature branches and master are designated as unstable which are internal-only development builds.
Periodically a build will be designated as stable and will be assigned a version number by tagging the repository
using Semantic Versioning in the following format: vMajor.Minor.Patch
.
Sentinel Visor follows the Filecoin Project Code of Conduct. Before contributing, please acquaint yourself with our social courtesies and expectations.
Welcoming new issues and pull requests.
The Filecoin Project and Sentinel Visor is dual-licensed under Apache 2.0 and MIT terms:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)