linkedin / linkedin/Burrow

error "can't evaluate field templateJSONEncoder in type struct" when using "{{call .templateJSONEncoder .Result.Partitions}}" on slack template notification

Open
#337 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.