mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 00:55:00 +08:00
Give the allocator to the tracer when necessary
This commit is contained in:
parent
803f5a7936
commit
b72146eee4
@ -35,8 +35,10 @@ fn setup(opt: &Opt) -> anyhow::Result<()> {
|
|||||||
|
|
||||||
let file = std::fs::File::create(&trace_file)
|
let file = std::fs::File::create(&trace_file)
|
||||||
.with_context(|| format!("could not create trace file at '{}'", trace_file))?;
|
.with_context(|| format!("could not create trace file at '{}'", trace_file))?;
|
||||||
// TODO kero: Pass the allocator stats to Trace here
|
#[cfg(not(feature = "stats_alloc"))]
|
||||||
let (mut trace, layer) = tracing_trace::Trace::new(file);
|
let (mut trace, layer) = tracing_trace::Trace::new(file);
|
||||||
|
#[cfg(feature = "stats_alloc")]
|
||||||
|
let (mut trace, layer) = tracing_trace::Trace::with_stats_alloc(file, &ALLOC);
|
||||||
|
|
||||||
let subscriber = tracing_subscriber::registry()
|
let subscriber = tracing_subscriber::registry()
|
||||||
.with(
|
.with(
|
||||||
|
@ -83,7 +83,7 @@ enum OpaqueIdentifier {
|
|||||||
Call(tracing::callsite::Identifier),
|
Call(tracing::callsite::Identifier),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TraceLayer {
|
impl<A: GlobalAlloc> TraceLayer<A> {
|
||||||
fn resource_id(&self, opaque: OpaqueIdentifier) -> Option<ResourceId> {
|
fn resource_id(&self, opaque: OpaqueIdentifier) -> Option<ResourceId> {
|
||||||
self.callsites.read().unwrap().get(&opaque).copied()
|
self.callsites.read().unwrap().get(&opaque).copied()
|
||||||
}
|
}
|
||||||
@ -132,9 +132,10 @@ impl TraceLayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S> Layer<S> for TraceLayer
|
impl<S, A> Layer<S> for TraceLayer<A>
|
||||||
where
|
where
|
||||||
S: Subscriber,
|
S: Subscriber,
|
||||||
|
A: GlobalAlloc,
|
||||||
{
|
{
|
||||||
fn on_new_span(&self, attrs: &Attributes<'_>, id: &TracingId, _ctx: Context<'_, S>) {
|
fn on_new_span(&self, attrs: &Attributes<'_>, id: &TracingId, _ctx: Context<'_, S>) {
|
||||||
let call_id = self
|
let call_id = self
|
||||||
|
Loading…
Reference in New Issue
Block a user