{"id":2341,"date":"2013-11-30T15:25:32","date_gmt":"2013-11-30T20:25:32","guid":{"rendered":"http:\/\/hstore.cs.brown.edu\/?page_id=2341"},"modified":"2013-12-01T22:54:36","modified_gmt":"2013-12-02T03:54:36","slug":"new-system-statistics","status":"publish","type":"page","link":"https:\/\/hstore.cs.brown.edu\/documentation\/development\/new-system-statistics\/","title":{"rendered":"Adding New System Statistics"},"content":{"rendered":"
The following documentation describes how to collection new internal statistics from the run time system. H-Store uses a built-in stats management system that is exposed to the outside world using the @Statistics<\/a> system procedure.<\/p>\n For the purpose of this documentation, we will refer to the component in the DBMS that collects the statistics for a specific aspect of the system as a StatsSource<\/tt>. The sub-system that aggregates multiple StatsSource<\/tt> together (either within a single partition, or at a site site), is known as a StatsAgent<\/tt>. The StatsAgents<\/tt> can be used to coalesce data in a lazy manner without needing to retrieve information directly from the StatsSource<\/tt> each time. All of the StatsAgents<\/tt> are already created in the system for you. If you are reading this documentation because yu want to collect additional information about the DBMS, then you are trying to add a new StatsSource<\/tt>.<\/p>\n There are several considerations that one must make before adding a new StatsSource<\/tt>:<\/p>\n There are two areas in the system where you can collect stats information: (1) the Java front-end layer and (2) the C++ execution engine layer. We will now describe how to add new agents for each of these.<\/p>\n <\/a><\/p>\n The first step is to create a new class that extends the StatsSource<\/a> base class. You will then need to hook your new source into the proper component of the overall system. There is no right\/wrong way to do this, since it depends on what data you want to collect. In general, it is best to avoid a centralized agent if multiple threads are going to be updating it. For example, if there is information that you want to collect from the PartitionExecutor<\/a><\/span>, then it is best to have a separate source per partition and then aggregate their results only when needed. If the information is global (e.g., the amount memory used by the JVM), then it is sufficient to just use a single source (since multiple threads will not need to write to it).<\/p>\n After you have created your new source class, you will then need to have it register with the StatsAgent<\/tt> at runtime. To do this, you need to create a new entry in the SysProcSelector<\/a> enum. As an example, let create a new stats source called “TigerStyle” that retrieves information for a single partition. We will want to create our new entry in SysProcSelector<\/tt> like so:<\/p>\n\n\n
Java Stats Collection<\/h2>\n