Skip to content

coder stat returns wrong memory units #10952

Closed
@f0ssel

Description

@f0ssel

Noticed on the dashboard that it says I have 0.197/8589934592 GiB (0%) and this is obviously incorrect. Looks like just a unit output issue.
Screenshot 2023-11-30 at 9 25 15 AM

This is from running scripts/develop.sh on dogfood.

I thought this may be frontend, but looked at the metadata stream and see the backend is incorrect, so I assume this is coming from coder stat mem.

Here's the message from the backend:

[
  {
    "result": {
      "collected_at": "2023-11-30T14:26:56.332349Z",
      "age": 6,
      "value": "0.464 cores\n",
      "error": ""
    },
    "description": {
      "display_name": "CPU Usage",
      "key": "0_cpu_usage",
      "script": "coder stat cpu",
      "interval": 10,
      "timeout": 1
    }
  },
  {
    "result": {
      "collected_at": "2023-11-30T14:26:57.331663Z",
      "age": 5,
      "value": "0.197/8589934592 GiB (0%)\n",
      "error": ""
    },
    "description": {
      "display_name": "RAM Usage",
      "key": "1_ram_usage",
      "script": "coder stat mem",
      "interval": 10,
      "timeout": 1
    }
  },
  {
    "result": {
      "collected_at": "2023-11-30T14:26:36.332216Z",
      "age": 26,
      "value": "67.7/468 GiB (14%)\n",
      "error": ""
    },
    "description": {
      "display_name": "Home Disk",
      "key": "3_home_disk",
      "script": "coder stat disk --path ${HOME}",
      "interval": 60,
      "timeout": 1
    }
  },
  {
    "result": {
      "collected_at": "2023-11-30T14:26:56.332349Z",
      "age": 6,
      "value": "1.2/64 cores (2%)\n",
      "error": ""
    },
    "description": {
      "display_name": "CPU Usage (Host)",
      "key": "4_cpu_usage_host",
      "script": "coder stat cpu --host",
      "interval": 10,
      "timeout": 1
    }
  },
  {
    "result": {
      "collected_at": "2023-11-30T14:26:56.332349Z",
      "age": 6,
      "value": "51.6/251 GiB (21%)\n",
      "error": ""
    },
    "description": {
      "display_name": "Memory Usage (Host)",
      "key": "5_mem_usage_host",
      "script": "coder stat mem --host",
      "interval": 10,
      "timeout": 1
    }
  },
  {
    "result": {
      "collected_at": "2023-11-30T14:26:36.332216Z",
      "age": 26,
      "value": "0.03",
      "error": ""
    },
    "description": {
      "display_name": "Load Average (Host)",
      "key": "6_load_host",
      "script": "      echo \"`cat /proc/loadavg | awk '{ print $1 }'` `nproc`\" | awk '{ printf \"%0.2f\", $1/$2 }'\n",
      "interval": 60,
      "timeout": 1
    }
  },
  {
    "result": {
      "collected_at": "2023-11-30T14:26:56.332349Z",
      "age": 6,
      "value": "1.0/8.0",
      "error": ""
    },
    "description": {
      "display_name": "Swap Usage (Host)",
      "key": "7_swap_host",
      "script": "      free -b | awk '/^Swap/ { printf(\"%.1f/%.1f\", $3/1024.0/1024.0/1024.0, $2/1024.0/1024.0/1024.0) }'\n",
      "interval": 10,
      "timeout": 1
    }
  }
]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions