package observation import ( "encoding/json" "github.com/tegwick/fluid-core/internal/contract" ) // consumerLabel names the source of a piece of feedback for the audit trail. // // It prefers the cohort over anything consumer-specific: the trail needs to // know what kind of consumer said this, not which one. func consumerLabel(f contract.FluidFeedback) string { if f.Cohort != nil && *f.Cohort != "" { return string(*f.Cohort) } return "unclassified" } func marshalFeedback(f contract.FluidFeedback) ([]byte, error) { return json.Marshal(contract.FeedbackDocument{FluidFeedback: f}) }