fork of indigo with slightly nicer lexgen

Track disk vs meta write durations

Changed files
+22
carstore
+4
carstore/bs.go
··· 645 645 offset += nw 646 646 } 647 647 648 + start := time.Now() 648 649 path, err := cs.writeNewShardFile(ctx, user, seq, buf.Bytes()) 649 650 if err != nil { 650 651 return nil, fmt.Errorf("failed to write shard file: %w", err) 651 652 } 653 + writeShardFileDuration.Observe(time.Since(start).Seconds()) 652 654 653 655 shard := CarShard{ 654 656 Root: models.DbCID{CID: root}, ··· 659 661 Rev: rev, 660 662 } 661 663 664 + start = time.Now() 662 665 if err := cs.putShard(ctx, &shard, brefs, rmcids, false); err != nil { 663 666 return nil, err 664 667 } 668 + writeShardMetadataDuration.Observe(time.Since(start).Seconds()) 665 669 666 670 return buf.Bytes(), nil 667 671 }
+18
carstore/metrics.go
··· 1 + package carstore 2 + 3 + import ( 4 + "github.com/prometheus/client_golang/prometheus" 5 + "github.com/prometheus/client_golang/prometheus/promauto" 6 + ) 7 + 8 + var writeShardFileDuration = promauto.NewHistogram(prometheus.HistogramOpts{ 9 + Name: "carstore_write_shard_file_duration", 10 + Help: "Duration of writing shard file to disk", 11 + Buckets: prometheus.ExponentialBuckets(0.001, 2, 15), 12 + }) 13 + 14 + var writeShardMetadataDuration = promauto.NewHistogram(prometheus.HistogramOpts{ 15 + Name: "carstore_write_shard_metadata_duration", 16 + Help: "Duration of writing shard metadata to DB", 17 + Buckets: prometheus.ExponentialBuckets(0.001, 2, 15), 18 + })