influxdata / influxdata/kapacitor
Cannot create an aggregate event handler in JSON
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
I tried to define an `aggrgate` event handler in JSON but Kapacitor rejects it.
Here is the JSON:
```
{
"id": "foo-aggr",
"topic": "foo",
"kind": "aggregate",
"options": {
"interval": "10m",
"topic": "bar"
}
}
```
There error I get is:
```
failed to create handler: failed to decode options into *alert.AggregateHandlerConfig: 1 error(s) decoding:
* 'interval' expected type 'time.Duration', got unconvertible type 'string'
```
Kapacitor should convert the JSON string to a duration.
Contributor guide
Research direction
Start with the JSON handler decoding path and the alert.AggregateHandlerConfig type named in the error; reproduce the failure using the supplied aggregate handler JSON. Done means the interval value is accepted as a duration and the aggregate event handler can be created successfully, with a regression test if the existing decoder tests cover this path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100