mirror of
https://github.com/wassname/ray.git
synced 2026-07-29 11:26:04 +08:00
Change event logs to store one Redis ZSET per worker. (#705)
* Changing to zset * Fixed bug. * Fixed another bug. * Modified task_profiles. * Removed extra file. * Modified task_profiles test. * WIP * WIP * Undid changes * Updated * WIP * Made changes according to comments. * Removed unneeded print. * Removed ujson usage. * failing test * tests passing * Fixed linting errors and modified style. * Fixed bug. * Fixed linting * Fixed according to comments. * Redis crashing? * Fixed linting * Fixed linting
This commit is contained in:
committed by
Robert Nishihara
parent
cd12ea7e09
commit
8464d77c76
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "state/redis.h"
|
||||
#include "io.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
static const char *log_levels[5] = {"DEBUG", "INFO", "WARN", "ERROR", "FATAL"};
|
||||
static const char *log_fmt =
|
||||
@@ -90,9 +92,12 @@ void RayLogger_log_event(DBHandle *db,
|
||||
uint8_t *key,
|
||||
int64_t key_length,
|
||||
uint8_t *value,
|
||||
int64_t value_length) {
|
||||
int status = redisAsyncCommand(db->context, NULL, NULL, "RPUSH %b %b", key,
|
||||
key_length, value, value_length);
|
||||
int64_t value_length,
|
||||
double timestamp) {
|
||||
std::string timestamp_string = std::to_string(timestamp);
|
||||
int status = redisAsyncCommand(db->context, NULL, NULL, "ZADD %b %s %b", key,
|
||||
key_length, timestamp_string.c_str(), value,
|
||||
value_length);
|
||||
if ((status == REDIS_ERR) || db->context->err) {
|
||||
LOG_REDIS_DEBUG(db->context, "error while logging message to event log");
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ void RayLogger_log_event(DBHandle *db,
|
||||
uint8_t *key,
|
||||
int64_t key_length,
|
||||
uint8_t *value,
|
||||
int64_t value_length);
|
||||
int64_t value_length,
|
||||
double time);
|
||||
|
||||
#endif /* LOGGING_H */
|
||||
|
||||
Reference in New Issue
Block a user