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

add user usage detail in nodes #233

Merged
merged 1 commit into from
May 4, 2023
Merged

add user usage detail in nodes #233

merged 1 commit into from
May 4, 2023

Conversation

zhongfq
Copy link
Contributor

@zhongfq zhongfq commented May 2, 2023

  1. add usage detail icon in left-bottom
    IMG_0650

  2. toggle show usage in nodes.
    IMG_0652

  3. node usages(in menu list)
    IMG_4DF7188E2623-1

@s4I3h
Copy link

s4I3h commented May 2, 2023

@zhongfq

@M03ED
Copy link
Collaborator

M03ED commented May 2, 2023

wow , you make my idea and did it really fast , i didn't you could do this at short time.
thanks man.

@SaintShit
Copy link
Contributor

it's working like clockwork! great job on the changes.

@zhongfq
Copy link
Contributor Author

zhongfq commented May 3, 2023

wow , you make my idea and did it really fast , i didn't you could do this at short time.
thanks man.

this feature is not difficult to implement

@meaqese
Copy link
Contributor

meaqese commented May 3, 2023

wow , you make my idea and did it really fast , i didn't you could do this at short time.
thanks man.

this feature is not difficult to implement

+2065 lines....

@SaintShit
Copy link
Contributor

Hello again, I'm going to make some changes in user_usages table
I want to change it's name to node_user_usages
change the user_id to user_username to be more straight for the recording job. and some other minor changes. just wanted to let u know, u might run alembic downgrade -1 once and then upgrade again

@M03ED
Copy link
Collaborator

M03ED commented May 3, 2023

Can you add period choose ?
Past 24H
7 days
30 days
And numbers like this

@zhongfq
Copy link
Contributor Author

zhongfq commented May 3, 2023

Hello again, I'm going to make some changes in user_usages table
I want to change it's name to node_user_usages
change the user_id to user_username to be more straight for the recording job. and some other minor changes. just wanted to let u know, u might run alembic downgrade -1 once and then upgrade again

OK

@zhongfq
Copy link
Contributor Author

zhongfq commented May 3, 2023

@SaintShit because the master and slave node are very similar, can let master be used as node 0(nodeid=0) to simplify statistics?

@zhongfq
Copy link
Contributor Author

zhongfq commented May 3, 2023

Can you add period choose ?
Past 24H
7 days
30 days
And numbers like this

Finish the current pull request first, and I will try implement it later.

@ArshaShokri
Copy link

WOW Great Job!
I'll be very appreciate if you also add usage multiplier for nodes
Like if you use 1gb from Germany node get 1gb from users traffic but if you use 1gb from United States node use 3gb from users traffic
It's good for different data centers like in hetzner you get 20tb traffic with 4$ but in digitalocean you get only 500gb

@SaintShit
Copy link
Contributor

@SaintShit because the master and slave node are very similar, can let master be used as node 0(nodeid=0) to simplify statistics?

I think the way you implemented this is OK
I'm running into some bugs and trying to figure it out why this is happening

image
like this, after reseting users' usage, this happens

@SaintShit
Copy link
Contributor

I was thinking about the best way to upsert to NodeUserUsages table, looks like we have no way except checking the not existing rows before the update query. I'm going to merge the current changes and then debug these.

@SaintShit SaintShit merged commit 42f1592 into Gozargah:dev May 4, 2023
@zhongfq
Copy link
Contributor Author

zhongfq commented May 4, 2023

I was thinking about the best way to upsert to NodeUserUsages table, looks like we have no way except checking the not existing rows before the update query. I'm going to merge the current changes and then debug these.

I think we can cache the key(username + "|" + node_id),it check only once

@zhongfq
Copy link
Contributor Author

zhongfq commented May 4, 2023

@SaintShit because the master and slave node are very similar, can let master be used as node 0(nodeid=0) to simplify statistics?

I think the way you implemented this is OK I'm running into some bugs and trying to figure it out why this is happening

image like this, after reseting users' usage, this happens

I test is now

@SaintShit
Copy link
Contributor

I was thinking about the best way to upsert to NodeUserUsages table, looks like we have no way except checking the not existing rows before the update query. I'm going to merge the current changes and then debug these.

I think we can cache the key(username + "|" + node_id),it check only once

Hmmm right, let's see if the current changes works well in large scale or not, if not, we'll add Redis. it will be used in other parts of code too ;D

@zhongfq
Copy link
Contributor Author

zhongfq commented May 4, 2023

@SaintShit because the master and slave node are very similar, can let master be used as node 0(nodeid=0) to simplify statistics?

I think the way you implemented this is OK I'm running into some bugs and trying to figure it out why this is happening

image like this, after reseting users' usage, this happens

I do check in my compute, it is ok. func 'reset_all_users_data_usage' is not clear the nodes and system stat, so I think it will not affect the nodes usages

@SaintShit
Copy link
Contributor

@SaintShit because the master and slave node are very similar, can let master be used as node 0(nodeid=0) to simplify statistics?

I think the way you implemented this is OK I'm running into some bugs and trying to figure it out why this is happening
image like this, after reseting users' usage, this happens

I do check in my compute, it is ok. func 'reset_all_users_data_usage' is not clear the nodes and system stat, so I think it will not affect the nodes usages

image
image

@zhongfq
Copy link
Contributor Author

zhongfq commented May 4, 2023

image image

master = user - germany

so may be user stat is not correct

@SaintShit
Copy link
Contributor

Yes, used_traffic has been reset, but node usages has not been reset. I'll check this now

@SaintShit
Copy link
Contributor

image image

master = user - germany

so may be user stat is not correct

Now node_usages will reset too
15964ce

@zhongfq
Copy link
Contributor Author

zhongfq commented May 4, 2023

Now node_usages will reset too 15964ce

I have a question is, why when cleaning all users uages , do we not clean system usage and nodes usage in node table ?

@SaintShit
Copy link
Contributor

Now node_usages will reset too 15964ce

I have a question is, why when cleaning all users uages , do we not clean system usage and nodes usage in node table ?

Actually they're not the total usage of users, they are the amount of data that has passed through the outbounds. why should we reset them?

@zhongfq
Copy link
Contributor Author

zhongfq commented May 4, 2023

Actually they're not the total usage of users, they are the amount of data that has passed through the outbounds. why should we reset them?

for example, hire vps in linode or other cloud sever, there have usage limitation in one month, usually reset at next month, so I can see how usage used in current period.

@SaintShit
Copy link
Contributor

SaintShit commented May 4, 2023

Actually they're not the total usage of users, they are the amount of data that has passed through the outbounds. why should we reset them?

for example, hire vps in linode or other cloud sever, there have usage limitation in one month, usually reset at next month, so I can see how usage used in current period.

so, we can add a feature to reset system usage, or a reset option for each node. is this gonna solve this?

@zhongfq
Copy link
Contributor Author

zhongfq commented May 4, 2023

Actually they're not the total usage of users, they are the amount of data that has passed through the outbounds. why should we reset them?
for example, hire vps in linode or other cloud sever, there have usage limitation in one month, usually reset at next month, so I can see how usage used in current period.

so, we can add a feature to reset system usage, or a reset option for each node. is this gonna solve this?

yes, I think we can add this feature in node setting panel.

also, we can add two another feature:

  1. upgrade marzban-node: git pull && systemctl restart marzban
  2. upgrade xray with selected version: Xray-install.sh install version

@SaintShit
Copy link
Contributor

Actually they're not the total usage of users, they are the amount of data that has passed through the outbounds. why should we reset them?
for example, hire vps in linode or other cloud sever, there have usage limitation in one month, usually reset at next month, so I can see how usage used in current period.

so, we can add a feature to reset system usage, or a reset option for each node. is this gonna solve this?

yes, I think we can add this feature in node setting panel.

also, we can add two another feature:

  1. upgrade marzban-node: git pull && systemctl restart marzban
  2. upgrade xray with selected version: Xray-install.sh install version

Yay, just made this issue.
the majority of our users use docker, as we suggested

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.

6 participants