You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Raghav Jeyaraman (JIRA)" <ji...@apache.org> on 2010/05/17 09:38:42 UTC

[jira] Commented: (TS-157) Improve stats API

    [ https://issues.apache.org/jira/browse/TS-157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12868116#action_12868116 ] 

Raghav Jeyaraman commented on TS-157:
-------------------------------------

Changes for this have been checked in through Vijay.

The following new APIs have been added.

 * INKReturnCode INKStatCreateV2(const char *name, uint32_t *stat_num) - Registers the stat. Returns an integer which is tied to the stat_name in stat_num.

   * INKReturnCode INKStatIncrementV2(uint32_t stat_num, INK64 inc_by) - Increments the stat associated with stat_num by inc_by
   * INKReturnCode INKStatIncrementByNameV2(const char *stat_name, INK64 inc_by) - Same as above but slower as it needs a lock to lookup the stat_num
   * INKReturnCode INKStatDecrementV2(uint32_t stat_num, INK64 dec_by) - Decrements the stat associated with stat_num by dec_by
   * INKReturnCode INKStatDecrementByNameV2(const char *stat_name, INK64 dec_by) - Same as previous function but slower as it needs a lock to lookup the stat_num
   * INKReturnCode INKStatGetV2(uint32_t stat_num, INK64 *stat_val) - Get stat represented by stat_num. Looks up the global_stats. Does not walk through all threads.
   * INKReturnCode INKStatGetByNameV2(const char *stat_name, INK64 *stat_val) - Same as previous function but slower as it needs a lock to lookup the stat_num
   * INKReturnCode INKStatGetCurrentV2(uint32_t stat_num, INK64 *stat_val) - Get current value of stat represented by stat_num. Walks through all threads.
   * INKReturnCode INKStatGetCurrentByNameV2(const char *stat_name, INK64 *stat_val) - Same as previous function but slower as it needs a lock to lookup the stat_num

   * void INKContNameSet (INKCont contp, const char *cont_name) - Sets the name of the continution to cont_name. If a plugin needs to track time spent in each of its hooks and number of calls made to it on the hooks it has registered to, this function has to be called by the plugin.

Using the new stat system in plugins:
* Register stat using INKStatCreateV2
* Increment/Decrement stats using the increment/decrement APIs
* If the plugin needs to track calls made to it on the hooks it listens to and its performance numbers for each of the hooks, the plugin must call INKContNameSet in INKPluginInit with a name to identify the plugin uniquely. 

Using the new stat system in the core:
*  include StatSystemV2.h
*  register stats - StatSystemV2::registerStat(const char *stat_name, uint32_t *stat_num) 
*  increment/decrement stats - StatSystemV2::increment(uint32_t stat_num, INK64 stat_val = 1). stat_val can be negative. 

I will be updating
https://cwiki.apache.org/confluence/display/TS/StatsCollection 
with more details about the implementation through Miles
Thanks,
--raghav

> Improve stats API
> -----------------
>
>                 Key: TS-157
>                 URL: https://issues.apache.org/jira/browse/TS-157
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: Stats
>            Reporter: Raghav Jeyaraman
>            Assignee: Raghav Jeyaraman
>
> As it stands today, traffic server limits the number of stats that can be registered to 250. 
> The code must be changed to allow a large number of stats (100000)  to be tracked.
> The API for adding coupled stats is cumbersome to use and as a result, has very few users. Current stats API must be cleaned up or gotten rid of.
> Thanks,
> --raghav

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.