forgejo/templates/admin/system_status.tmpl
0ko 2bde157a0d feat(i18n): translate system status data units in runtime (#10358)
Followup to https://codeberg.org/forgejo/forgejo/pulls/2528

Instead of storing translated strings in memory, store raw numbers and translate at template rendering time.

Our implementation of `TrSize` is not very efficient and is more expensive than just the underlying `humanize.IBytes`, but for me on localhost both ways render response to HTMLX's request to `/admin/system_status` in 0-1 ms.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10358
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
2025-12-09 14:38:40 +01:00

62 lines
3.4 KiB
Go HTML Template

<dl class="admin-dl-horizontal">
<dt>{{ctx.Locale.Tr "admin.dashboard.server_uptime"}}</dt>
<dd><relative-time format="duration" datetime="{{.SysStatus.StartTime}}">{{.SysStatus.StartTime}}</relative-time></dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.current_goroutine"}}</dt>
<dd>{{.SysStatus.NumGoroutine}}</dd>
<div class="divider"></div>
<dt>{{ctx.Locale.Tr "admin.dashboard.current_memory_usage"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.MemAllocated}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.total_memory_allocated"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.MemTotal}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.memory_obtained"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.MemSys}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.pointer_lookup_times"}}</dt>
<dd>{{.SysStatus.Lookups}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.memory_allocate_times"}}</dt>
<dd>{{.SysStatus.MemMallocs}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.memory_free_times"}}</dt>
<dd>{{.SysStatus.MemFrees}}</dd>
<div class="divider"></div>
<dt>{{ctx.Locale.Tr "admin.dashboard.current_heap_usage"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.HeapAlloc}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_obtained"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.HeapSys}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_idle"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.HeapIdle}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_in_use"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.HeapInuse}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.heap_memory_released"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.HeapReleased}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.heap_objects"}}</dt>
<dd>{{.SysStatus.HeapObjects}}</dd>
<div class="divider"></div>
<dt>{{ctx.Locale.Tr "admin.dashboard.bootstrap_stack_usage"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.StackInuse}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.stack_memory_obtained"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.StackSys}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.mspan_structures_usage"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.MSpanInuse}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.mspan_structures_obtained"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.MSpanSys}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.mcache_structures_usage"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.MCacheInuse}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.mcache_structures_obtained"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.MCacheSys}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.profiling_bucket_hash_table_obtained"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.BuckHashSys}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.gc_metadata_obtained"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.GCSys}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.other_system_allocation_obtained"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.OtherSys}}</dd>
<div class="divider"></div>
<dt>{{ctx.Locale.Tr "admin.dashboard.next_gc_recycle"}}</dt>
<dd>{{ctx.Locale.TrSize .SysStatus.NextGC}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.last_gc_time"}}</dt>
<dd><relative-time format="duration" datetime="{{.SysStatus.LastGCTime}}">{{.SysStatus.LastGCTime}}</relative-time></dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.total_gc_pause"}}</dt>
<dd>{{.SysStatus.PauseTotalNs}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.last_gc_pause"}}</dt>
<dd>{{.SysStatus.PauseNs}}</dd>
<dt>{{ctx.Locale.Tr "admin.dashboard.gc_times"}}</dt>
<dd>{{.SysStatus.NumGC}}</dd>
</dl>