Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/new-jokes-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/data-transport-layer': patch
---

Add new metrics to the data-transport-layer
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BigNumber } from 'ethers'
import { LevelUp } from 'levelup'
import axios from 'axios'
import bfj from 'bfj'
import { Gauge } from 'prom-client'
import { Gauge, Histogram } from 'prom-client'

/* Imports: Internal */
import { handleSequencerBlock } from './handlers/transaction'
Expand All @@ -16,6 +16,7 @@ import { L1DataTransportServiceOptions } from '../main/service'

interface L2IngestionMetrics {
highestSyncedL2Block: Gauge<string>
fetchBlocksRequestTime: Histogram<string>
}

const registerMetrics = ({
Expand All @@ -27,6 +28,12 @@ const registerMetrics = ({
help: 'Highest Synced L2 Block Number',
registers: [registry],
}),
fetchBlocksRequestTime: new client.Histogram({
name: 'data_transport_layer_fetch_blocks_time',
help: 'Amount of time fetching remote L2 blocks takes',
buckets: [0.1, 5, 15, 50, 100, 500],
registers: [registry],
}),
})

export interface L2IngestionServiceOptions
Expand Down Expand Up @@ -240,6 +247,8 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {
)
}

const end = this.l2IngestionMetrics.fetchBlocksRequestTime.startTimer()

const resp = await axios.post(
this.state.l2RpcProvider.connection.url,
req,
Expand All @@ -249,6 +258,8 @@ export class L2IngestionService extends BaseService<L2IngestionServiceOptions> {
yieldRate: 4096, // this yields abit more often than the default of 16384
})

end()

result = respJson.result
if (result === null) {
retry++
Expand Down
4 changes: 4 additions & 0 deletions packages/data-transport-layer/src/services/main/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ export class L1DataTransportService extends BaseService<L1DataTransportServiceOp
}
})

this.state.metrics.client.collectDefaultMetrics({
prefix: 'data_transport_layer_'
})

this.state.failureCounter = new this.state.metrics.client.Counter({
name: 'data_transport_layer_main_service_failures',
help: 'Counts the number of times that the main service fails',
Expand Down