aces / cbrain

CBRAIN is a flexible Ruby on Rails framework for accessing and processing of large data on high-performance computing infrastructures.
GNU General Public License v3.0
71 stars 42 forks source link

Simplify the stats structure for requests #1173

Closed prioux closed 2 years ago

prioux commented 2 years ago

Every controller action in CBRAIN adds a counter to a stats structure stored in the meta data of the portal.

Right now the structure split at the top level based on the client's user agent:

# roughly
counters = stats[agentname][controller][action]
#counters is a pair [ num_success, num_errors ]

The structure quickly grows large with all the duplications, and we only have 65,000 bytes to store the yaml representation.

We should fix this by aggregating all user agents together (maybe under the key 'AllAgents' at the top). We could also keep some info about the agents by just recording directly stats['Agents'][agentname] = [counter, counter] .

The structure can be explored in the console with

x = BrainPortal.first.meta[:stats]

The structure can also be shown by browsing to /platform/detailed_stats

prioux commented 2 years ago

Implemented in https://github.com/aces/cbrain/commit/a46bed2d34bdabdae4f5d245ceeb42414d3feab3