paritytech / polkadot-runtime-prom-exporter

Prometheus exporter for polkadot runtime metrics
10 stars 3 forks source link

Runtime-exporter crashes on startup "TypeError: weight.normal.toNumber is not a function" #35

Open PierreBesson opened 2 years ago

PierreBesson commented 2 years ago

The runtime-exporter crashes on startup with the following error:

 debug: no historical parachain settings for chain wss://westmint-rpc.polkadot.io config.json
runtime-exporter-polkadot-runtime-exporter-0 runtime-exporter [22-09-16 14:21:08] debug: error from main function Error: query.timestamp.now is not available in this version of the metadata
runtime-exporter-polkadot-runtime-exporter-0 runtime-exporter /usr/src/polkadot-prom-exporter/build/workers/systemWorker.js:181
runtime-exporter-polkadot-runtime-exporter-0 runtime-exporter             yield exporter.writeWeight(timestamp, chainName.toString(), weight.normal.toNumber(), 'normal', exporter.withProm);
runtime-exporter-polkadot-runtime-exporter-0 runtime-exporter                                                                                       ^
runtime-exporter-polkadot-runtime-exporter-0 runtime-exporter 
runtime-exporter-polkadot-runtime-exporter-0 runtime-exporter TypeError: weight.normal.toNumber is not a function
runtime-exporter-polkadot-runtime-exporter-0 runtime-exporter     at SystemExporter.<anonymous> (/usr/src/polkadot-prom-exporter/build/workers/systemWorker.js:181:87)
runtime-exporter-polkadot-runtime-exporter-0 runtime-exporter     at Generator.next (<anonymous>)
runtime-exporter-polkadot-runtime-exporter-0 runtime-exporter     at fulfilled (/usr/src/polkadot-prom-exporter/build/workers/systemWorker.js:28:58)
runtime-exporter-polkadot-runtime-exporter-0 runtime-exporter     at processTicksAndRejections (node:internal/process/task_queues:96:5)
- runtime-exporter-polkadot-runtime-exporter-0 › runtime-exporter

Config:

{
  "rpcs": [
    // Westend + Parachains
    "wss://westend-rpc.polkadot.io",
    "wss://westmint-rpc.polkadot.io",
    "wss://westend-collectives-rpc.polkadot.io",
    //Rococo + Parachains
    "wss://rococo-rpc.polkadot.io",
    "wss://rococo-statemint-rpc.polkadot.io",
    "wss://rococo-contracts-rpc.polkadot.io",
    "wss://rococo.api.encointer.org",
    "wss://rpc.composablefinance.ninja",
    "wss://nodle-paradis.api.onfinality.io/public-ws",
    "wss://rococo-rpc.snowbridge.network",
    "wss://rpc-01.basilisk-rococo.hydradx.io"
  ],
  "history": [
    {
        "chain": "wss://rococo-rpc.polkadot.io",
        "startingBlock": 11000000,
        "endingBlock": 10000000,
        "pallets": "",
        "distanceBetweenBlocks": []
    },
    {
        "chain": "wss://westend-rpc.polkadot.io",
        "startingBlock": 11000000,
        "endingBlock": 10000000,
        "pallets": "",
        "distanceBetweenBlocks": []
    }
  ]
}
kianenigma commented 2 years ago

this is due to the new weight update into a struct rather than a plain number.

https://github.com/paritytech/substrate/pull/10918#discussion_r815885876 https://forum.polkadot.network/t/weight-v2-discussion-and-updates/227

PierreBesson commented 1 year ago

This is now happening when connecting to Statemint RPC:


[22-10-18 12:30:44] info: connecting wss://rpc.polkadot.io to pallet nominationPools
[22-10-18 12:30:44] info: registering nominationPools exporter for chain Polkadot
[22-10-18 12:30:44] info: connecting to chain wss://statemint-rpc.polkadot.io
/usr/src/polkadot-prom-exporter/build/workers/systemWorker.js:181
            yield exporter.writeWeight(timestamp, chainName.toString(), weight.normal.toNumber(), 'normal', exporter.withProm);
                                                                                      ^

TypeError: weight.normal.toNumber is not a function
    at SystemExporter.<anonymous> (/usr/src/polkadot-prom-exporter/build/workers/systemWorker.js:181:87)
    at Generator.next (<anonymous>)
    at fulfilled (/usr/src/polkadot-prom-exporter/build/workers/systemWorker.js:28:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at runNextTicks (node:internal/process/task_queues:65:3)
    at processImmediate (node:internal/timers:437:9)
gilles437 commented 1 year ago

There is a fix for that with PR35, going to merge it

kianenigma commented 1 year ago

I don't see a PR 35, is it created yet?