Skip to content

Commit

Permalink
Address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiggoha committed Apr 9, 2024
1 parent 6a393ad commit 8a53ccf
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cmd/internal/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ var (
},
[]string{"witness_id"},
)
counterCheckpointUpdateSuccess = promauto.NewCounter(prometheus.CounterOpts{
Name: "distributor_update_checkpoint_success",
Help: "The total number of successful requests to update a checkpoint",
})

counterCheckpointUpdateSuccess = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "distributor_update_checkpoint_success",
Help: "The total number of successful requests to update a checkpoint",
},
[]string{"witness_id"},
)
counterCheckpointGetNRequests = promauto.NewCounter(prometheus.CounterOpts{
Name: "distributor_get_checkpoint_n_request",
Help: "The total number of requests to GetCheckpointN",
Expand Down Expand Up @@ -165,8 +167,6 @@ func (d *Distributor) GetCheckpointWitness(ctx context.Context, logID, witID str
// by both the log and the witness specified, and be larger than any previous checkpoint distributed
// for this pair.
func (d *Distributor) Distribute(ctx context.Context, logID, witID string, nextRaw []byte) error {
counterCheckpointUpdateRequests.WithLabelValues(witID).Inc()

l, ok := d.ls[logID]
if !ok {
return status.Errorf(codes.InvalidArgument, "unknown unknown log ID %q", logID)
Expand All @@ -175,6 +175,8 @@ func (d *Distributor) Distribute(ctx context.Context, logID, witID string, nextR
if !ok {
return status.Errorf(codes.InvalidArgument, "unknown witness ID %q", witID)
}
counterCheckpointUpdateRequests.WithLabelValues(witID).Inc()

newCP, _, n, err := log.ParseCheckpoint(nextRaw, l.Origin, l.Verifier, wv)
if err != nil {
return status.Errorf(codes.InvalidArgument, "failed to parse checkpoint: %v", err)
Expand Down

0 comments on commit 8a53ccf

Please sign in to comment.