mirror of
https://github.com/cirocosta/monero-exporter.git
synced 2025-01-02 11:36:17 -05:00
wip
Signed-off-by: Ciro S. Costa <utxobr@protonmail.com>
This commit is contained in:
parent
3959d63fd3
commit
9b1bd4ee64
@ -1,16 +1,16 @@
|
||||
apiVersion: kbld.k14s.io/v1alpha1
|
||||
kind: Config
|
||||
minimumRequiredVersion: 0.30.0
|
||||
minimumRequiredVersion: develop
|
||||
overrides:
|
||||
- image: monero-exporter
|
||||
newImage: index.docker.io/utxobr/monero-exporter@sha256:737413b1054583535e835e1417b61a8d59a4c08723e4a15c61c4249c2a7d69a4
|
||||
newImage: index.docker.io/utxobr/monero-exporter@sha256:2772b74aa89c4ec01c4032b96c4fea45c7d8a24183f40404773d68049d093451
|
||||
preresolved: true
|
||||
- image: monero-exporter-grafana
|
||||
newImage: index.docker.io/utxobr/monero-exporter-grafana@sha256:0e9f595487e7ee07f9059f75c302ce56fbe559074c0ba95a1d46a9a3c1c859a2
|
||||
newImage: index.docker.io/utxobr/monero-exporter-grafana@sha256:5f8ec91d95491d1912a5e2fed5eadbe19160e69336e30f02c8f78a1a01ba80ef
|
||||
preresolved: true
|
||||
- image: monero-exporter-monerod
|
||||
newImage: index.docker.io/utxobr/monero-exporter-monerod@sha256:19d889447ba4f703957d952ac753b330d5a2d7e324c98eac1f0f3d8bf2744817
|
||||
newImage: index.docker.io/utxobr/monero-exporter-monerod@sha256:c821833ca024a0ccb74e467054f4b7842d641d854062b0cc0d80d20a71d69339
|
||||
preresolved: true
|
||||
- image: monero-exporter-prometheus
|
||||
newImage: index.docker.io/utxobr/monero-exporter-prometheus@sha256:21fcd719c6a3c8de35d513887e6666a5c49a15be742e328c034511cd60b5573e
|
||||
newImage: index.docker.io/utxobr/monero-exporter-prometheus@sha256:bdc0a4e9c1bb6d7ddc65051fecc948b03efacae2c49261c44efccabe2f5912d8
|
||||
preresolved: true
|
||||
|
@ -36,7 +36,7 @@ services:
|
||||
- --rpc-bind-ip=127.0.0.1
|
||||
- --rpc-bind-port=18081
|
||||
- --rpc-restricted-bind-ip=0.0.0.0
|
||||
- --rpc-restricted-bind-port=18089
|
||||
- --rpc-restricted-bind-pmort=18089
|
||||
|
||||
monero-exporter:
|
||||
container_name: monero-exporter
|
||||
@ -54,7 +54,7 @@ services:
|
||||
command:
|
||||
- --config.file=/etc/prometheus/config.yaml
|
||||
- --storage.tsdb.path=/data
|
||||
- --storage.tsdb.retention.time=30d
|
||||
- --storage.tsdb.retention.time=90d
|
||||
|
||||
grafana:
|
||||
container_name: grafana
|
||||
|
@ -22,11 +22,11 @@ services:
|
||||
- --check-updates=disabled
|
||||
- --data-dir=/data
|
||||
- --enforce-dns-checkpointing
|
||||
- --in-peers=1024
|
||||
- --in-peers=2048
|
||||
- --limit-rate=999999
|
||||
- --no-igd
|
||||
- --no-zmq
|
||||
- --out-peers=32
|
||||
- --out-peers=64
|
||||
- --p2p-bind-ip=0.0.0.0
|
||||
- --p2p-bind-port=18080
|
||||
- --public-node
|
||||
@ -35,7 +35,7 @@ services:
|
||||
- --rpc-restricted-bind-ip=0.0.0.0
|
||||
- --rpc-restricted-bind-port=18089
|
||||
container_name: monerod
|
||||
image: index.docker.io/utxobr/monero-exporter-monerod@sha256:19d889447ba4f703957d952ac753b330d5a2d7e324c98eac1f0f3d8bf2744817
|
||||
image: index.docker.io/utxobr/monero-exporter-monerod@sha256:15a70938c401a744b34d278fa345fb2e66fae8b428929ae52f1cea455e5bfcd9
|
||||
ports:
|
||||
- 18080:18080
|
||||
- 18089:18089
|
||||
@ -45,7 +45,7 @@ services:
|
||||
command:
|
||||
- --config.file=/etc/prometheus/config.yaml
|
||||
- --storage.tsdb.path=/data
|
||||
- --storage.tsdb.retention.time=30d
|
||||
- --storage.tsdb.retention.time=180d
|
||||
container_name: prometheus
|
||||
image: index.docker.io/utxobr/monero-exporter-prometheus@sha256:21fcd719c6a3c8de35d513887e6666a5c49a15be742e328c034511cd60b5573e
|
||||
volumes:
|
||||
|
@ -4,8 +4,8 @@ ARG RUNTIME_IMAGE=gcr.io/distroless/base@sha256:97f9cbf81590c7dd878d7e10c20116fa
|
||||
|
||||
FROM $BUILDER_IMAGE AS builder
|
||||
|
||||
ARG MONERO_VERSION=0.17.2.0
|
||||
ARG MONERO_SHA256=59e16c53b2aff8d9ab7a8ba3279ee826ac1f2480fbb98e79a149e6be23dd9086
|
||||
ARG MONERO_VERSION=0.17.3.0
|
||||
ARG MONERO_SHA256=ac18ce3d1189410a5c175984827d5d601974733303411f6142296d647f6582ce
|
||||
|
||||
RUN set -ex && \
|
||||
apt update && \
|
||||
|
@ -99,16 +99,24 @@ func (c *LastBlockStatsCollector) fetchData(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (c *LastBlockStatsCollector) collectBlockSize() {
|
||||
desc := prometheus.NewDesc(
|
||||
c.metricsC <- prometheus.MustNewConstMetric(
|
||||
prometheus.NewDesc(
|
||||
"monero_lastblock_size_bytes",
|
||||
"total size of the last block",
|
||||
nil, nil,
|
||||
),
|
||||
prometheus.GaugeValue,
|
||||
float64(c.header.BlockSize),
|
||||
)
|
||||
|
||||
c.metricsC <- prometheus.MustNewConstMetric(
|
||||
desc,
|
||||
prometheus.NewDesc(
|
||||
"monero_lastblock_weight_bytes",
|
||||
"total weight of the last block",
|
||||
nil, nil,
|
||||
),
|
||||
prometheus.GaugeValue,
|
||||
float64(c.header.BlockSize),
|
||||
float64(c.header.BlockWeight),
|
||||
)
|
||||
}
|
||||
|
||||
@ -236,6 +244,55 @@ func (c *LastBlockStatsCollector) collectTransactionsSize() {
|
||||
)
|
||||
}
|
||||
|
||||
// - transaction weight for a miner transaciton or a normal transaction with
|
||||
// two outputs is equal to the size in bytes.
|
||||
// - a bulletproof occupies ((2*[log_2(64p)]+9)*32) bytes
|
||||
//
|
||||
//
|
||||
// ref: https://github.com/monero-project/monero/blob/a9cb4c082f1a815076674b543d93159a2137540e/src/cryptonote_basic/cryptonote_format_utils.cpp#L106
|
||||
//
|
||||
func (c *LastBlockStatsCollector) computeTransactionWeight(idx int) float64 {
|
||||
const bpBase uint = 368
|
||||
|
||||
txn := c.txns[idx]
|
||||
txnSize := uint(c.txnSizes[idx])
|
||||
|
||||
numberOfOutputs := uint(len(txn.Vout))
|
||||
if numberOfOutputs <= 2 {
|
||||
return float64(txnSize)
|
||||
}
|
||||
|
||||
nlr := uint(0)
|
||||
for {
|
||||
if (1 << nlr) < numberOfOutputs {
|
||||
break
|
||||
}
|
||||
nlr++
|
||||
}
|
||||
nlr += 6
|
||||
|
||||
bpSize := 32 * (9 + 2*nlr)
|
||||
bpClawback := (bpBase*numberOfOutputs - bpSize) * 4 / 5
|
||||
|
||||
return float64(txnSize + bpClawback)
|
||||
}
|
||||
|
||||
func (c *LastBlockStatsCollector) collectTransactionsWeight() {
|
||||
summary := NewSummary()
|
||||
for idx := range c.txnSizes {
|
||||
summary.Insert(c.computeTransactionWeight(idx))
|
||||
}
|
||||
|
||||
c.metricsC <- prometheus.MustNewConstSummary(
|
||||
prometheus.NewDesc(
|
||||
"monero_lastblock_transactions_weight_bytes",
|
||||
"distribution of the weight of the transactions included",
|
||||
nil, nil,
|
||||
),
|
||||
summary.Count(), summary.Sum(), summary.Quantiles(),
|
||||
)
|
||||
}
|
||||
|
||||
func (c *LastBlockStatsCollector) collectTransactionsInputs() {
|
||||
summary := NewSummary()
|
||||
for _, txn := range c.txns {
|
||||
|
Loading…
Reference in New Issue
Block a user