influxdata / influxdata/kapacitor
err=“invalid math operator + for type missing” in tickscript kapacitor
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Hi ,
> Error:
> ts=2019-09-06T08:45:00.215+02:00 lvl=error msg=“error evaluating expression” service=kapacitor task_master=main task=wincalculator node=influxdb_out16 err=“invalid math operator + for type missing”
> ts=2019-09-06T08:45:00.215+02:00 lvl=error msg=“error evaluating expression” service=kapacitor task_master=main task=wincalculator node=influxdb_out16 err=“invalid math operator * for type missing”
```
dbrp "telegraf"."200_days"
var cpu_user = batch
|query('SELECT 100 - last(Percent_Idle_Time) FROM "telegraf"."200_days".win_cpu where bu=\'DGFF\' and instance=\'_Total\'')
.period(5m)
.every(5m)
.groupBy('solution','service','environment','host')
.align()
.fill(0.0)
|log()
|sideload()
.source('file:/appl/grafana/influx/kapacitor/conf/load/tasks/sideload')
.order('{{.host}}.yml')
.field('cpuval', 10.0)
var memusage = batch
|query(''' SELECT last(Committed_Bytes) as commitedbytes,last(Available_Bytes) as availablebytes FROM "telegraf"."200_days".win_mem where bu='DGFF' ''')
.period(5m)
.every(5m)
.groupBy('solution','service','environment','host')
.align()
.fill(0.0)
|log()
|sideload()
.source('file:/appl/grafana/influx/kapacitor/conf/load/tasks/sideload')
.order('{{.host}}.yml')
.field('memval', 10.0)
var swapusage = batch
|query('SELECT last(Percent_Usage) FROM "telegraf"."200_days".win_swap where bu=\'DGFF\'')
.period(5m)
.every(5m)
.groupBy('solution','service','environment','host')
.align()
.fill(0.0)
|log()
|sideload()
.source('file:/appl/grafana/influx/kapacitor/conf/load/tasks/sideload')
.order('{{.host}}.yml')
.field('swapval', 10.0)
var cpuUsage=cpu_user
var memUsage=memusage
var swapUsage=swapusage
var Health_Score = cpuUsage
|join(memUsage,swapUsage)
.as('cpuUsage','memUsage','swapUsage')
.fill(0.0)
|eval(lambda: ("memUsage.commitedbytes" / ("memUsage.availablebytes" + "memUsage.commitedbytes")) * 100.0).as('memHealth')
|eval(
lambda: (100.0-("cpuUsage.last" * "cpuUsage.cpuval")/10.0),
lambda: (100.0-("memHealth" * "memUsage.memval")/10.0),
lambda: (100.0-("swapUsage.last" * "swapUsage.swapval")/10.0)
).as('cpuHealth','memhealth','swaphealth')
|influxDBOut()
.cluster('name')
.create()
.database('testdb')
.retentionPolicy('myrp')
.measurement('measurement')
```
Help me to solve the issue . I think the problem with win_mem batch. when i try to run the script without win_mem batch its running fine .
and if i make last() like below its working good.
` SELECT last(Committed_Bytes) FROM "telegraf"."200_days".win_mem where bu='DGFF'`
and in eval
`lambda: (100.0-("memUsage.last" * "memUsage.memval")/10.0)`
Thanks
Contributor guide
Research direction
Reproduce the task using the win_mem query and the eval expression, then compare it with the working last-only variant described in the issue. Trace how the win_mem fields reach the join and expression evaluation, and use the reported invalid missing-type error as the failure criterion. Done means the original task evaluates without the missing-type errors while preserving the working behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100