clients.go (2317B)
1 // Copyright The OpenTelemetry 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 15 package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" 16 17 import ( 18 "context" 19 20 tracepb "go.opentelemetry.io/proto/otlp/trace/v1" 21 ) 22 23 // Client manages connections to the collector, handles the 24 // transformation of data into wire format, and the transmission of that 25 // data to the collector. 26 type Client interface { 27 // DO NOT CHANGE: any modification will not be backwards compatible and 28 // must never be done outside of a new major release. 29 30 // Start should establish connection(s) to endpoint(s). It is 31 // called just once by the exporter, so the implementation 32 // does not need to worry about idempotence and locking. 33 Start(ctx context.Context) error 34 // DO NOT CHANGE: any modification will not be backwards compatible and 35 // must never be done outside of a new major release. 36 37 // Stop should close the connections. The function is called 38 // only once by the exporter, so the implementation does not 39 // need to worry about idempotence, but it may be called 40 // concurrently with UploadTraces, so proper 41 // locking is required. The function serves as a 42 // synchronization point - after the function returns, the 43 // process of closing connections is assumed to be finished. 44 Stop(ctx context.Context) error 45 // DO NOT CHANGE: any modification will not be backwards compatible and 46 // must never be done outside of a new major release. 47 48 // UploadTraces should transform the passed traces to the wire 49 // format and send it to the collector. May be called 50 // concurrently. 51 UploadTraces(ctx context.Context, protoSpans []*tracepb.ResourceSpans) error 52 // DO NOT CHANGE: any modification will not be backwards compatible and 53 // must never be done outside of a new major release. 54 }