influxdata / influxdata/kapacitor
Ensure that errors parsing lambda expressions return correct line numbers and clear errors.
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Hi
I'm trying to create a template that contains vars and stream vars , is there any way to do it? , I'm getting this error :
Failed to handle right node: Given node type is not valid evaluation node:
as soon as I remove the streams vars everything is fine
also is there any way to pass an int variable to the template , int64 is not working
```var warnThreshold string
var criticalThreshold string
var timeWindow duration
var code string
var endpoint string
var totErrors = stream
|from()
.measurement('onboarding-public-api-counters')
|default()
.tag('status', '')
|where(lambda: "entity" == 'http-response' AND "endpoint-name" == endpoint AND "status" == code)
|window()
.period(timeWindow)
.every(timeWindow)
|count('value')
var totRequest = stream
|from()
.measurement('onboarding-public-api-counters')
|default()
.tag('status', '')
|where(lambda: "entity" == 'http-response' AND "endpoint-name" == endpoint)//also the tracing
|window()
.period(timeWindow)
.every(timeWindow)
|count('value')
totErrors
|join(totRequest)
.as('errors', 'requests')
.tolerance(timeWindow)
|eval(lambda: floor((float("errors.count") / float("requests.count")) * float(100)))
.as('rate')
|alert()
.warn(lambda: "rate" >= int(warnThreshold))
.crit(lambda: "rate" > int(criticalThreshold))
.message('''
{{ .Level}}: UAT - Fantasy Service- HTTP response failures
Recorded {{ index .Fields "rate"}} % of "''' + code + '" failed HTTP responses' + ' for the "' + endpoint +'" endpoint'
+ ' within the last ' + string(timeInSeconds))
.slack()
.channel('#alert_test')
.stateChangesOnly()```
Thanks
Contributor guide
Research direction
No files or tests are named. Start by reproducing the supplied Kapacitor template with stream variables and lambda expressions, then trace the parser error handling for the reported nil evaluation node. Done means parsing failures identify the correct line and return clear errors, with coverage for the failing template cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- stream-processing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100