pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.7k stars 1.7k forks source link

Wrong units used in console / wrong value conversion #4133

Closed LOENS2 closed 2 years ago

LOENS2 commented 2 years ago

Current Behavior

The values for memory, disk and network activity shown in the console are in mebibytes or kibibytes but are labeled with megabytes or kilobytes.

Expected Behavior

The values should be converted according to the units shown in the console

Steps to Reproduce

Get the byte value via https://pterodactyl.file.properties/api/client/servers/1a7ce997/resources and devide it by 1048576 to get the value in mebibytes. This value is shown in the console. If you devide the byte value by 1000000, you get the value in megabyte, but it doesn't match te value given in the console.

Panel Version

1.8.1

Wings Version

1.6.4

Games and/or Eggs Affected

No response

Docker Image

No response

Error Logs

No response

Is there an existing issue for this?

Goksi commented 2 years ago

Pretty sure its intended to work like that as MB also can be interpreted as 2^20 bytes. Term mebibyte might be confusing to end user

LOENS2 commented 2 years ago

It really confused me, because i had different values in Grafana (right megabyte conversion) and thought that my exporter made a wrong conversion, but upon realizing it was actually mebibytes in the panel, I now ask myself why it isn't converted correctly.

DaneEveritt commented 2 years ago

This value is shown in the console

What does this mean? We don't output anything into the console like this.

Clarkcj12 commented 2 years ago

I believe he is talking about the console graphs displayed on the servers console page.

LOENS2 commented 2 years ago

@DaneEveritt I'm talking about the server console in the panel for the docker container. On the left side of that window are the server stats I'm referring to. Sorry for the miscommunication

Software-Noob commented 2 years ago

The math used for conversion is bytes / 1024, which indeed is a kilobyte (KiB) and mebibyte (MiB), and so forth. However, the values converted and displayed are something that is displayed to a human, and the majority of average users will not know the difference between KiB and kB as there's no acceptance in the industry for it, even though it's the accepted standard for base 2.

The latter is usually always displayed to the end-user in many operating systems and software, even if 1024 is used in computer science to calculate it. Although, usually it's only used in disk space, can be seen a lot in memory too. It's a matter of decimal vs binary. Kilobyte is 1000 in decimal, but 1024 in binary. Programmers tend to use binary.

Dane either did it for the reasons of human-readable values as the function is called (heh) or forgot it himself.

DaneEveritt commented 2 years ago

This was changed in 1eb3ea2ee4ebf98ccc72a112ff5602670a28a130 to now use 1000 as the base for all conversions in the Panel.