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

REST api/v1/status needs single function filter

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      The following will return an array of every function

      curl -X GET -s 'http://'${CB_USERNAME}:${CB_PASSWORD}'@localhost:8096/api/v1/status'

      some way to select just a single function would be beneficial for CI CD pipelines.

      Attachments

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

        Activity

          jeelan.poola Jeelan Poola added a comment -

          It's a simple change. We need to add function-filter to /api/v1/status end point.

          jeelan.poola Jeelan Poola added a comment - It's a simple change. We need to add function-filter to /api/v1/status end point.

          You're welcome, Jon Strabala.

           

          Regarding the filter, I've a couple questions:

          • Currently, we have a 'retrieve status of all functions'.
          • This MB is asking for 'retrieve status of a specific function'

           

          Would we have a need to 'retrieve status of a list of functions'? Something like:

          • curl -X GET  'http://'${CB_USERNAME}:${CB_PASSWORD}'@localhost:8096/api/v1/status?name=function_bot_detect&name=function_geocode_ip'

           

          Across all of the Eventing services, do we follow a consistent approach to such filters?

           

          Even if that's not something that we necessarily want to do now, but we feel it may come up later on, I will prefer to have the service response for this MB still return an array, with a single element. That would make it easy to support retrieving the status of a list of services - just more elements in the array.

           

          Please let me know...

           

          Thanks!

          srinivasan.raman Srinivasan Raman added a comment - You're welcome, Jon Strabala .   Regarding the filter, I've a couple questions: Currently, we have a 'retrieve status of all functions'. This MB is asking for 'retrieve status of a specific function'   Would we have a need to 'retrieve status of a list of functions'? Something like: curl -X GET  'http://'${CB_USERNAME}:${CB_PASSWORD}'@localhost:8096/api/v1/status?name=function_bot_detect&name=function_geocode_ip'   Across all of the Eventing services, do we follow a consistent approach to such filters?   Even if that's not something that we necessarily want to do now, but we feel it may come up later on, I will prefer to have the service response for this MB still return an array, with a single element. That would make it easy to support retrieving the status of a list of services - just more elements in the array.   Please let me know...   Thanks!
          srinivasan.raman Srinivasan Raman added a comment - - edited

          Changes done to provide the following behavior:

           

          1. When a function name is passed in the query parameter "name", the status of just that function is returned.

          $ curl "http://${CB_USERNAME}:${CB_PASSWORD}@127.0.0.1:9300/api/v1/status?name=f01"
          {
           "app": {
            "composite_status": "deployed",
            "name": "f01",
            "num_bootstrapping_nodes": 0,
            "num_deployed_nodes": 1,
            "deployment_status": true,
            "processing_status": true
           },
           "num_eventing_nodes": 1
          }
          

           

          2. If invoked with the name of a function that does not exist, an error will be returned, as shown below:

          $ curl "http://${CB_USERNAME}:${CB_PASSWORD}@127.0.0.1:9300/api/v1/status?name=f01-doesnotexist"
          {
           "name": "ERR_APP_NOT_FOUND",
           "code": 53,
           "description": "Function not found",
           "attributes": null,
           "runtime_info": {
            "code": 53,
            "info": "Function: f01-doesnotexist not found"
           }
          }

           

          Thanks!

           

           

          srinivasan.raman Srinivasan Raman added a comment - - edited Changes done to provide the following behavior:   1. When a function name is passed in the query parameter "name", the status of just that function is returned. $ curl "http://${CB_USERNAME}:${CB_PASSWORD}@127.0.0.1:9300/api/v1/status?name=f01" { "app" : {   "composite_status" : "deployed" ,   "name" : "f01" ,   "num_bootstrapping_nodes" : 0 ,   "num_deployed_nodes" : 1 ,   "deployment_status" : true ,   "processing_status" : true }, "num_eventing_nodes" : 1 }   2. If invoked with the name of a function that does not exist, an error will be returned, as shown below: $ curl "http://${CB_USERNAME}:${CB_PASSWORD}@127.0.0.1:9300/api/v1/status?name=f01-doesnotexist" { "name" : "ERR_APP_NOT_FOUND" , "code" : 53 , "description" : "Function not found" , "attributes" : null , "runtime_info" : {   "code" : 53 ,   "info" : "Function: f01-doesnotexist not found" } }   Thanks!    

          Hi Jon Strabala, sorry I did not quite notice the way you had specified the URL in your comment dated 29th Oct, 2020. I'll update the change to support the following:

          curl "http://${CB_USERNAME}:${CB_PASSWORD}@127.0.0.1:9300/api/v1/status/f01"
          

          Thanks!

          srinivasan.raman Srinivasan Raman added a comment - Hi Jon Strabala , sorry I did not quite notice the way you had specified the URL in your comment dated 29th Oct, 2020. I'll update the change to support the following: curl "http://${CB_USERNAME}:${CB_PASSWORD}@127.0.0.1:9300/api/v1/status/f01" Thanks!

          +1 for keeping /api/v1/status/f01 style. Thanks a lot!

          siri Sriram Melkote (Inactive) added a comment - +1 for keeping /api/v1/status/f01 style. Thanks a lot!
          srinivasan.raman Srinivasan Raman added a comment - - edited

          Changes done to provide the following behaviour:

           

          1. When a function name is passed in the URI, the status of just that function is returned.

           

          $ curl "http://${CB_USERNAME}:${CB_PASSWORD}@127.0.0.1:9300/api/v1/status/f01"
          {
           "app": {
            "composite_status": "deployed",
            "name": "f01",
            "num_bootstrapping_nodes": 0,
            "num_deployed_nodes": 1,
            "deployment_status": true,
            "processing_status": true
           },
           "num_eventing_nodes": 1
          }
          

          2. If invoked with the name of a function that does not exist, an error will be returned, as shown below:

           

          $ curl "http://${CB_USERNAME}:${CB_PASSWORD}@127.0.0.1:9300/api/v1/status/f01-doesnotexist"
          {
           "name": "ERR_APP_NOT_FOUND_TS",
           "code": 13,
           "description": "Function not found in temporary store",
           "attributes": null,
           "runtime_info": {
            "code": 13,
            "info": "Function: f01-doesnotexist not found"
           }
          }
          

          I've modified the error code to ERR_APP_NOT_FOUND_TS instead of ERR_APP_NOT_FOUND to keep it consistent with the other public APIs.

          Thanks!

           

          srinivasan.raman Srinivasan Raman added a comment - - edited Changes done to provide the following behaviour:   1. When a function name is passed in the URI, the status of just that function is returned.   $ curl "http://${CB_USERNAME}:${CB_PASSWORD}@127.0.0.1:9300/api/v1/status/f01" { "app" : { "composite_status" : "deployed" , "name" : "f01" , "num_bootstrapping_nodes" : 0 , "num_deployed_nodes" : 1 , "deployment_status" : true , "processing_status" : true }, "num_eventing_nodes" : 1 } 2. If invoked with the name of a function that does not exist, an error will be returned, as shown below:   $ curl "http://${CB_USERNAME}:${CB_PASSWORD}@127.0.0.1:9300/api/v1/status/f01-doesnotexist" { "name" : "ERR_APP_NOT_FOUND_TS" , "code" : 13 , "description" : "Function not found in temporary store" , "attributes" : null , "runtime_info" : { "code" : 13 , "info" : "Function: f01-doesnotexist not found" } } I've modified the error code to ERR_APP_NOT_FOUND_TS instead of ERR_APP_NOT_FOUND to keep it consistent with the other public APIs. Thanks!  

          Build couchbase-server-7.0.0-3663 contains eventing commit 72d225b with commit message:
          MB-42177: Add single function filter to status endpoint

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.0.0-3663 contains eventing commit 72d225b with commit message: MB-42177 : Add single function filter to status endpoint
          sujay.gad Sujay Gad added a comment -

          Verified using Couchbase Server 7.0.0 - 4226
          api/v1/status/[function_name] can be used to check details about particular function.

          sujay.gad Sujay Gad added a comment - Verified using Couchbase Server 7.0.0 - 4226 api/v1/status/ [function_name]  can be used to check details about particular function.

          People

            srinivasan.raman Srinivasan Raman
            jon.strabala Jon Strabala
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty