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

services/horizon/internal: Add fee_charged and max_fee to /fee_stats endpoint #1964

Merged
merged 14 commits into from
Nov 28, 2019

Conversation

abuiles
Copy link
Contributor

@abuiles abuiles commented Nov 21, 2019

PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into two PRs
    otherwise).
  • This PR's title starts with name of package that is most changed in the PR, ex.
    services/friendbot, or all or doc if the changes are broad or impact many
    packages.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or fixes.
  • I've updated any docs (developer docs, .md
    files, etc... affected by this change). Take a look in the docs folder for a given service,
    like this one.

Release planning

  • I've updated the relevant CHANGELOG (here for Horizon) if
    needed with deprecations, added features, breaking changes, and DB schema changes.
  • I've decided if this PR requires a new major/minor version according to
    semver, or if it's mainly a patch change. The PR is targeted at the next
    release branch if it's not a patch change.

What

Display fees charged and max fee in /fee_stats endpoint. Fixes #1372

Why

We have a way now to display not only max_fee but also fee_charged data on the /fee_stats end-point. This PR adds info for both fields and at the same time schedules the old field for deprecation which had a confusing name as described #1372 (comment)

Known limitations

[TODO or N/A]

@abuiles abuiles requested a review from bartekn November 21, 2019 00:02
@cla-bot cla-bot bot added the cla: yes label Nov 21, 2019
@abuiles
Copy link
Contributor Author

abuiles commented Nov 21, 2019

@bartekn this cherry-picks on the work done in this PR #1953 -- you can ignore those changes for now.

ht.Assert.Equal(200, result.MaxFee.P95, "p95")
ht.Assert.Equal(200, result.MaxFee.P99, "p99")

ht.Assert.Equal(50, result.FeeCharged.Min, "min")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bartekn can fee_charged be lower than 50? If not, we probably should make an update on the fee_charged entries in this test scenario?

Copy link
Contributor

Choose a reason for hiding this comment

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

Have you found an answer to the question? I think the code is outdated so can't check it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bartekn yes, after scrolling around I came to the conclusion that it's done based on the data we have in the DB, which is fine then.

@abuiles
Copy link
Contributor Author

abuiles commented Nov 21, 2019

oh, I just realized I forgot to add max, will do that first thing in the morning.

@abuiles abuiles changed the title services/horizon/internal/web: Add fee_charged and max_fee to /fee_stats endpoint services/horizon/internal: Add fee_charged and max_fee to /fee_stats endpoint Nov 21, 2019
@abuiles abuiles requested a review from tamirms November 21, 2019 12:57
protocols/horizon/main.go Outdated Show resolved Hide resolved
Copy link
Contributor

@bartekn bartekn left a comment

Choose a reason for hiding this comment

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

We must fix type connected issues.

protocols/horizon/main.go Outdated Show resolved Hide resolved
services/horizon/internal/db2/history/operation.go Outdated Show resolved Hide resolved
services/horizon/internal/operationfeestats/main.go Outdated Show resolved Hide resolved
services/horizon/internal/actions_operation_fee_stats.go Outdated Show resolved Hide resolved
@@ -16,26 +17,35 @@ import (

var _ actions.JSONer = (*FeeStatsAction)(nil)

// this struct is very similar to hProtocol.feeStats but drops the usage of int
// in favor of int64
type feeStats struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a temporary workaround while we update hProtocol.FeeStats

@abuiles abuiles requested a review from bartekn November 26, 2019 20:05
@abuiles
Copy link
Contributor Author

abuiles commented Nov 26, 2019

@bartekn I addressed your comments, thanks!

@bartekn
Copy link
Contributor

bartekn commented Nov 28, 2019

@abuiles FYI, changed LastLedger type to uint32: 1df8d94.

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.

4 participants