shared.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2022 The OpenZipkin Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package b3
  15. import "errors"
  16. // Common Header Extraction / Injection errors
  17. var (
  18. ErrInvalidSampledByte = errors.New("invalid B3 Sampled found")
  19. ErrInvalidSampledHeader = errors.New("invalid B3 Sampled header found")
  20. ErrInvalidFlagsHeader = errors.New("invalid B3 Flags header found")
  21. ErrInvalidTraceIDHeader = errors.New("invalid B3 TraceID header found")
  22. ErrInvalidSpanIDHeader = errors.New("invalid B3 SpanID header found")
  23. ErrInvalidParentSpanIDHeader = errors.New("invalid B3 ParentSpanID header found")
  24. ErrInvalidScope = errors.New("require either both TraceID and SpanID or none")
  25. ErrInvalidScopeParent = errors.New("ParentSpanID requires both TraceID and SpanID to be available")
  26. ErrInvalidScopeParentSingle = errors.New("ParentSpanID requires TraceID, SpanID and Sampled to be available")
  27. ErrEmptyContext = errors.New("empty request context")
  28. ErrInvalidTraceIDValue = errors.New("invalid B3 TraceID value found")
  29. ErrInvalidSpanIDValue = errors.New("invalid B3 SpanID value found")
  30. ErrInvalidParentSpanIDValue = errors.New("invalid B3 ParentSpanID value found")
  31. )
  32. // Default B3 Header keys
  33. const (
  34. TraceID = "x-b3-traceid"
  35. SpanID = "x-b3-spanid"
  36. ParentSpanID = "x-b3-parentspanid"
  37. Sampled = "x-b3-sampled"
  38. Flags = "x-b3-flags"
  39. Context = "b3"
  40. )