Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update ticket received log line to be summary of tickets #2907

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

ad-astra-video
Copy link
Contributor

What does this pull request do? Explain your changes. (required)
Moves Receiving ticket log line to be summary log line of tickets processed. Was a debug log line that printed for each ticket processed.

Specific updates (required)

  • one file updated

How did you test each of these updates (required)
@papabear99 ran similar version on mainnet

Does this pull request close any open issues?
No

Checklist:

Copy link

codecov bot commented Nov 13, 2023

Codecov Report

Merging #2907 (7fdbde8) into master (b17a70d) will increase coverage by 0.02435%.
The diff coverage is 100.00000%.

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #2907         +/-   ##
===================================================
+ Coverage   56.51727%   56.54162%   +0.02435%     
===================================================
  Files             89          89                 
  Lines          19456       19460          +4     
===================================================
+ Hits           10996       11003          +7     
+ Misses          7852        7849          -3     
  Partials         608         608                 
Files Coverage Δ
core/orchestrator.go 76.99468% <100.00000%> (+0.12302%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b17a70d...7fdbde8. Read the comment docs.

Files Coverage Δ
core/orchestrator.go 76.99468% <100.00000%> (+0.12302%) ⬆️

... and 1 file with indirect coverage changes

Copy link
Contributor

@leszko leszko left a comment

Choose a reason for hiding this comment

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

@ad-astra-video Added a comment. Thanks for the PR.

@@ -198,6 +198,8 @@ func (orch *orchestrator) ProcessPayment(ctx context.Context, payment net.Paymen
ev := ticket.EV()
orch.node.Balances.Credit(sender, manifestID, ev)
totalEV.Add(totalEV, ev)
totalFaceValue.Add(totalFaceValue, ticket.FaceValue)
totalWinProb.Add(totalWinProb, ticket.WinProbRat())
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. So, we never set those to 0 again and the log will always show the cumulative tickets?
  2. I wonder how much sense it takes to add the probabilities and face values together? What this information actually may give you?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. These variables are initialized in the ProcessPayment function so start at 0 every time. The log line is intended to show the cumulative amounts for the tickets (face value/win prob/ev).
  2. To me, this is a debug log line so more info is likely better right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, you're right. I missed that part that they are initialized for each payment processing. Thansk for the explanation!

@@ -198,6 +198,8 @@ func (orch *orchestrator) ProcessPayment(ctx context.Context, payment net.Paymen
ev := ticket.EV()
orch.node.Balances.Credit(sender, manifestID, ev)
totalEV.Add(totalEV, ev)
totalFaceValue.Add(totalFaceValue, ticket.FaceValue)
totalWinProb.Add(totalWinProb, ticket.WinProbRat())
Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh, you're right. I missed that part that they are initialized for each payment processing. Thansk for the explanation!

@leszko leszko merged commit ddd7e7e into livepeer:master Nov 16, 2023
16 of 17 checks passed
@stronk-dev
Copy link
Contributor

Shouldn't winProb be the average win prob rather than the sum?

@ad-astra-video
Copy link
Contributor Author

Shouldn't winProb be the average win prob rather than the sum?

I don't think the average gets you to the faceValue mathematically. Also, wouldn't the average be the winProb of one ticket in the batch? The way I looked at it was ten tickets at 10 gwei gets 100 gwei in tickets with a cumulative winProb of .000008333. 100 gwei / .000008333 / 1,000,000 = .012 ETH.

@stronk-dev
Copy link
Contributor

stronk-dev commented Dec 8, 2023

What does the sum of winProb or faceValue represent? These are per ticket params
If you earn 10 tickets of 0.12FV and 10% win percentage, that's not equivalent to 1 ticket of 1.2FV and 100% win percentage. Only the total EV makes sense to sum up for a summary, ie:

Payment tickets processed 10 tickets with average faceValue=1.2, winProb=10%, ev=0.12 for a total EV of 1.2

@ad-astra-video
Copy link
Contributor Author

OK, see now. I was approaching from the reverse starting with EV / total win prob. I have no issue removing the winProb and faceValue totals. Was just trying to reduce the spam in logs from ticket processing on debug log level. Will get PR in at some point.

@stronk-dev
Copy link
Contributor

i mean it's good to reduce logging, i just brought it up cause the change breaks this panel of mine (since there's no way to translate the sums back to a per-ticket basis with the new log format):
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants