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

Finish refactoring of provider/network statistic #665

Open
4 tasks
stalniy opened this issue Jan 17, 2025 · 0 comments
Open
4 tasks

Finish refactoring of provider/network statistic #665

stalniy opened this issue Jan 17, 2025 · 0 comments

Comments

@stalniy
Copy link
Contributor

stalniy commented Jan 17, 2025

Why

Currently provider statistic is aggregate per type (e.g., activeStats, pendingStats) and it makes it harder to work with this data structure. It's harder to pass all needed details for one entry. For example, to display (or to work with) CPU/GPU related information I need the whole Provider because their stat values are in 3 different objects.

That's why I'd like to change how it's aggregated, better to aggregate per metric and then each metric has all needed values inside. Additionally, this helps to manage changes because if we want to remove metric - we remove it from single place (not in many other objects). If we want to add metric, it's also easy

What

New stats object:

type newStats = {
  cpu: {
     available: number;
     pending: number;
     active: number;
  };
  gpu: {
     available: number;
     pending: number;
     active: number;
  };
  // etc
}

Currently used stats object:

type currentlyUsedOne = {
  activeStats: {
     cpu: number;
     gpu: number;
     // ....
  };
  pendingStats: {
     cpu: number;
     gpu: number;
     // ....
  };
  availableStats: : {
     cpu: number;
     gpu: number;
     // ....
  };
}

DO NOT remove the previous ones immediately, because some people may use cached version of console-web. Keep old values in place for a week or so

Acceptance

  • /network-capacity route should change response to match new structure
  • /providers/{address} should expose new stats property that adheres to the new shape above
  • /providers should expose new stats property that adheres to the new shape above
  • remove old fields
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

No branches or pull requests

1 participant