Skip to content

[question] how to copy finalized config. #171

@kristjanvalur

Description

@kristjanvalur

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:

class Foo {
public:
  void Init()
  {
    MaybeConfig = finalize_config(TracerConfig()):
    if (!MaybeConfig.if_error())
      Config = *MaybeConfig;
  }
private:
  FinalizedTracerConfig Config;
};

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 my main(), 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions