Add process_start_time_seconds and process_pid metrics

This commit is contained in:
Tim Wojtulewicz 2025-07-23 14:40:04 -07:00
parent d12b381e3e
commit d5db359772
3 changed files with 7 additions and 0 deletions

View file

@ -135,6 +135,10 @@ void Manager::InitPostScript() {
[]() { return static_cast<double>(get_stats()->fds); });
#endif
// These two metrics get set at startup and are never modified after.
process_start_time = GaugeInstance("process", "start_time", {}, "Process start time", "seconds");
process_start_time->Set(run_state::zeek_start_time);
if ( ! iosource_mgr->RegisterFd(collector_flare.FD(), this) ) {
reporter->FatalError("Failed to register telemetry collector descriptor");
}

View file

@ -282,6 +282,7 @@ private:
CounterPtr cpu_user_counter;
CounterPtr cpu_system_counter;
GaugePtr fds_gauge;
GaugePtr process_start_time;
std::shared_ptr<prometheus::Registry> prometheus_registry;
std::unique_ptr<prometheus::Exposer> prometheus_exposer;

View file

@ -5,9 +5,11 @@ process_cpu_system_seconds_total, [], >0.0, good
process_resident_memory_bytes, [], >0.0, good
process_virtual_memory_bytes, [], >0.0, good
process_open_fds, [], >0.0, good
process_start_time_seconds, [], >0.0, good
zeek_done
process_cpu_user_seconds_total, [], >0.0, good
process_cpu_system_seconds_total, [], >0.0, good
process_resident_memory_bytes, [], >0.0, good
process_virtual_memory_bytes, [], >0.0, good
process_open_fds, [], >0.0, good
process_start_time_seconds, [], >0.0, good