global: add process_name to crash meta

Signed-off-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
Mykola Golub 2018-11-25 12:33:15 +02:00
parent 60d4fa608e
commit 31e6d10e54
4 changed files with 6 additions and 0 deletions

View File

@ -34,3 +34,4 @@ const char *g_assert_condition = 0;
unsigned long long g_assert_thread = 0; unsigned long long g_assert_thread = 0;
char g_assert_thread_name[4096]; char g_assert_thread_name[4096];
char g_assert_msg[8096]; char g_assert_msg[8096];
char g_process_name[NAME_MAX + 1];

View File

@ -15,6 +15,8 @@
#ifndef CEPH_GLOBAL_CONTEXT_H #ifndef CEPH_GLOBAL_CONTEXT_H
#define CEPH_GLOBAL_CONTEXT_H #define CEPH_GLOBAL_CONTEXT_H
#include <limits.h>
#include "common/config_fwd.h" #include "common/config_fwd.h"
class CephContext; class CephContext;
@ -29,5 +31,6 @@ extern const char *g_assert_condition;
extern unsigned long long g_assert_thread; extern unsigned long long g_assert_thread;
extern char g_assert_thread_name[4096]; extern char g_assert_thread_name[4096];
extern char g_assert_msg[8096]; extern char g_assert_msg[8096];
extern char g_process_name[NAME_MAX + 1];
#endif #endif

View File

@ -42,6 +42,7 @@
static void global_init_set_globals(CephContext *cct) static void global_init_set_globals(CephContext *cct)
{ {
g_ceph_context = cct; g_ceph_context = cct;
get_process_name(g_process_name, sizeof(g_process_name));
} }
static void output_ceph_version() static void output_ceph_version()

View File

@ -195,6 +195,7 @@ static void handle_fatal_signal(int signum)
jf.open_object_section("crash"); jf.open_object_section("crash");
jf.dump_string("crash_id", id); jf.dump_string("crash_id", id);
now.gmtime(jf.dump_stream("timestamp")); now.gmtime(jf.dump_stream("timestamp"));
jf.dump_string("process_name", g_process_name);
jf.dump_string("entity_name", g_ceph_context->_conf->name.to_str()); jf.dump_string("entity_name", g_ceph_context->_conf->name.to_str());
jf.dump_string("ceph_version", ceph_version_to_str()); jf.dump_string("ceph_version", ceph_version_to_str());