erigon-pulse/erigon-lib
milen 27d8865f35
metrics: switch to using prometheus library (#8741)
# Background

Erigon currently uses a combination of Victoria Metrics and Prometheus
client for providing metrics.

We want to rationalize this and use only the Prometheus client library,
but we want to maintain the simplified Victoria Metrics methods for
constructing metrics.

This task is currently partly complete and needs to be finished to a
stage where we can remove the Victoria Metrics module from the Erigon
code base.

## Tests

### Functional
* Make sure that the format change int->float implied by VM to
Prometheus does not impact clients (pay particular attention to block
numbers)
* Check that the prometheus/grafana dashboards defined in cmd/prometheus
are functional after the change
(see docker-compose.yml for details and
https://github.com/ledgerwatch/erigon/tree/devel/cmd/prometheus#readme)
* Confirm that the underlying go metrics are still generated
* Confirm the following flags setting work:
    --metrics, --metrics.addr, --metrics.port with the new code
* Confirm that --metrics and --proff settings and handlers configuration
still allow metrics and pprof to share a port

#### Float counters - scientific notation test case
![Screenshot_2023-11-07_at_15 57
21](https://github.com/ledgerwatch/erigon/assets/94537774/32f0a6f6-968b-477c-8ec8-bb1812f3e848)

![Screenshot 2023-11-15 at 16 26
56](https://github.com/ledgerwatch/erigon/assets/94537774/3f402b2e-e343-4928-9fbb-18fa4d077485)


#### Float counters - NaN test case
![Screenshot_2023-11-07_at_16 04
25](https://github.com/ledgerwatch/erigon/assets/94537774/cbf90d5d-3749-4bd7-971d-e2124e54267c)

![Screenshot 2023-11-15 at 16 28
36](https://github.com/ledgerwatch/erigon/assets/94537774/5924915e-1977-4b7f-8082-23f73d0957d5)

### Performance
* Check the performance of counters created by RPC calls measurements
created by rpc/metrics.go are not impacted by the change.

#### RPC
Performed tests on rpcdaemon & erigon on localhost using
`etc_blockNumber`.
Did tests with 100, 1000, 10000 requests. Got a steady 15 ms response
time.

#### Memory
![Screenshot 2023-11-16 at 09 58
39](https://github.com/ledgerwatch/erigon/assets/94537774/5dd956d7-903f-4bea-a460-d3644da56201)
2023-11-16 16:30:37 +00:00
..
.github/workflows go.mod: minimal go version 1.20 (#8495) 2023-10-17 06:52:28 +07:00
bptree
chain Fix Agra hf scheduling on Mumbai (#8620) 2023-10-30 15:18:47 +01:00
commitment Add 'erigon-lib/' from commit '93d9c9d9fe4bd8a49f7a98a6bce0f0da7094c7d3' 2023-09-20 14:50:25 +02:00
common erigon-lib: remove unused constants from protocol.go (#8644) 2023-11-03 10:20:36 +01:00
compress Add full support to beacon snapshots (#8665) 2023-11-13 14:10:57 +01:00
crypto Sentinel refactor (#8296) 2023-10-22 01:17:18 +02:00
diagnostics added snapshot sync diagnostic information, updated diagnostic channel (#8645) 2023-11-07 12:50:36 +00:00
direct snapshots: reduce merge limit of blocks to 100K (#8614) 2023-11-01 23:22:35 +07:00
downloader downloader: whitelist only .seg.torrent files. (#8729) 2023-11-15 11:23:57 +07:00
etl etl: more tests (#8534) 2023-10-20 13:54:46 +07:00
gointerfaces snapshots: reduce merge limit of blocks to 100K (#8614) 2023-11-01 23:22:35 +07:00
kv Add full support to beacon snapshots (#8665) 2023-11-13 14:10:57 +01:00
metrics metrics: switch to using prometheus library (#8741) 2023-11-16 16:30:37 +00:00
mmap sys deps up (#8695) 2023-11-11 15:04:18 +03:00
patricia Upgrade libp2p (enables go 1.21 support) (#8288) 2023-09-29 22:11:13 +02:00
pedersen_hash Sentinel refactor (#8296) 2023-10-22 01:17:18 +02:00
recsplit Block execution using embedded Silkworm (#8353) 2023-10-05 09:27:37 +07:00
rlp Fix rlp.EncodeString for length 56 (#8528) 2023-10-19 11:45:19 +02:00
rlp2 rlp2 (#8643) 2023-11-04 09:22:11 +07:00
sais
state sys deps up (#8695) 2023-11-11 15:04:18 +03:00
tools sys deps up (#8695) 2023-11-11 15:04:18 +03:00
txpool sys deps up (#8695) 2023-11-11 15:04:18 +03:00
types sys deps up (#8695) 2023-11-11 15:04:18 +03:00
.gitignore
.golangci.yml sys deps up (#8695) 2023-11-11 15:04:18 +03:00
go.mod build(deps): bump github.com/consensys/gnark-crypto from 0.12.0 to 0.12.1 in /erigon-lib (#8680) 2023-11-13 10:27:26 +01:00
go.sum build(deps): bump github.com/consensys/gnark-crypto from 0.12.0 to 0.12.1 in /erigon-lib (#8680) 2023-11-13 10:27:26 +01:00
LICENSE
Makefile ci: go mod tidy check (#8263) 2023-09-22 14:04:25 +07:00
README.md make: refactor erigon-lib make tasks (#8249) 2023-09-21 13:50:59 +02:00
rules.go fix-rules-typo (#8681) 2023-11-09 07:40:24 +03:00
tools.go Add 'erigon-lib/' from commit '93d9c9d9fe4bd8a49f7a98a6bce0f0da7094c7d3' 2023-09-20 14:50:25 +02:00

erigon-lib

Parts of Erigon codebase, written from scratch and licensed under Apache 2.0.

License requirements

erigon-lib dependencies use various open source licenses compatible with Apache 2.0. This is checked on CI using make lint-licenses.

In order to keep license purity it is not allowed to refer to the code in the erigon root module from erigon-lib. This is ensured by the go.mod separation.

It is not allowed to copy or move code from erigon to erigon-lib unless all original authors agree to relief the code license from GPL to Apache 2.0.

Code migration policy

It is encouraged to write new erigon code inside erigon-lib.

It is encouraged to move and relicense parts of the code from erigon to erigon-lib that are safe and easy to move. For example, code written from scratch by erigon core contributors that has no significant external contributions could be refactored and moved.