summaryrefslogtreecommitdiffstats
path: root/action.c
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 /action.c
parent487ef81de618e46e7fe5e072c127ce9d8bc4fca6 (diff)
downloadrsyslog-c3d80cd3b0060a37e15e8e323b5a3535ab1933c0.tar.gz
rsyslog-c3d80cd3b0060a37e15e8e323b5a3535ab1933c0.tar.bz2
rsyslog-c3d80cd3b0060a37e15e8e323b5a3535ab1933c0.zip
add new impstats action counters:
* suspended * suspended.duration * resumed
Diffstat (limited to 'action.c')
-rw-r--r--action.c22
1 files changed, 20 insertions, 2 deletions
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);