55 "fmt"
66 "os"
77 "path/filepath"
8- "time"
98
109 "github.com/rs/zerolog/log"
1110 config "github.com/thirdweb-dev/indexer/configs"
@@ -47,14 +46,6 @@ func Init() {
4746 // streaming channels
4847 blockDataChannel = make (chan * BlockDataWithSize )
4948 downloadedFilePathChannel = make (chan string , config .Cfg .StagingS3MaxParallelFileDownload )
50-
51- // Initialize committer metrics
52- chainIdStr := libs .ChainIdStr
53- indexerName := config .Cfg .ZeetProjectName
54-
55- // Set static metrics
56- metrics .CommitterIndexerName .WithLabelValues (indexerName , chainIdStr , indexerName ).Set (1 )
57- metrics .CommitterChainId .WithLabelValues (indexerName , chainIdStr ).Set (float64 (libs .ChainId .Uint64 ()))
5849}
5950
6051func CommitStreaming () error {
@@ -124,10 +115,6 @@ func getLastTrackedBlockNumberAndBlockRangesFromS3() (int64, []types.BlockRange,
124115}
125116
126117func downloadFilesForBlockRange (blockRanges []types.BlockRange ) {
127- // Initialize metrics labels
128- chainIdStr := libs .ChainIdStr
129- indexerName := config .Cfg .ZeetProjectName
130-
131118 for i , blockRange := range blockRanges {
132119 log .Info ().
133120 Int ("processing" , i + 1 ).
@@ -137,22 +124,13 @@ func downloadFilesForBlockRange(blockRanges []types.BlockRange) {
137124 Uint64 ("end_block" , blockRange .EndBlock ).
138125 Msg ("Starting download" )
139126
140- // Track S3 download timing
141- start := time .Now ()
142127 filePath , err := libs .DownloadFile (tempDir , & blockRange )
143- downloadDuration := time .Since (start )
144-
145- // Update S3 download timing metric
146- metrics .CommitterS3DownloadDuration .WithLabelValues (indexerName , chainIdStr ).Observe (downloadDuration .Seconds ())
147128
148129 if err != nil {
149130 log .Panic ().Err (err ).Str ("file" , blockRange .S3Key ).Msg ("Failed to download file" )
150131 }
151132
152133 downloadedFilePathChannel <- filePath
153-
154- // Update committer metrics
155- updateCommitterMetrics ()
156134 }
157135 log .Info ().Msg ("All downloads completed, closing download channel" )
158136}
@@ -172,19 +150,3 @@ func acquireMemoryPermit(size uint64) (bool, error) {
172150func releaseMemoryPermit (size uint64 ) {
173151 memorySemaphore .Release (int64 (size ))
174152}
175-
176- // Helper function to update committer metrics
177- func updateCommitterMetrics () {
178- chainIdStr := libs .ChainIdStr
179- indexerName := config .Cfg .ZeetProjectName
180-
181- // Update channel lengths
182- metrics .CommitterDownloadedFilePathChannelLength .WithLabelValues (indexerName , chainIdStr ).Set (float64 (len (downloadedFilePathChannel )))
183- metrics .CommitterBlockDataChannelLength .WithLabelValues (indexerName , chainIdStr ).Set (float64 (len (blockDataChannel )))
184-
185- // Update memory permit bytes (current held memory)
186- metrics .CommitterMemoryPermitBytes .WithLabelValues (indexerName , chainIdStr ).Set (float64 (memorySemaphore .held ))
187-
188- // Update next block number
189- metrics .CommitterNextBlockNumber .WithLabelValues (indexerName , chainIdStr ).Set (float64 (nextBlockNumber ))
190- }
0 commit comments