span_exporter.go (2119B)
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 trace // import "go.opentelemetry.io/otel/sdk/trace" 16 17 import "context" 18 19 // SpanExporter handles the delivery of spans to external receivers. This is 20 // the final component in the trace export pipeline. 21 type SpanExporter interface { 22 // DO NOT CHANGE: any modification will not be backwards compatible and 23 // must never be done outside of a new major release. 24 25 // ExportSpans exports a batch of spans. 26 // 27 // This function is called synchronously, so there is no concurrency 28 // safety requirement. However, due to the synchronous calling pattern, 29 // it is critical that all timeouts and cancellations contained in the 30 // passed context must be honored. 31 // 32 // Any retry logic must be contained in this function. The SDK that 33 // calls this function will not implement any retry logic. All errors 34 // returned by this function are considered unrecoverable and will be 35 // reported to a configured error Handler. 36 ExportSpans(ctx context.Context, spans []ReadOnlySpan) error 37 // DO NOT CHANGE: any modification will not be backwards compatible and 38 // must never be done outside of a new major release. 39 40 // Shutdown notifies the exporter of a pending halt to operations. The 41 // exporter is expected to perform any cleanup or synchronization it 42 // requires while honoring all timeouts and cancellations contained in 43 // the passed context. 44 Shutdown(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 }