summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-11-29 15:13:22 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-11-29 15:13:22 +0100
commitc3d80cd3b0060a37e15e8e323b5a3535ab1933c0 (patch)
tree2a82fd30b48801da4a36075c1b90779be361daab
parent487ef81de618e46e7fe5e072c127ce9d8bc4fca6 (diff)
downloadrsyslog-c3d80cd3b0060a37e15e8e323b5a3535ab1933c0.tar.gz
rsyslog-c3d80cd3b0060a37e15e8e323b5a3535ab1933c0.tar.bz2
rsyslog-c3d80cd3b0060a37e15e8e323b5a3535ab1933c0.zip
add new impstats action counters:
* suspended * suspended.duration * resumed
-rw-r--r--ChangeLog4
-rw-r--r--action.c22
-rw-r--r--action.h3
3 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b495fbf..b8233d8a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
---------------------------------------------------------------------------
Version 7.5.8 [v7-devel] 2013-11-??
- bugfix: mmrfc5424addhmac: "key" parameter was not properly processed
+- add new impstats action counters:
+ * suspended
+ * suspended.duration
+ * resumed
---------------------------------------------------------------------------
Version 7.5.7 [v7-devel] 2013-11-25
- queue defaults have changed
diff --git a/action.c b/action.c
index 6a0db2e1..23b70885 100644
--- a/action.c
+++ b/action.c
@@ -389,6 +389,17 @@ actionConstructFinalize(action_t *pThis, struct nvlst *lst)
CHKiRet(statsobj.AddCounter(pThis->statsobj, UCHAR_CONSTANT("failed"),
ctrType_IntCtr, CTR_FLAG_RESETTABLE, &pThis->ctrFail));
+ STATSCOUNTER_INIT(pThis->ctrSuspend, pThis->mutCtrSuspend);
+ CHKiRet(statsobj.AddCounter(pThis->statsobj, UCHAR_CONSTANT("suspended"),
+ ctrType_IntCtr, CTR_FLAG_RESETTABLE, &pThis->ctrSuspend));
+ STATSCOUNTER_INIT(pThis->ctrSuspendDuration, pThis->mutCtrSuspendDuration);
+ CHKiRet(statsobj.AddCounter(pThis->statsobj, UCHAR_CONSTANT("suspended.duration"),
+ ctrType_IntCtr, 0, &pThis->ctrSuspendDuration));
+
+ STATSCOUNTER_INIT(pThis->ctrResume, pThis->mutCtrResume);
+ CHKiRet(statsobj.AddCounter(pThis->statsobj, UCHAR_CONSTANT("resumed"),
+ ctrType_IntCtr, CTR_FLAG_RESETTABLE, &pThis->ctrResume));
+
CHKiRet(statsobj.ConstructFinalize(pThis->statsobj));
/* create our queue */
@@ -613,17 +624,24 @@ static void actionDisable(action_t *pThis)
* CPU time. TODO: maybe a config option for that?
* rgerhards, 2007-08-02
*/
-static inline void actionSuspend(action_t *pThis)
+static inline void
+actionSuspend(action_t * const pThis)
{
time_t ttNow;
+ int suspendDuration;
char timebuf[32];
/* note: we can NOT use a cached timestamp, as time may have evolved
* since caching, and this would break logic (and it actually did so!)
*/
datetime.GetTime(&ttNow);
- pThis->ttResumeRtry = ttNow + pThis->iResumeInterval * (pThis->iNbrResRtry / 10 + 1);
+ suspendDuration = pThis->iResumeInterval * (pThis->iNbrResRtry / 10 + 1);
+ pThis->ttResumeRtry = ttNow + suspendDuration;
actionSetState(pThis, ACT_STATE_SUSP);
+ pThis->ctrSuspendDuration += suspendDuration;
+ if(pThis->iNbrResRtry == 0) {
+ STATSCOUNTER_INC(pThis->ctrSuspend, pThis->mutCtrSuspend);
+ }
DBGPRINTF("action '%s' suspended, earliest retry=%lld (now %lld), iNbrResRtry %d\n",
pThis->pszName, (long long) pThis->ttResumeRtry, (long long) ttNow,
pThis->iNbrResRtry);
diff --git a/action.h b/action.h
index 54cdb54c..bbd63be1 100644
--- a/action.h
+++ b/action.h
@@ -85,6 +85,9 @@ struct action_s {
statsobj_t *statsobj;
STATSCOUNTER_DEF(ctrProcessed, mutCtrProcessed);
STATSCOUNTER_DEF(ctrFail, mutCtrFail);
+ STATSCOUNTER_DEF(ctrSuspend, mutCtrSuspend);
+ STATSCOUNTER_DEF(ctrSuspendDuration, mutCtrSuspendDuration);
+ STATSCOUNTER_DEF(ctrResume, mutCtrResume);
};