Skip to content

fix: format number value from string first#52

Merged
fengmk2 merged 6 commits intomasterfrom
fix-number-is-string
Jan 17, 2026
Merged

fix: format number value from string first#52
fengmk2 merged 6 commits intomasterfrom
fix-number-is-string

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Jan 17, 2026

@fengmk2 fengmk2 linked an issue Jan 17, 2026 that may be closed by this pull request
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses an issue where numeric values stored as strings in the database were causing errors when methods like .toFixed() were called on them. The fix adds explicit Number() conversions before using these string values in arithmetic operations or calling number methods on them.

Changes:

  • Added format parameter to getAverageMetric method in metric.js to convert string values to numbers before processing
  • Added format: value => Number(value) functions to various metric key configurations in service files
  • Added explicit Number() conversions in controller files before calling .toFixed() on numeric values

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
app/service/metric.js Added format parameter to getAverageMetric method and applied it to metric values before processing
app/service/system.js Added format functions to osCpuTrend, loadTrend, and httpResponseTrend metric keys
app/service/process.js Added format functions to all cpuTrend metric keys (cpu_now, cpu_15, cpu_30, cpu_60)
app/controller/system.js Added Number() conversions for used_cpu, used_memory_percent, load values, and http_rt before using toFixed()
app/controller/process.js Added Number() conversion for cpu_60 before calling toFixed()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fengmk2 fengmk2 merged commit 62e0bab into master Jan 17, 2026
2 checks passed
@fengmk2 fengmk2 deleted the fix-number-is-string branch January 17, 2026 10:55
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.

添加实例后,进程列表页报错500 使用docker compose 一键部署后,部分数据采集不上报错

1 participant