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
32 changes: 32 additions & 0 deletions monitor/census.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ type (
mPaymentCreateError *stats.Int64Measure
mDeposit *stats.Float64Measure
mReserve *stats.Float64Measure
mMaxFloat *stats.Float64Measure
mTicketFaceValue *stats.Float64Measure
// Metrics for receiving payments
mTicketValueRecv *stats.Float64Measure
mTicketsRecv *stats.Int64Measure
Expand Down Expand Up @@ -341,6 +343,8 @@ func InitCensus(nodeType NodeType, version string) {
census.mPaymentCreateError = stats.Int64("payment_create_errors", "PaymentCreateError", "tot")
census.mDeposit = stats.Float64("gateway_deposit", "Current remaining deposit for the gateway node", "gwei")
census.mReserve = stats.Float64("gateway_reserve", "Current remaining reserve for the gateway node", "gwei")
census.mMaxFloat = stats.Float64("gateway_max_float", "Last maximum float for the gateway node", "gwei")
census.mTicketFaceValue = stats.Float64("ticket_face_value", "Last ticket face value for the gateway node", "gwei")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know much about maxFloat and ticketFace but I hope this is up to date - https://github.com/livepeer/go-livepeer/blob/master/doc/redeemer.md

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is up to date but its for running go-livepeer as a -redeemer. The downside to this is that the redeemer then becomes the central failure point because the Orchestrator then depends on it to get maxFloat.

I have a PR removing the dependency on my fork of go-livepeer so the redeemer only accepts tickets sent from the Orchestrator if interested.


// Metrics for receiving payments
census.mTicketValueRecv = stats.Float64("ticket_value_recv", "TicketValueRecv", "gwei")
Expand Down Expand Up @@ -770,6 +774,20 @@ func InitCensus(nodeType NodeType, version string) {
TagKeys: baseTagsWithEthAddr,
Aggregation: view.LastValue(),
},
{
Name: "gateway_max_float",
Measure: census.mMaxFloat,
Description: "Last maximum float for the gateway node",
TagKeys: baseTagsWithGatewayInfo,
Aggregation: view.LastValue(),
},
{
Name: "gateway_ticket_face_value",
Measure: census.mTicketFaceValue,
Description: "Last ticket face value for the gateway node",
TagKeys: baseTagsWithGatewayInfo,
Aggregation: view.LastValue(),
},
// TODO: Keep the old names for backwards compatibility, remove in the future
{
Name: "broadcaster_deposit",
Expand Down Expand Up @@ -1773,6 +1791,20 @@ func Reserve(sender string, reserve *big.Int) {
}
}

func MaxFloat(sender string, maxFloat *big.Int) {
if err := stats.RecordWithTags(census.ctx,
[]tag.Mutator{tag.Insert(census.kSender, sender)}, census.mMaxFloat.M(wei2gwei(maxFloat))); err != nil {
glog.Errorf("Error recording metrics err=%q", err)
}
}

func TicketFaceValue(sender string, faceValue *big.Int) {
if err := stats.RecordWithTags(census.ctx,
[]tag.Mutator{tag.Insert(census.kSender, sender)}, census.mTicketFaceValue.M(wei2gwei(faceValue))); err != nil {
glog.Errorf("Error recording metrics err=%q", err)
}
}

func MaxTranscodingPrice(maxPrice *big.Rat) {
floatWei, _ := maxPrice.Float64()
if err := stats.RecordWithTags(census.ctx,
Expand Down
5 changes: 5 additions & 0 deletions pm/recipient.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/golang/glog"
"github.com/livepeer/go-livepeer/monitor"
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -287,6 +288,10 @@ func (r *recipient) faceValue(sender ethcommon.Address) (*big.Int, error) {
faceValue = r.maxfacevalue
}
}
if monitor.Enabled {
monitor.TicketFaceValue(sender.Hex(), faceValue)
monitor.MaxFloat(sender.Hex(), maxFloat)
}
if faceValue.Cmp(r.cfg.EV) < 0 {
return nil, errInsufficientSenderReserve
}
Expand Down
Loading