error "can't evaluate field templateJSONEncoder in type struct" when using "{{call .templateJSONEncoder .Result.Partitions}}" on slack template notification
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4k
- Forks
- 818
- Avg merge
- 1h 14m
- Merged PRs (30d)
- 1
Description
I'm trying to use `{{call .templateJSONEncoder .Result.Partitions}}` on a Slack template but I get this error:
**"template: default-slack-open.tmpl:1:341: executing \"default-slack-open.tmpl\" at <.templateJSONEncoder>: can't evaluate field templateJSONEncoder in type struct { Cluster string; Group string; ID string; Start time.Time; Extras map[string]string; Result protocol.ConsumerGroupStatus }"**
I'm using the following Template content for slack notification:
`{ "attachments": [{"color": "danger","title": "Alert from open condition (burrow)!","fields": [{"title": "Group","value": "{{ .Group }}", "short": false},{"title": "Cluster","value": "{{ .Cluster }}","short": true},{"title": "Status constant value","value": "{{ .Result.Status}}","short": true},{"title": "Partition status","value": {{call .templateJSONEncoder .Result.Partitions}},"short": false}}]}`
Could anyone tell me was wrong with this template?
Is there any example template for slack which shows partition status (not just consumer group status)?
Thanks
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the field references in default-slack-open.tmpl and compare them with the data structure shown in the template error. Check how Slack notification templates expose partition status, then verify that a corrected template renders the partition data without an evaluation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kafka
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100