[syslog-ng] [PATCH] afmongodb: Add stats locking.
Gergely Nagy
algernon at balabit.hu
Tue Aug 16 12:01:24 CEST 2011
Lock / unlock the stats when registering the counters.
Reported-by: Costa Farber <costaf at wix.com>
Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
modules/afmongodb/afmongodb.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/modules/afmongodb/afmongodb.c b/modules/afmongodb/afmongodb.c
index f82f10e..9e155ed 100644
--- a/modules/afmongodb/afmongodb.c
+++ b/modules/afmongodb/afmongodb.c
@@ -439,12 +439,14 @@ afmongodb_dd_init(LogPipe *s)
self->queue = log_dest_driver_acquire_queue(&self->super, afmongodb_dd_format_persist_name(self));
+ stats_lock();
stats_register_counter(0, SCS_MONGODB | SCS_DESTINATION, self->super.super.id,
afmongodb_dd_format_stats_instance(self),
SC_TYPE_STORED, &self->stored_messages);
stats_register_counter(0, SCS_MONGODB | SCS_DESTINATION, self->super.super.id,
afmongodb_dd_format_stats_instance(self),
SC_TYPE_DROPPED, &self->dropped_messages);
+ stats_unlock();
log_queue_set_counters(self->queue, self->stored_messages, self->dropped_messages);
afmongodb_dd_start_thread(self);
--
1.7.0.4
More information about the syslog-ng
mailing list