Skip to content

Commit fee583e

Browse files
authored
span exporter concurrency: expand on Export() requirements (#2452)
1 parent 5ee200d commit fee583e

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ release.
1111

1212
### Traces
1313

14+
- Clarify the return of `Export(batch)` in the Batch Span Processor and exporter
15+
concurrency ([#2452](https://github.com/open-telemetry/opentelemetry-specification/pull/2452))
16+
1417
### Metrics
1518

1619
- Add experimental `OTEL_EXPORTER_OTLP_DEFAULT_HISTOGRAM_AGGREGATION` variable for

specification/trace/sdk.md

+21-8
Original file line numberDiff line numberDiff line change
@@ -615,15 +615,24 @@ function are typically expected to serialize and transmit the data to the
615615
destination.
616616

617617
Export() will never be called concurrently for the same exporter instance.
618-
Export() can be called again only after the current call returns.
618+
Depending on the implementation the result of the export may be returned to the
619+
Processor not in the return value of the call to Export() but in a language
620+
specific way for signaling completion of an asynchronous task. This means that
621+
while an instance of an exporter will never have its Export() called
622+
concurrently it does not mean that the task of exporting can not be done
623+
concurrently. How this is done is outside the scope of this specification. Each
624+
implementation MUST document the concurrency characteristics the SDK requires of
625+
the exporter.
619626

620627
Export() MUST NOT block indefinitely, there MUST be a reasonable upper limit
621628
after which the call must time out with an error result (`Failure`).
622629

623-
Any retry logic that is required by the exporter is the responsibility
624-
of the exporter. The default SDK SHOULD NOT implement retry logic, as
625-
the required logic is likely to depend heavily on the specific protocol
626-
and backend the spans are being sent to.
630+
Concurrent requests and retry logic is the responsibility of the exporter. The
631+
default SDK's Span Processors SHOULD NOT implement retry logic, as the required
632+
logic is likely to depend heavily on the specific protocol and backend the spans
633+
are being sent to. For example, the [OpenTelemetry Protocol (OTLP)
634+
specification](../protocol/otlp.md)
635+
defines logic for both sending concurrent requests and retrying requests.
627636

628637
**Parameters:**
629638

@@ -633,16 +642,20 @@ e.g. for spans in Java it will be typically `Collection<SpanData>`.
633642

634643
**Returns:** ExportResult:
635644

636-
ExportResult is one of:
645+
The return of Export() is implementation specific. In what is idiomatic for the
646+
language the Exporter must send an `ExportResult` to the Processor.
647+
`ExportResult` has values of either `Success` or `Failure`:
637648

638649
* `Success` - The batch has been successfully exported.
639650
For protocol exporters this typically means that the data is sent over
640651
the wire and delivered to the destination server.
641652
* `Failure` - exporting failed. The batch must be dropped. For example, this
642653
can happen when the batch contains bad data and cannot be serialized.
643654

644-
Note: this result may be returned via an async mechanism or a callback, if that
645-
is idiomatic for the language implementation.
655+
For example, in Java the return of Export() would be a Future which when
656+
completed returns the `ExportResult` object. While in Erlang the Exporter sends
657+
a message to the Processor with the `ExportResult` for a particular batch of
658+
spans.
646659

647660
#### `Shutdown()`
648661

0 commit comments

Comments
 (0)