diff options
| author | Stefan Boberg <[email protected]> | 2026-04-13 12:09:05 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-04-13 12:09:05 +0200 |
| commit | e0879bed083eab09cfa28043a3b210714d0884b9 (patch) | |
| tree | 00d5dddc9a046bd0112e1fddcfce430ced14a355 /src/zencompute/include | |
| parent | update minio (#947) (diff) | |
| download | zen-e0879bed083eab09cfa28043a3b210714d0884b9.tar.xz zen-e0879bed083eab09cfa28043a3b210714d0884b9.zip | |
Logging and diagnostics improvements (#941)
Core logging and system diagnostics improvements, extracted from the compute branch.
### Logging
- **Elapsed timestamps**: Console log now shows elapsed time since launch `[HH:MM:SS.mmm]` instead of full date/time; file logging is unchanged
- **Short level names**: 3-letter short level names (`trc`/`dbg`/`inf`/`wrn`/`err`/`crt`) used by both console and file formatters via `ShortToStringView()`
- **Consistent field order**: Standardized to `[timestamp] [level] [logger]` across both console and file formatters
- **Slim LogMessage/LogPoint**: Remove redundant fields from `LogMessage` (derive level/source from `LogPoint`), flatten `LogPoint` to inline filename/line fields, shrink `LogLevel` to `int8_t` with `static_assert(sizeof(LogPoint) <= 32)`
- **Remove default member initializers** and static default `LogPoint` from `LogMessage` — all fields initialized by constructor
- **LoggerRef string constructor**: Convenience constructor accepting a string directly
- **Fix SendMessage macro collision**: Replace `thread.h` include in `logmsg.h` with a forward declaration of `GetCurrentThreadId()` to avoid pulling in `windows.h` transitively
### System Diagnostics
- **Cache static system metrics**: Add `RefreshDynamicSystemMetrics()` that only queries values that change at runtime (available memory, uptime, swap). `SystemMetricsTracker` snapshots full `GetSystemMetrics()` once at construction and reuses cached topology/total memory on each `Query()`, avoiding repeated `GetLogicalProcessorInformationEx` traversal on Windows, `/proc/cpuinfo` parsing on Linux, and `sysctl` topology calls on macOS
Diffstat (limited to 'src/zencompute/include')
| -rw-r--r-- | src/zencompute/include/zencompute/orchestratorservice.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/zencompute/include/zencompute/orchestratorservice.h b/src/zencompute/include/zencompute/orchestratorservice.h index 071e902b3..549ff8e3c 100644 --- a/src/zencompute/include/zencompute/orchestratorservice.h +++ b/src/zencompute/include/zencompute/orchestratorservice.h @@ -7,6 +7,8 @@ #if ZEN_WITH_COMPUTE_SERVICES # include <zencore/compactbinary.h> +# include <zencore/compactbinarybuilder.h> +# include <zencore/logbase.h> # include <zencore/thread.h> # include <zencore/timer.h> # include <zencore/uid.h> @@ -164,7 +166,10 @@ private: void RecordClientEvent(ClientEvent::Type Type, std::string_view ClientId, std::string_view Hostname); - bool m_EnableWorkerWebSocket = false; + LoggerRef Log() { return m_Log; } + + LoggerRef m_Log{"compute.orchestrator"}; + bool m_EnableWorkerWebSocket = false; std::thread m_ProbeThread; std::atomic<bool> m_ProbeThreadEnabled{true}; |