Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-49887

Change /events endpoint behavior

    XMLWordPrintable

Details

    • Task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • Neo
    • ns_server
    • None
    • 1

    Description

      Currently when "GET /events" is called we return as a default, 250 event logs starting at the oldest entry in the log. The intention to do it that way to begin with was, if a user wanted to get all the logs as batch (batch-1), they would call "GET /events" and chain future requests via "GET /events?sinceTime="time-on-most-recent-log-in-batch-1".

      But that is essential not needed now since we have /eventsStreaming endpoint.

      Based on feedback from Meni Hillel - "GET /events" will now return the most recent 250 entries. Similarly "GET /events?limit=300" will return the most recent 300 entries. 

      The behavior for GET /events?limit=XXX&sinceTime=YYY remains the same and will return XXX entries starting from YYY time.

      cc: Ashwin Govindarajulu.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          #UNIT-TEST#

          curl -X GET -u Administrator:asdasd '127.0.0.1:9000/events?limit=-1' | jq '.events[17:19]'

           
          1) Retrieve all the event via /events?limit=-1 and print the most recent 2 logs.
           
          [
            {
              "component": "analytics",
              "uuid": "ae2ca15d-e75c-413d-9def-a57cac152573",
              "timestamp": "2021-12-03T20:09:26.888Z",
              "sub_component": "cbas",
              "severity": "info",
              "event_id": 5125,
              "description": "Analytics Topology Change Completed",
              "extra_attributes": {
                "topology": {
                  "id": "fd8133921435ef33c2d59e8e98b0b175",
                  "num_eject_nodes": 0,
                  "num_keep_nodes": 1,
                  "type": "topology-change-rebalance"
                }
              },
              "node": "127.0.0.1",
              "otp_node": "n_0@127.0.0.1"
            },
            {
              "component": "analytics",
              "uuid": "019ece5a-444e-41a4-9bd3-fd28b30d2485",
              "timestamp": "2021-12-03T20:09:28.926Z",
              "sub_component": "cbas",
              "severity": "info",
              "event_id": 5120,
              "description": "Analytics Process Started",
              "extra_attributes": {
                "process_name": "java",
                "process_pid": 9221
              },
              "node": "127.0.0.1",
              "otp_node": "n_0@127.0.0.1"
            }
          ]
          
          

          Retrieve the most 2 recent event logs via /events?limit=2

          curl -X GET -u Administrator:asdasd '127.0.0.1:9000/events?limit=2' | jq

           
          {
            "events": [
              {
                "component": "analytics",
                "uuid": "019ece5a-444e-41a4-9bd3-fd28b30d2485",
                "timestamp": "2021-12-03T20:09:28.926Z",
                "sub_component": "cbas",
                "severity": "info",
                "event_id": 5120,
                "description": "Analytics Process Started",
                "extra_attributes": {
                  "process_name": "java",
                  "process_pid": 9221
                },
                "node": "127.0.0.1",
                "otp_node": "n_0@127.0.0.1"
              },
              {
                "timestamp": "2021-12-03T20:09:35.097Z",
                "component": "analytics",
                "severity": "info",
                "event_id": 5284,
                "description": "Analytics Partitions Topology Updated",
                "extra_attributes": {
                  "revision": 0,
                  "balanced": true,
                  "num_replicas": 0
                },
                "uuid": "00e61e9a-0a1b-4bb8-acdd-2638563460da",
                "node": "127.0.0.1",
                "otp_node": "n_0@127.0.0.1"
              }
            ]
          }
          
          

          #UNIT-TEST#

          hareen.kancharla Hareen Kancharla added a comment - #UNIT-TEST# curl -X GET -u Administrator:asdasd '127.0.0.1:9000/events?limit=-1' | jq '.events [17:19] '   1) Retrieve all the event via /events?limit=-1 and print the most recent 2 logs.   [   {     "component": "analytics",     "uuid": "ae2ca15d-e75c-413d-9def-a57cac152573",     "timestamp": "2021-12-03T20:09:26.888Z",     "sub_component": "cbas",     "severity": "info",     "event_id": 5125,     "description": "Analytics Topology Change Completed",     "extra_attributes": {       "topology": {         "id": "fd8133921435ef33c2d59e8e98b0b175",         "num_eject_nodes": 0,         "num_keep_nodes": 1,         "type": "topology-change-rebalance"       }     },     "node": "127.0.0.1",     "otp_node": "n_0@127.0.0.1"   },   {     "component": "analytics",     "uuid": "019ece5a-444e-41a4-9bd3-fd28b30d2485",     "timestamp": "2021-12-03T20:09:28.926Z",     "sub_component": "cbas",     "severity": "info",     "event_id": 5120,     "description": "Analytics Process Started",     "extra_attributes": {       "process_name": "java",       "process_pid": 9221     },     "node": "127.0.0.1",     "otp_node": "n_0@127.0.0.1"   } ] Retrieve the most 2 recent event logs via /events?limit=2 curl -X GET -u Administrator:asdasd '127.0.0.1:9000/events?limit=2' | jq   {   "events": [     {       "component": "analytics",       "uuid": "019ece5a-444e-41a4-9bd3-fd28b30d2485",       "timestamp": "2021-12-03T20:09:28.926Z",       "sub_component": "cbas",       "severity": "info",       "event_id": 5120,       "description": "Analytics Process Started",       "extra_attributes": {         "process_name": "java",         "process_pid": 9221       },       "node": "127.0.0.1",       "otp_node": "n_0@127.0.0.1"     },     {       "timestamp": "2021-12-03T20:09:35.097Z",       "component": "analytics",       "severity": "info",       "event_id": 5284,       "description": "Analytics Partitions Topology Updated",       "extra_attributes": {         "revision": 0,         "balanced": true,         "num_replicas": 0       },       "uuid": "00e61e9a-0a1b-4bb8-acdd-2638563460da",       "node": "127.0.0.1",       "otp_node": "n_0@127.0.0.1"     }   ] } #UNIT-TEST#

          Build couchbase-server-7.1.0-1839 contains ns_server commit bea2029 with commit message:
          MB-49887 Return the most recent event logs when no query params ...

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.1.0-1839 contains ns_server commit bea2029 with commit message: MB-49887 Return the most recent event logs when no query params ...

          People

            hareen.kancharla Hareen Kancharla
            hareen.kancharla Hareen Kancharla
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty