extdata.go 295 B

12345678910111213141516
  1. //@File extdata.go
  2. //@Time 2022/05/17
  3. //@Author #Suyghur,
  4. package kafka
  5. import "github.com/Shopify/sarama"
  6. func GetTraceFromHeader(headers []*sarama.RecordHeader) string {
  7. for _, h := range headers {
  8. if string(h.Key) == "trace_id" {
  9. return string(h.Value)
  10. }
  11. }
  12. return ""
  13. }