Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check does not return threshold type, value, within, min and max #288

Closed
abhi1693 opened this issue Jul 17, 2021 · 1 comment · Fixed by #290
Closed

Check does not return threshold type, value, within, min and max #288

abhi1693 opened this issue Jul 17, 2021 · 1 comment · Fixed by #290
Labels
bug Something isn't working
Milestone

Comments

@abhi1693
Copy link
Contributor

abhi1693 commented Jul 17, 2021

For the same check, the python library does not return the complete threshold object. See the responses captured below.

Steps to reproduce:

from influxdb_client import ChecksService
ChecksService().get_checks_id(check_id="07d91e850309c000")

Expected behavior:
image

Response captured from the developer console

{
   "checks":[
      {
         "id":"07d91e850309c000",
         "name":"threshold check",
         "ownerID":"x",
         "orgID":"x",
         "query":{
            "text":"from(bucket: \"things\")\n  |\u003e range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |\u003e filter(fn: (r) =\u003e r[\"_measurement\"] == \"streams\")\n  |\u003e filter(fn: (r) =\u003e r[\"_field\"] == \"v\")\n  |\u003e filter(fn: (r) =\u003e r[\"identifier\"] == \"ain_p1\")\n  |\u003e filter(fn: (r) =\u003e r[\"mac\"] == \"b827ebc5308a\")\n  |\u003e aggregateWindow(every: 1m, fn: last, createEmpty: false)\n  |\u003e yield(name: \"last\")",
            "editMode":"builder",
            "name":"",
            "builderConfig":{
               "buckets":[
                  "things"
               ],
               "tags":[
                  {
                     "key":"_measurement",
                     "values":[
                        "streams"
                     ],
                     "aggregateFunctionType":"filter"
                  },
                  {
                     "key":"_field",
                     "values":[
                        "v"
                     ],
                     "aggregateFunctionType":"filter"
                  },
                  {
                     "key":"identifier",
                     "values":[
                        "ain_p1"
                     ],
                     "aggregateFunctionType":"filter"
                  },
                  {
                     "key":"mac",
                     "values":[
                        "b827ebc5308a"
                     ],
                     "aggregateFunctionType":"filter"
                  },
                  {
                     "key":"product",
                     "values":[
                        
                     ],
                     "aggregateFunctionType":"filter"
                  }
               ],
               "functions":[
                  {
                     "name":"last"
                  }
               ],
               "aggregateWindow":{
                  "period":"1m",
                  "fillValues":false
               }
            }
         },
         "statusMessageTemplate":"Check: ${ r._check_name } is: ${ r._level }",
         "every":"1m",
         "offset":"0s",
         "tags":[
            
         ],
         "createdAt":"2021-07-17T12:41:48.3001607Z",
         "updatedAt":"2021-07-17T12:41:48.3001607Z",
         "thresholds":[
            {
               "allValues":false,
               "level":"CRIT",
               "value":8.223,
               "type":"greater"
            }
         ],
         "type":"threshold",
         "labels":[
            
         ],
         "links":{
            "self":"/api/v2/checks/07d91e850309c000",
            "labels":"/api/v2/checks/07d91e850309c000/labels",
            "members":"/api/v2/checks/07d91e850309c000/members",
            "owners":"/api/v2/checks/07d91e850309c000/owners",
            "query":"/api/v2/checks/07d91e850309c000/query"
         },
         "status":"active",
         "latestCompleted":"2021-07-17T12:42:00Z",
         "latestScheduled":"2021-07-17T12:42:00Z",
         "lastRunStatus":"success"
      }
   ],
   "links":{
      "self":"/api/v2/checks?descending=false\u0026limit=100\u0026offset=0\u0026orgID=c144bc298a525db6"
   }
}

Actual behavior:
Response captured via python library

{
   "type":"threshold",
   "thresholds":[
      {
         "level":"CRIT",
         "all_values":false
      }
   ],
   "every":"1m",
   "offset":"0s",
   "tags":[
      
   ],
   "status_message_template":"Check: ${ r._check_name } is: ${ r._level }",
   "id":"07d91e850309c000",
   "name":"threshold check",
   "org_id":"x",
   "task_id":"None",
   "owner_id":"x",
   "created_at":datetime.datetime(2021,
   7,
   17,
   12,
   41,
   48,
   300160,
   "tzinfo=tzlocal())",
   "updated_at":datetime.datetime(2021,
   7,
   17,
   12,
   41,
   48,
   300160,
   "tzinfo=tzlocal())",
   "query":{
      "text":"from(bucket: \"things\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"_measurement\"] == \"streams\")\n  |> filter(fn: (r) => r[\"_field\"] == \"v\")\n  |> filter(fn: (r) => r[\"identifier\"] == \"ain_p1\")\n  |> filter(fn: (r) => r[\"mac\"] == \"b827ebc5308a\")\n  |> aggregateWindow(every: 1m, fn: last, createEmpty: false)\n  |> yield(name: \"last\")",
      "edit_mode":"builder",
      "name":"",
      "builder_config":{
         "buckets":[
            "things"
         ],
         "tags":[
            {
               "key":"_measurement",
               "values":[
                  "streams"
               ],
               "aggregate_function_type":"filter"
            },
            {
               "key":"_field",
               "values":[
                  "v"
               ],
               "aggregate_function_type":"filter"
            },
            {
               "key":"identifier",
               "values":[
                  "ain_p1"
               ],
               "aggregate_function_type":"filter"
            },
            {
               "key":"mac",
               "values":[
                  "b827ebc5308a"
               ],
               "aggregate_function_type":"filter"
            },
            {
               "key":"product",
               "values":[
                  
               ],
               "aggregate_function_type":"filter"
            }
         ],
         "functions":[
            {
               "name":"last"
            }
         ],
         "aggregate_window":{
            "period":"1m",
            "fill_values":false
         }
      }
   },
   "status":"active",
   "description":"None",
   "latest_completed":datetime.datetime(2021,
   7,
   17,
   12,
   47,
   "tzinfo=tzlocal())",
   "last_run_status":"success",
   "last_run_error":"None",
   "labels":[
      
   ],
   "links":{
      "_self":"/api/v2/checks/07d91e850309c000",
      "labels":"/api/v2/checks/07d91e850309c000/labels",
      "members":"/api/v2/checks/07d91e850309c000/members",
      "owners":"/api/v2/checks/07d91e850309c000/owners",
      "query":"/api/v2/checks/07d91e850309c000/query"
   }
}

Specifications:

  • Client Version: 1.18.0
  • InfluxDB Version: 2.0.7
  • Platform: Linux
@bednar bednar added the bug Something isn't working label Jul 19, 2021
@bednar
Copy link
Contributor

bednar commented Jul 19, 2021

@abhi1693 thanks for using our client, we will take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants