Create a metric definition that you will upload to Measure.
A metric definition is a JSON object, which is a collection of name-value pairs. For information
about the structure of metric definitions, see Implementing custom metrics. For information about
JSON itself, visit the JSON
organization.
To define a metric definition, you set chart defaults and specify an ID that Measure can use to associate metric records with the metric type. When you are done,
you will use the definition in a curl command that loads it into the product.
To create a metric definition, complete the following steps:
-
Open a text editor and save the blank file as a JSON-type file, for example
myMetricDefinition.json.
-
In myMetricDefinition.json, define the ID for the metric definition:
"id": "TUTORIAL_DEFINITION",.
The ID can contain any string value.
-
On the second line, specify a name for the metric definition:
"name": "Tutorial
definition",.
The name property can contain any string value. Metric records can be associated with metric
definitions by using the name or ID properties.
-
Specify the metric category:
"category": "quality",.
This string-type property defines the category to which the metric definition belongs. The
categories are listed in the Add charts area of the
Dashboards page. Possible values include: quality,
deliveryFlow, risk, team, and
effort. The chart that we create in this tutorial will be added to the list of
Quality charts.
-
Specify the tenant ID:
tenantId":"my_UCV_TenantID.
-
Specify the chart default properties.
This JSON object sets the chart type and determines how data is grouped. The tutorial chart
aggregates data by result. Other groupings, such as team, status, or name, can be useful
for other data types. Currently,
Measure provides line- and bar-type graphs. Set the default chart type to bar but
users can change it after you add the chart to the dashboard.
"chartDefaults":{
"groupBy":"result",
"chartType":"bar",
"barMode": "stack"
},
-
Set the aggregation operation property.
"aggregation":{
"operation":"sum"
}
This property sets the default aggregation logic that is used when multiple records are
loaded.
-
Save the metric definition.
The metric definition that you created will be applied to the data record sent to Measure in a later lesson.
The following code fragment shows the metric definition that we created in this lesson.
{
"id": "TUTORIAL_DEFINITION",
"name":"Tutorial Definition",
"category": "quality",
"tenantId":"my_tenant_id",
"chartDefaults":{
"groupBy":"result",
"chartType":"bar",
"barMode": "stack"
},
"aggregation":{
"operation":"sum"
}
}
In the next lesson, we create a curl request with the metric definition and load the
definition into Measure.