Skip to content

Add node stats api#9925

Closed
ruflin wants to merge 1 commit intoelastic:masterfrom
ruflin:node-page
Closed

Add node stats api#9925
ruflin wants to merge 1 commit intoelastic:masterfrom
ruflin:node-page

Conversation

@ruflin
Copy link
Copy Markdown
Contributor

@ruflin ruflin commented Jan 18, 2017

This adds an api page under /api/_node which provides the basic status information about the running Kibana node.

Example Event

An event exposed by the /api/_node looks as following:

{
   "name":"ruflin",
   "version":"6.0.0-alpha1",
   "build":{
      "num":8467,
      "sha":"6cb7fec4e154faa0a4a3fee4b33dfef91b9870d9"
   },
   "uuid":"5b2de169-2785-441b-ae8c-186a1936b17d",
   "heap":{
      "total":125079552,
      "used":87140680,
      "rss":150970368
   },
   "connections":0,
   "requests":{
      "total":2,
      "disconnects":0,
      "statusCodes":{
         "200":2
      }
   }
}

@epixa epixa added Team:Operations Kibana-Operations Team review v5.3.0 labels Jan 18, 2017
@epixa epixa changed the title Add node stats page Add node stats api Jan 18, 2017
@jbudz jbudz self-assigned this Jan 18, 2017
Comment thread src/server/status/metrics.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how would you feel about making these field names consistent with the monitoring format? i could see us eventually consolidating these.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As quickly discussed, this is based on the metricbeat naming conventions: https://www.elastic.co/guide/en/beats/libbeat/5.1/event-conventions.html

@tylersmalley tylersmalley self-assigned this Jan 19, 2017
tylersmalley
tylersmalley previously approved these changes Jan 23, 2017
Copy link
Copy Markdown
Member

@tylersmalley tylersmalley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing, this LGTM

@tylersmalley tylersmalley dismissed their stale review January 23, 2017 15:12

Metric beat is collecting os level stats, we were going to remove kbnServer.stats.memory. Since this isn't general enough to also handle monitorings use we should remove from the kbnServer object.

@alexbrasetvik
Copy link
Copy Markdown
Contributor

For Cloud, we probably don't want to display system load and memory.

@ruflin
Copy link
Copy Markdown
Contributor Author

ruflin commented Jan 24, 2017

I updated the PR and put an example event in the PR description.

This adds an api page under `/api/_node` which provides the basic status information about the running Kibana node.

**Example Event**

An event exposed by the `/api/_node` looks as following:

```
{
   "name":"ruflin",
   "version":"6.0.0-alpha1",
   "build":{
      "num":8467,
      "sha":"6cb7fec4e154faa0a4a3fee4b33dfef91b9870d9"
   },
   "uuid":"5b2de169-2785-441b-ae8c-186a1936b17d",
   "heap":{
      "total":125079552,
      "used":87140680,
      "rss":150970368
   },
   "connections":0,
   "requests":{
      "total":2,
      "disconnects":0,
      "statusCodes":{
         "200":2
      }
   }
}
```
@tylersmalley
Copy link
Copy Markdown
Member

@ruflin, I did some digging today. It appears there is already an API endpoint for the status page.

screenshot 2017-01-24 20 46 56

And the response for that page:

