How to get Couchbase Timer statistics or list

Hello everyone,

I’m wondering, if is there any way I can access the timer statistics such as:

  • Active timer count
  • Average timer run time
  • Failed timer count etc.

If there are no such statistics kept in the Couchbase, then is there any way I can list all timers from some page, n1ql, or even from SDK? :slight_smile:

Thanks in advance :upside_down_face:

The statistics available for Eventing timers are accessible via:

curl http://user:pass@localhost:8096/api/v1/stats

(Ref: https://docs.couchbase.com/server/current/eventing/eventing-statistics.html)

These don’t include duration of call-back functions; I expect you’d have to code and log such statistics explicitly.

For example, the “execution_stats” element includes:

  "timer_callback_failure": 0,
  "timer_callback_success": 1,
  "timer_cancel_counter": 0,
  "timer_create_counter": 2,
  "timer_create_failure": 0,
  "timer_msg_counter": 1,
  "timer_responses_sent": 0,

You can use - where “default.eventing.eventing” is the storage location you have defined for your eventing functions:

SELECT e1.*, millis_to_str(e2.due*1000) due                                                                                         
FROM default.eventing.eventing e1 LEFT OUTER JOIN default.eventing.eventing e2 ON e1.alr = meta(e2).id
WHERE e1.alr IS VALUED;

to list timers waiting to fire.

(Obviously a suitable indices are needed for such querying.)

HTH.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.