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