From 9d2afdf0fc58f8e1c95cac81d6e65806e6c24b3f Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Fri, 1 Jul 2016 10:31:19 -0400 Subject: [PATCH] Implement ForeachBaggageItem --- span.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/span.go b/span.go index 08c53d046abd..15af6220b36a 100644 --- a/span.go +++ b/span.go @@ -182,6 +182,16 @@ func (s *spanImpl) BaggageItem(restrictedKey string) string { return s.raw.Baggage[canonicalKey] } +func (s *spanImpl) ForeachBaggageItem(handler func(k, v string) bool) { + s.Lock() + defer s.Unlock() + for k, v := range s.raw.Baggage { + if !handler(k, v) { + break + } + } +} + func (s *spanImpl) Tracer() opentracing.Tracer { return s.tracer }