transport.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) 2017 Uber Technologies, Inc.
  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 jaeger
  15. import (
  16. "io"
  17. )
  18. // Transport abstracts the method of sending spans out of process.
  19. // Implementations are NOT required to be thread-safe; the RemoteReporter
  20. // is expected to only call methods on the Transport from the same go-routine.
  21. type Transport interface {
  22. // Append converts the span to the wire representation and adds it
  23. // to sender's internal buffer. If the buffer exceeds its designated
  24. // size, the transport should call Flush() and return the number of spans
  25. // flushed, otherwise return 0. If error is returned, the returned number
  26. // of spans is treated as failed span, and reported to metrics accordingly.
  27. Append(span *Span) (int, error)
  28. // Flush submits the internal buffer to the remote server. It returns the
  29. // number of spans flushed. If error is returned, the returned number of
  30. // spans is treated as failed span, and reported to metrics accordingly.
  31. Flush() (int, error)
  32. io.Closer
  33. }