{
   "name":"tsmalley",
   "version":"6.0.0-alpha1",
   "buildNum":8467,
   "buildSha":"6cb7fec4e154faa0a4a3fee4b33dfef91b9870d9",
   "uuid":"5b2de169-2785-441b-ae8c-186a1936b17d",
   "status":{
      "overall":{
         "state":"green",
         "title":"Green",
         "nickname":"Looking good",
         "icon":"success",
         "since":"2017-01-24T23:33:49.559Z"
      },
      "statuses":[
         {
            "id":"ui settings",
            "state":"green",
            "icon":"success",
            "message":"Ready",
            "since":"2017-01-24T23:33:50.839Z"
         },
         {
            "id":"plugin:kibana@6.0.0-alpha1",
            "state":"green",
            "icon":"success",
            "message":"Ready",
            "since":"2017-01-24T23:33:49.559Z"
         },
         {
            "id":"plugin:elasticsearch@6.0.0-alpha1",
            "state":"green",
            "icon":"success",
            "message":"Kibana index ready",
            "since":"2017-01-24T23:33:49.678Z"
         },
         {
            "id":"plugin:console@6.0.0-alpha1",
            "state":"green",
            "icon":"success",
            "message":"Ready",
            "since":"2017-01-24T23:33:49.642Z"
         },
         {
            "id":"plugin:timelion@6.0.0-alpha1",
            "state":"green",
            "icon":"success",
            "message":"Ready",
            "since":"2017-01-24T23:33:50.829Z"
         }
      ]
   },
   "metrics":{
      "heapTotal":[
         [
            1485319608461,
            84135936
         ],
         [
            1485319603459,
            84135936
         ],
         [
            1485319598455,
            84135936
         ],
         [
            1485319593454,
            84135936
         ],
         [
            1485319588460,
            83087360
         ],
         [
            1485319583451,
            83087360
         ],
         [
            1485319578450,
            83087360
         ],
         [
            1485319573459,
            83087360
         ],
         [
            1485319568440,
            83087360
         ],
         [
            1485319563453,
            83087360
         ],
         [
            1485319558437,
            83087360
         ],
         [
            1485319553428,
            83087360
         ]
      ],
      "heapUsed":[
         [
            1485319608461,
            74825624
         ],
         [
            1485319603459,
            73827544
         ],
         [
            1485319598455,
            73431560
         ],
         [
            1485319593454,
            73645864
         ],
         [
            1485319588460,
            72885240
         ],
         [
            1485319583451,
            72784640
         ],
         [
            1485319578450,
            72346400
         ],
         [
            1485319573459,
            71913688
         ],
         [
            1485319568440,
            72404776
         ],
         [
            1485319563453,
            71943352
         ],
         [
            1485319558437,
            71510488
         ],
         [
            1485319553428,
            71078272
         ]
      ],
      "load":[
         [
            1485319608461,
            [
               2.36865234375,
               2.3408203125,
               2.24755859375
            ]
         ],
         [
            1485319603459,
            [
               2.48779296875,
               2.36376953125,
               2.25537109375
            ]
         ],
         [
            1485319598455,
            [
               2.53076171875,
               2.3701171875,
               2.25732421875
            ]
         ],
         [
            1485319593454,
            [
               2.4033203125,
               2.3427734375,
               2.2470703125
            ]
         ],
         [
            1485319588460,
            [
               2.3515625,
               2.33203125,
               2.24267578125
            ]
         ],
         [
            1485319583451,
            [
               2.4697265625,
               2.35498046875,
               2.25048828125
            ]
         ],
         [
            1485319578450,
            [
               2.59814453125,
               2.3779296875,
               2.25830078125
            ]
         ],
         [
            1485319573459,
            [
               2.650390625,
               2.384765625,
               2.26025390625
            ]
         ],
         [
            1485319568440,
            [
               2.70751953125,
               2.3916015625,
               2.26220703125
            ]
         ],
         [
            1485319563453,
            [
               2.8564453125,
               2.41552734375,
               2.27001953125
            ]
         ],
         [
            1485319558437,
            [
               2.669921875,
               2.3720703125,
               2.25439453125
            ]
         ],
         [
            1485319553428,
            [
               2.6416015625,
               2.36181640625,
               2.25048828125
            ]
         ]
      ],
      "responseTimeAvg":[
         [
            1485319608461,
            48.5
         ],
         [
            1485319603459,
            null
         ],
         [
            1485319598455,
            null
         ],
         [
            1485319593454,
            3
         ],
         [
            1485319588460,
            7
         ],
         [
            1485319583451,
            null
         ],
         [
            1485319578450,
            null
         ],
         [
            1485319573459,
            null
         ],
         [
            1485319568440,
            null
         ],
         [
            1485319563453,
            null
         ],
         [
            1485319558437,
            null
         ],
         [
            1485319553428,
            null
         ]
      ],
      "responseTimeMax":[
         [
            1485319608461,
            214
         ],
         [
            1485319603459,
            0
         ],
         [
            1485319598455,
            0
         ],
         [
            1485319593454,
            3
         ],
         [
            1485319588460,
            7
         ],
         [
            1485319583451,
            0
         ],
         [
            1485319578450,
            0
         ],
         [
            1485319573459,
            0
         ],
         [
            1485319568440,
            0
         ],
         [
            1485319563453,
            0
         ],
         [
            1485319558437,
            0
         ],
         [
            1485319553428,
            0
         ]
      ],
      "requestsPerSecond":[
         [
            1485319608461,
            1.1992804317409553
         ],
         [
            1485319603459,
            0
         ],
         [
            1485319598455,
            0
         ],
         [
            1485319593454,
            0.2
         ],
         [
            1485319588460,
            0.1998800719568259
         ],
         [
            1485319583451,
            0
         ],
         [
            1485319578450,
            0
         ],
         [
            1485319573459,
            0
         ],
         [
            1485319568440,
            0
         ],
         [
            1485319563454,
            0
         ],
         [
            1485319558437,
            0
         ],
         [
            1485319553428,
            0
         ]
      ]
   }
}

The last ~12 metrics are provided with the timestamp for when they were taken. You can either take the latest or average them out, which is what the status page does.

Thoughts on simply using this?

@ruflin
Copy link
Copy Markdown
Contributor Author

ruflin commented Jan 25, 2017

I'm aware of this api endpoint and it's not fetcher friendly, especially because of the array nature. That is the reason I introduced the new API endpoint.

@jbudz
Copy link
Copy Markdown
Contributor

jbudz commented Feb 3, 2017

Reopened at #10180, closing this one for now.

@jbudz jbudz closed this Feb 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants