new stats counter "discarded" for queue object

Tells how many messages have been discarded due to queue full condition.
This commit is contained in:
Rainer Gerhards 2011-12-16 14:42:37 +01:00
parent 01c7c9ffc6
commit 7796eeb696
4 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,9 @@
---------------------------------------------------------------------------
Version 5.9.5 [V5-DEVEL], 2011-11-29
- new stats counter "discarded" for queue object. Tells how many messages
have been discarded due to queue full condition.
---------------------------------------------------------------------------
Version 5.9.5 [V5-DEVEL], 2011-11-29
- enhanced module loader to not rely on PATH_MAX
---------------------------------------------------------------------------
Version 5.9.4 [V5-DEVEL], 2011-11-29

View File

@ -10,7 +10,7 @@
* of the "old" message code without any modifications. However, it
* helps to have things at the right place one we go to the meat of it.
*
* Copyright 2010 Rainer Gerhards and Adiscon GmbH.
* Copyright 2010-2011 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*

View File

@ -1989,6 +1989,10 @@ qqueueStart(qqueue_t *pThis) /* this is the ConstructionFinalizer */
CHKiRet(statsobj.AddCounter(pThis->statsobj, UCHAR_CONSTANT("full"),
ctrType_IntCtr, &pThis->ctrFull));
STATSCOUNTER_INIT(pThis->ctrDscrd, pThis->mutCtrDscrd);
CHKiRet(statsobj.AddCounter(pThis->statsobj, UCHAR_CONSTANT("discarded"),
ctrType_IntCtr, &pThis->ctrDscrd));
pThis->ctrMaxqsize = 0;
CHKiRet(statsobj.AddCounter(pThis->statsobj, UCHAR_CONSTANT("maxqsize"),
ctrType_Int, &pThis->ctrMaxqsize));
@ -2342,6 +2346,7 @@ doEnqSingleObj(qqueue_t *pThis, flowControl_t flowCtlType, void *pUsr)
// TODO : handle enqOnly => discard!
if(pthread_cond_timedwait(&pThis->notFull, pThis->mut, &t) != 0) {
DBGOPRINT((obj_t*) pThis, "enqueueMsg: cond timeout, dropping message!\n");
STATSCOUNTER_INC(pThis->ctrDscrd, pThis->mutCtrDscrd);
objDestruct(pUsr);
ABORT_FINALIZE(RS_RET_QUEUE_FULL);
}

View File

@ -169,6 +169,7 @@ struct queue_s {
statsobj_t *statsobj;
STATSCOUNTER_DEF(ctrEnqueued, mutCtrEnqueued);
STATSCOUNTER_DEF(ctrFull, mutCtrFull);
STATSCOUNTER_DEF(ctrDscrd, mutCtrDscrd);
int ctrMaxqsize;
};