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
I have a scenario where I would like to use a name for my Tracers that is not known at compile time.
Currently the only way to do that, due to the usage of &'static str for name and version, is to cause a memory leak with something like
let s = String::from("some id");
let trace = global::tracer(format!("id-{}", Box::leak(s.into_boxed_str())));
I did try to go down the rabbit hole of switching out &'static str for Cow<'static, str> or String, but found that the InstrumentationLibrary requires the Copy trait, which neither Cow nor String implement. Removing the Copy trait causes the downstream effect of the inability to move an instance of InstrumentationLibrary on this line (and similar): instrumentation_lib: *tracer.instrumentation_library(),
Could this be switched to a clone instead of dereference/move so that the rest of the InstrumentationLibrary struct can be more friendly?
The text was updated successfully, but these errors were encountered:
I have a scenario where I would like to use a name for my Tracers that is not known at compile time.
Currently the only way to do that, due to the usage of
&'static str
for name and version, is to cause a memory leak with something likeI did try to go down the rabbit hole of switching out &'static str for Cow<'static, str> or String, but found that the InstrumentationLibrary requires the Copy trait, which neither Cow nor String implement. Removing the Copy trait causes the downstream effect of the inability to move an instance of InstrumentationLibrary on this line (and similar):
instrumentation_lib: *tracer.instrumentation_library(),
Could this be switched to a clone instead of dereference/move so that the rest of the InstrumentationLibrary struct can be more friendly?
The text was updated successfully, but these errors were encountered: