influxdata / influxdata/kapacitor

template task groupBy not accepting duration as number or string

Open
#1,876 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

It looks like the template feature won't allow you to group by time as well as a few other tags.

The important bits:

Template:

var groupBy = [*]

var data = batch
|query(query)
.groupBy(groupBy)
.period(period)
.every(every)
.align()
.alignGroup()

Json:

"groupBy": {
"type": "list",
"value": [
{
"type": "duration",
"value": "10s",
"description": ""
},
{
"type": "string",
"value": "host_name",
"description": ""
},
{
"type": "string",
"value": "host_ip",
"description": ""
}
],
"description": ""
}

This generates `invalid var groupBy: unexpected var type duration, value is a string`

"groupBy": {
"type": "list",
"value": [
{
"type": "duration",
"value": 10000000000,
"description": ""
},
{
"type": "string",
"value": "host_name",
"description": ""
},
{
"type": "string",
"value": "host_ip",
"description": ""
}
],
"description": ""
}

Generates `invalid var groupBy: unsupported Var type json.Number`

Contributor guide

Open the contributing guide

Research direction

Start at the template task groupBy parsing and variable conversion entry point, then reproduce the two JSON examples from the issue. Trace how duration strings and numeric values are handled in a list, and verify that valid duration values no longer produce either reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.