/
OTelLogEntryExporter.swift
40 lines (36 loc) · 1.68 KB
/
OTelLogEntryExporter.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift OTel open source project
//
// Copyright (c) 2024 Moritz Lang and the Swift OTel project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
/// A span exporter receives batches of processed spans to export them, e.g. by sending them over the network.
///
/// [OpenTelemetry specification: Span exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk.md#span-exporter)
@_spi(Logging)
public protocol OTelLogEntryExporter: Sendable {
/// Export the given batch of spans.
///
/// - Parameter batch: A batch of spans to export.
func export(_ batch: some Collection<OTelLogEntry> & Sendable) async throws
/// Force the span exporter to export any previously received spans as soon as possible.
func forceFlush() async throws
/// Shut down the span exporter.
///a
/// This method gives exporters a chance to wrap up existing work such as finishing in-flight exports while not allowing new ones anymore.
/// Once this method returns, the exporter is to be considered shut down and further invocations of ``export(_:)``
/// are expected to fail.
func shutdown() async
}
/// An error indicating that a given exporter has already been shut down while receiving an additional batch of spans to export.
@_spi(Logging)
public struct OTelLogEntryExporterAlreadyShutDownError: Error {
/// Initialize the error.
public init() {}
}