Since we are focusing on measuring, we need a tool to help us collect metric data, also provide analytics and visualization.
Measurement & Metric is this tool which can easily:
- Creating a new metric
- Collecting data(Manually & Automatically)
- Analyzing metric
- A great visualization
-
MongoDB:
brew install mongodb
-
Configuration for dbpath:
sudo mkdir -p /data/db sudo chmod 0755 /data/db sudo chown {userName}:staff /data/db
-
-
NodeJS:
brew install node
-
NPM:
npm install
- Start MongoDB:
mongod
ornohup mongod &
- Start App:
node app.js
ornodemon app.js
orsudo MM_PORT=80 NODE_ENV=production forever start app.js
-
Category:
Normal
means this metric can only be recorded manually,Schedule
means this metric can only be recorded automatically. -
Name: The unique name of this metric. Cannot be empty.
-
Unit: The unit of this metric, such as
mins
,hours
,times
,etc.
. Can be empty. -
Description: The description for this metric. Can be empty.
-
CountMethod: How to count the data in the time frame.
Total()
means we need the total count,Avg()
means we want the average value,Max()
means we need the maximum one,Min()
means we need the minimum one. -
Types: Define the types of the metric. Such as the Story metric have 2 types,
UserStory
andBug
, we putUserStory;Bug
here. The analysis is based on this metric type. Can be empty. -
Alias: Give a alias field name for Type, which make the field
Type
has more sense, such asStoryType
. Can be empty, default toType
. -
Fields: Define additional fields for te metric. We we want to store a
StoryNo
and aStoryName
of Story metric, we can putStoryNo;StoryName
here. Can be empty. -
StsField: Statistics data (Group data to show the charts) by field value, such as
StoryNo
. Can be empty. -
StsAll: Does the trend chart show the line
All
. -
API(
Schedule
only): API url of schedule job, the schedule job will hit this API automatically. Can be empty, that means this job doesn't require any API. -
Username(
Schedule
only): Username for base authentication. Can be empty. -
Password(
Schedule
only): Password for base authentication. Can be empty. -
JS Method(
Schedule
only): An anonymous JavaScript function to process the result from API. The function looks like:function(apiResult, lastRecord, _) { ... return { metricValue: 1, metricType: 'typeA', otherField: '...' }; }
- apiResult:
JsonObject
, if the result form API cannot be parse to JSON, this is aString
. - lastRecord:
JsonObject
, the latest record of this metric, usually this object can provide some useful data. - _:
underscore
object. - return value: null / an object / an array. If return
null
, no record will be stored. If returnObject
, the object will be stored. If returnArray
, all elements will be stored.metricValue
is the number we need count, default to 1.metricType
is the type defined inTypes
, also can store what every you want.
- apiResult:
-
Frequency(
Schedule
only): A cron pattern to define the schedule, UTC time. -
TimeFrame: A default time window, metric analysis based on this TimeFrame.