pendulum-chain / pendulum-squids

The subsquid squids we use for Pendulum/Amplitude/Foucoco.
GNU General Public License v3.0
0 stars 0 forks source link

Provide block latency data in squid #13

Closed ebma closed 6 months ago

ebma commented 9 months ago

Context

For monitoring purposes, we want to be able to query data about the average block latency from our squids.

TODO

Instead of only considering the latency of the last produced block, we want to query the average block latency over some number of blocks. This number should be a configurable variable, and we will set it to 20 for now, such that the latency of the last 20 blocks is considered. To calculate the block latency, on every new block, we should query the on-chain storage of Timestamp.Now and compare it to the timestamp of the last block. To achieve this we would need to:

I would suggest something like the following schema. The naming etc can still be improved but I would imagine it to look similar:

type TimeStamp @entity {
  id: ID!
  blockNumber: BigInt!
  timestamp: DateTime!
}

type LatencyInfo @entity {
   last20Blocks: [TimeStamp!]! // we store the timestamp data of the last 20 blocks in this attribute
   averageLatency: BigInt! // This is calculated based on the `last20Blocks`, but we have to add it to this entity here so that it's easier to query
}
ebma commented 9 months ago

@pendulum-chain/product I created this ticket as it is required to solve this issue ticket. I'm not sure which epic I should assign it to.

vadaynujra commented 9 months ago

@ebma @prayagd should we have an epic regarding Devops enhancements or similar and assign such tickets to it?

ebma commented 9 months ago

Uhm yeah sure, we could do something like that. But this epic would then go on forever, not sure if that's a problem?

prayagd commented 8 months ago

Hey team! Please add your planning poker estimate with Zenhub @b-yap @ebma @gianfra-t @TorstenStueber

prayagd commented 6 months ago

@ebma if this is not urgent should i move this to icebox?

ebma commented 6 months ago

Since this ticket is required for https://github.com/pendulum-chain/tasks/issues/56 I'd only move it to the icebox if you think that https://github.com/pendulum-chain/tasks/issues/56 is not important right now.

prayagd commented 6 months ago

@ebma i assume this would indirectly help in the determining the inactive collators right? If yes then i would keep this here

ebma commented 6 months ago

Yes 👍

TorstenStueber commented 6 months ago

@prayagd I think that this ticket is fairly important and should not be moved to icebox but should be prioritized instead.

TorstenStueber commented 6 months ago

@prayagd can we move this to Ready then?

ebma commented 6 months ago

Let's also close this ticket as the one it was required for was closed https://github.com/pendulum-chain/tasks/issues/56#issuecomment-1864042489.

TorstenStueber commented 6 months ago

Sure, then we can actually close it.