template: export GroupKey on template.Data#5400
Conversation
The webhook payload has always included groupKey, but template.Data did not, so templates and receivers reusing Data could not access it. Add GroupKey to template.Data and populate it from the notify context in GetTemplateData. Fixes prometheus#2526 Signed-off-by: Dean Chen <862469039@qq.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds ChangesGroupKey propagation
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Just for the record: Also the groupKey is not unique #3817. |
Pull Request Checklist
Summary
template.Datadid not exportGroupKey, even though the webhook JSON payload has always includedgroupKey. Webhook receivers that reusetemplate.Data(or custom templates that need the grouping key) had no way to access it without defining their own struct.This change:
GroupKeytotemplate.Datawith JSON taggroupKey(matching the documented webhook field).GetTemplateDatawhen a group key is present.{{ .GroupKey }}.The webhook
Messagetype still sets its ownGroupKeyfield for the wire format; Go's encoding/json prefers the outer field, so the payload is unchanged.Which user-facing changes does this PR introduce?