Skip to content

Commit

Permalink
Fix transcoding price metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
leszko committed Apr 10, 2024
1 parent eb25467 commit b8f4d1c
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions monitor/census.go
Original file line number Diff line number Diff line change
Expand Up @@ -1551,14 +1551,12 @@ func Reserve(sender string, reserve *big.Int) {
}

func MaxTranscodingPrice(maxPrice *big.Rat) {
floatWei, ok := maxPrice.Float64()
if ok {
if err := stats.RecordWithTags(census.ctx,
[]tag.Mutator{tag.Insert(census.kSender, "max")},
census.mTranscodingPrice.M(floatWei)); err != nil {
floatWei, _ := maxPrice.Float64()
if err := stats.RecordWithTags(census.ctx,
[]tag.Mutator{tag.Insert(census.kSender, "max")},
census.mTranscodingPrice.M(floatWei)); err != nil {

Check warning on line 1557 in monitor/census.go

View check run for this annotation

Codecov / codecov/patch

monitor/census.go#L1554-L1557

Added lines #L1554 - L1557 were not covered by tests

glog.Errorf("Error recording metrics err=%q", err)
}
glog.Errorf("Error recording metrics err=%q", err)

Check warning on line 1559 in monitor/census.go

View check run for this annotation

Codecov / codecov/patch

monitor/census.go#L1559

Added line #L1559 was not covered by tests
}
}

Expand Down Expand Up @@ -1672,15 +1670,13 @@ func MaxGasPrice(maxGasPrice *big.Int) {

// TranscodingPrice records the last transcoding price
func TranscodingPrice(sender string, price *big.Rat) {
floatWei, ok := price.Float64()
if ok {
stats.Record(census.ctx, census.mTranscodingPrice.M(floatWei))
if err := stats.RecordWithTags(census.ctx,
[]tag.Mutator{tag.Insert(census.kSender, sender)},
census.mTranscodingPrice.M(floatWei)); err != nil {
floatWei, _ := price.Float64()
stats.Record(census.ctx, census.mTranscodingPrice.M(floatWei))
if err := stats.RecordWithTags(census.ctx,
[]tag.Mutator{tag.Insert(census.kSender, sender)},
census.mTranscodingPrice.M(floatWei)); err != nil {

Check warning on line 1677 in monitor/census.go

View check run for this annotation

Codecov / codecov/patch

monitor/census.go#L1673-L1677

Added lines #L1673 - L1677 were not covered by tests

glog.Errorf("Error recording metrics err=%q", err)
}
glog.Errorf("Error recording metrics err=%q", err)

Check warning on line 1679 in monitor/census.go

View check run for this annotation

Codecov / codecov/patch

monitor/census.go#L1679

Added line #L1679 was not covered by tests
}
}

Expand Down

0 comments on commit b8f4d1c

Please sign in to comment.