Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Custom Metrics

SPM gives ability for lets users to extend standard reports using custom metrics.

...

  • A "data point" is the value associated with some (metric, filter1, filter2) combination.  Some examples:
    • ("cpuIdle", server="server1", null) = 90
    • ("cpuIdle", server="server1", null) = 90 – this is a distinct data point for the same metric as in the previous line

Introduction

Data point is represented using parametersA data point has the following attributes

  • timestamp - Time time since "Epoch" in milliseconds
  • name - Name name of metric
  • value - Double double value
  • aggregation type - min, max, avg, sum
  • filter1 value - String string value for filter1
  • filter2 value - String string value for filter2

Custom metrics report displays reports display values , that aggregated using 'aggregation type' for selected granularity. For example, sent values 1.0, 2.0, and 3.0 sent during one minute with average ('avg') aggregation type will be represented by one point a single point on a graph, with value 32.0 on plot for this that minute.

Filter1 and filter2 values can be used to organize complex metrics, for example to measure .  For example, one can use them to track registered users count by gender and account type. In registered users example data points can be specified as: 

Code Block
languagejavascript
{
   "name" : "registered-users-count", 
   "value" : 42, 
   "aggregation" : "sum",
   "filter1" : "user.gender=male",
   "filter2" : "account.type=free"
}
 
{
   "name" : "registered-users-count", 
   "value" : 24, 
   "aggregation" : "sum",
   "filter1" : "user.gender=female",
   "filter2" : "account.type=free"
}
 
{
   "name" : "registered-users-count", 
   "value" : 10, 
   "aggregation" : "sum",
   "filter1" : "user.gender=female",
   "filter2" : "account.type=paid"
}

In report page reports, the selected values in one filter are threated as combined with an 'OR' and , while selected values in both as 'ANDdifferent values are 'ANDed'. For example, to display count the number of female users, in filter1 the value 'female' should be selected, to display female paid users in filter1 should be selected 'female' and in filter2 'paid'.

...

http://spm-receiver.sematext.com/receiver/custom/receive.[format]?token=[spm app token] List of tokens per application available at settings page: 

The format can be either 'json' or 'raw'.

Applications' tokens are listed at https://apps.sematext.com/users-web/home.do?homeTab=spm

Supported two formats: 'json' and 'raw'.

...

JSON format

UrlURL: http://spm-receiver.sematext.com/receiver/custom/receive.json?token=[spm app token]

Content-type: application/json

Method: POST

 

Json JSON body:

Field nameField typeConstraints
datapointsarray of 'data point'elements count <= 100

...

To send metrics using curl, save example above to a file named "datapoints.json" and submit it with the following call, using your own token:

Code Block
languagebash
curl -v -H 'Content-type: application/json' -d @datapoints.json http://spm-receiver.sematext.com/receiver/custom/receive.json?token=[spm app token]

Raw format

UrlURL: http://spm-receiver.sematext.com/receiver/custom/receive.raw?token=[spm app token]

Content-type: text/planplain

Method: POST

Each line is tab delimited sequence of fields:

...

Code Block
languagenone
1369671381221	registered-users-count	1	sum	user.gender=male	account.type=free
1369671381221	registered-users-count	1	sum	user.gender=female	account.type=paid

To post metrics these data using curl, save the example above (take care about ensure tabs are preserved) to a file named datapoints.raw .and use the following with your own token:

Code Block
languagebash
curl -v -H 'Content-type: text/plain' -d @datapoints.raw http://spm-receiver.sematext.com/receiver/custom/receive.raw?token=[spm app token]

...

Sematext-metrics is open source library for sending custom metrics from java application. Please refer to README for quick start.

Limitations

There are limitations by datapoints count per month and metrics count mer month. Please refer to our page with plans description.

 

 Each SPM plan allows for a different number of metrics and a different number of datapoints per calendar month.  Please see SPM Plans page.