Search code examples
graphite

Understanding the graphite response (datapoint) for a summarize query for last 24 hours


Request:

http://example.com:8081/render?format=json&target=summarize(stats.development.com.xxx.operation.yyy.*.*.rate, "24hours", "sum", true)&from=-24hours&tz=UTC

Response:

[{"datapoints":[[0.1,1386198900]],"target":"summarize(stats.development.com.xxx.operation.yyy.5.4.rate, "24hours", "sum", true)"}]

What I wanted was the summary of last 24hours for the stat provided in query.

  • Can you please interpret "datapoint" for me?
  • What does "0.1" mean? What is its logarithmic scale?
  • What does 1386198900 mean?

Solution

  • [{
      "datapoints" : 
                  [[0.1,1386198900]], 
      "target":
                  "summarize(stats.development.com.xxx.operation.yyy.5.4.rate, "24hours", "sum", true)"
    }]
    

    Here, datapoints sent to the metric stats.development.com.xxx.operation.yyy.5.4.rate, when numerically summed on a 24 hour basis, is 0.1 for the epoch 1386198900, which is the system's way of saying Wed, 04 Dec 2013 23:15:00 GMT. The logarithmic scale is not involved here.

    Consider the following example-

    You create a metric- website.about-us-page.hits and start sending data every 10 seconds-

    1386198900: 3
    1386198910: 23
    1386198920: 12
    1386198930: 1
    1386198940: 0
    1386198950: 180
    1386198960: 12
    

    This URL API request to graphite- target=summarize(stats.website.about-us-page.hits, "20seconds", "sum", true) will return something like-

    [{
      "datapoints" : 
                  [[26,1386198900]], // sum of first two points
                  [[13,1386198920]], // sum of next two points
                  [[180,1386198940]],
                  [[12,1386198960]], 
      "target":
                  "summarize(stats.website.about-us-page.hits, "20seconds", "sum", true)"
    }]
    

    summarize() basically helps you see the data in different granularity. Like in cases when you need to know day-wise or hour-wise traffic, rather than on a 10s basis.