Comments (5)
Will it make sense for TraceProvider to have similar behavior as LoggerProvider (#1455) - Let Tracer
own TracerProvider
(with shared referenece to TracerProviderInner
), which would ensure that it won't be dropped till all instances of Tracers are dropped.
from opentelemetry-rust.
Ah you are right. Let me give it a try
from opentelemetry-rust.
Yeah it's a known behavior. Users need to manually hold reference to provider or pass the provider to global tracer provider.
Agree on we should update documentation and possible looking into compiler warnings
from opentelemetry-rust.
Like pointed out in #1455 after I did some POC I realized the drawback of curent implementation is we will no longer shutdown tracer/logger processor when dropping TracerProvider
.
Considering the following unit test that validates we will not send out spans after tracer provider shuts down
#[test]
fn test_span_exported_data() {
let provider = crate::trace::TracerProvider::builder()
.with_simple_exporter(NoopSpanExporter::new())
.build();
let tracer = provider.tracer("test");
let mut span = tracer.start("test_span");
span.add_event("test_event", vec![]);
span.set_status(Status::error(""));
let exported_data = span.exported_data();
assert!(exported_data.is_some());
drop(provider);
let dropped_span = tracer.start("span_with_dropped_provider");
// return none if the provider has already been dropped
// but this won't happen if the tracer still holds a reference to tracer inner
assert!(dropped_span.exported_data().is_none());
}
I think there are two questions we need to answer:
- Do we need to shutdown
SpanProcssor
s whenTracerProvider
drops? - How do we make sure the span exporting stops once the
SpanProcessor
shuts down?LoggerProvider
hastry_shutdown
which requries users to manualy track down all clonedLoggerProvider
, given everyLogger
has a reference toLoggerProvider
this means users is responsible for clean upLogger
beforeLoggerProvider
- Is it possible for us to keep a
Weak
reference to everyTracer
created from a givenTracerProviderInner
. Upon shutting down, theTracerProviderInner
notify allTracer
and ask them to remove their reference toTracerProviderInner
.
from opentelemetry-rust.
https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry/src/trace/mod.rs#L20-L31 - The recently added doc updates should cover this?
from opentelemetry-rust.
Related Issues (20)
- [Feature]: Support attribute Value variants for KeyValueList and bytes HOT 2
- opentelemetry-stdout to have all features HOT 1
- Logs beta/rc/stable release timelines
- Metrics SDK improvements
- [Metrics SDK] Shutdown false alarm HOT 1
- [Bug]: `opentelemetry_appender_tracing` does not work with blocking otlp exporter
- What should provider's force_flush return HOT 1
- OTLP Exporter must default to http/protobuf HOT 1
- Remove ordered_float dependency HOT 1
- OTLP Exporter with http/json is not working HOT 4
- Prevents logs from own operation
- [Logs] Avoid temporary vector to store attributes.
- Tracer does weak->Arc upgrade twice in hot path leading to bottleneck HOT 2
- Make semver check in CI optional.
- Avoid random generation cost from all perf tests
- [Logs API/SDK] Remove the dependency on constructs reflecting the implementation details
- OTLPExporter Pipeline issues HOT 5
- Add metrics aggregation tests to ensure correctness HOT 2
- Find a way to run tests that require test-thread=1 HOT 1
- opentelemetry-otlp dependencies need higher msrv HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentelemetry-rust.