Skip to content

[Bug]: Monitoring dashboard handler can panic due to missing template function 'div' #96

@cotishq

Description

@cotishq

🐛 Bug Description

Current code path in monitoring/web.go:

  • handleDashboard uses template.Must(template.New("dashboard").Parse(dashboardTemplate))
  • dashboardTemplate includes {{printf "%.2f" (div .Metrics.MemAllocBytes 1048576.0)}}

This can panic at runtime when / is requested.


🔁 Steps to Reproduce

Steps to reproduce the behavior:

  1. Enable monitoring (ENABLE_MONITORING=true)
  2. Start the plugin
  3. Open http://localhost:<MONITORING_PORT>/
  4. Observe handler panic / template parse failure because function div is undefined

✅ Expected Behavior

Dashboard should render successfully and show memory metrics in MB without panic.


❌ Actual Behavior

Dashboard handler can panic due to undefined template function div.


🧪 Reproducibility

  • Always
  • Sometimes
  • Rarely
  • Unable to reproduce

📸 Screenshots / Logs

NA

Logs
NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions