-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] how to copy finalized config. #171
Comments
Hey @kristjanvalur Thank you for your question. The behaviour you're encountering is intentional. The Suggested SolutionBased on your use case, it might be more practical to store the
If I understand correctly, you want to initialize a global configuration and a Here's an example to illustrate: datadog::tracing::Tracer& tracer() {
static datadog::tracing::Tracer tracer(*finalize_config(TracerConfig());
return tracer;
};
void main() {
...
auto span = tracer().create_span();
...
} If this does not meet your requirements, could you provide a simplified example of the implementation you're aiming for? That would help us better understand your needs and explore alternative solutions. |
Thanks for your reply. dd::TracerConfig RawConfig;
// customize the config here...
const auto Maybe_Config = dd::finalize_config(RawConfig);
if (auto* Error = Maybe_Config.if_error())
{
UE_LOG(LogTemp, Error, TEXT("Failed to finalize config: %s"), Error->message.c_str());
return;
}
Tracer = MakeUnique<dd::Tracer>(*Maybe_Config); where Thanks! |
However, next issue: Then an application could be written something like: dd::Tracer &GetSpan();
dd::Span my_span = GetTracer().create_span();
dd::Span child_span = my_span.create_span(); i.e. logic elsewhere need not worry about the successful creation of a valid Tracer, Or, if there is an alternative way to safely create a neutered Tracer object, in case configuration is broken, that would be good to know. |
I think the documentation could be improved by showing a general framework for working with asynchronous / callback-based apis. I found some code in the httpserver example showing a separate Span stack, will work with that. Update: Will end up with my own graph of Span nodes connected with shared pointers. |
Ok, I suspect that the library really does not really allow for creating a non-functional Tracer in case the config cannot be finalized. We have a situation where the same executable may be deployed in different ways but the presence of some other information may decide if Tracing is enabled at all, and then, it should not be overridable by the user by setting the environment in a certain way. In this case, using a As it is, I will need to use some wrapping code where creating Spans and dynamically allocate them if i have a Tracer at all. |
I'm trying to embed the tracer in a plugin. I need to perform the config finalization in a class method. However, it appears that there is no public default constructor or a copy constructor for
FinalizedTracerConfig
.i.e. I don't seem to be able to do the following:
Compiling this won't even generate a constructor:
'Foo::Foo(void)': function was implicitly deleted because a base class invokes a deleted or inaccessible function 'datadog::tracing::FinalizedTracerConfig::FinalizedTracerConfig(void)'
As a plugin I don't have the luxury of specifying an
auto
variable in mymain()
, and a member cannot be initialized in the class construtor.Same goes for a
Tracer
object. I wish to initialize a global config and a Tracer object at application startup, and then be able to refer to them as needed.Is there some pattern I'm not seeing in how to initialized a tracing context and store it away somewhere?
The text was updated successfully, but these errors were encountered: