You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add support for concurrent exports
Applications generating significant span volume can end up dropping data
due to the synchronous export step. According to the opentelemetry spec,
This function will never be called concurrently for the same exporter
instance. It can be called again only after the current call returns.
However, it does not place a restriction on concurrent I/O or anything
of that nature. There is an [ongoing discussion] about tweaking the
language to make this more clear.
With that in mind, this commit makes the exporters return a future that
can be spawned concurrently. Unfortunately, this means that the
`export()` method can no longer be async while taking &mut self. The
latter is desirable to enforce the no concurrent calls line of the spec,
so the choice is made here to return a future instead with the lifetime
decoupled from self. This resulted in a bit of additional verbosity, but
for the most part the async code can still be shoved into an async fn
for the ergonomics.
The main exception to this is the `jaeger` exporter which internally
requires a bunch of mutable references. I plan to discuss with the
opentelemetry team the overall goal of this PR and get buy-in before
making more invasive changes to support this in the jaeger exporter.
[ongoing discussion]: open-telemetry/opentelemetry-specification#2434
* SpanProcessor directly manages concurrent exports
Prior, export tasks were run in "fire and forget" mode with
runtime::spawn. SpanProcessor now manages tasks directly using
FuturesUnordered. This enables limiting overall concurrency (and thus
memory footprint). Additionally, flush and shutdown logic now spawn an
additional task for any unexported spans and wait on _all_ outstanding
tasks to complete before returning.
* Add configuration for BSP max_concurrent_exports
Users may desire to control the level of export concurrency in the batch
span processor. There are two special values:
max_concurrent_exports = 0: no bound on concurrency
max_concurrent_exports = 1: no concurrency, makes everything
synchronous on the messaging task.
* Implement new SpanExporter API for Jaeger
Key points
- decouple exporter from uploaders via channel and spawned task
- some uploaders are a shared I/O resource and cannot be multiplexed
- necessitates a task queue
- eg, HttpClient will spawn many I/O tasks internally, AgentUploader
is a single I/O resource. Different level of abstraction.
- Synchronous API not supported without a Runtime argument. I updated
the API to thread one through, but maybe this is undesirable. I'm also
exploiting the fact in the Actix examples that it uses Tokio under the
hood to pass through the Tokio runtime token.
- Tests pass save for a couple of flakey environment ones which is
likely a race condition.
* Reduce dependencies on futures
The minimal necessary futures library (core, util, futures proper) is
now used in all packages touched by the concurrent exporters work.
* Remove runtime from Jaeger's install_simple
To keep the API _actually_ simple, we now leverage a thread to run the
jaeger exporter internals.
* Add Arc lost in a rebase
* Fix OTEL_BSP_MAX_CONCURRENT_EXPORTS name and value
Per PR feedback, the default should match the previous behavior of 1
batch at a time.
* Fix remaining TODOs
This finishes the remaining TODOs on the concurrent-exports branch. The
major change included here adds shutdown functionality to the jaeger
exporter which ensures the exporter has finished its tasks before
exiting.
* Restore lint.sh script
This was erroneously committed.
* Make max concurrent exports env configurable
OTEL_BSP_MAX_CONCURRENT_EXPORTS may now be specified in the environment
to configure the number of max concurrent exports. This configurable now
has parity with the other options of the span_processor.
0 commit comments