InitializeDesc#

Fully qualified name: omni::observability::InitializeDesc

Defined in omni/observability/IObservabilityProvider.h

struct InitializeDesc#

Descriptor used to initialize telemetry.

An instance of this object must be provided to the IObservabilityProvider::initialize() function when attempting to startup and configure OpenTelemetry for the process. If no special configuration is needed, a default constructed instance of this object may be provided.

Public Members

size_t size = sizeof(InitializeDesc)#

The size of the struct.

This is used for versioning. This must be set to sizeof(InitializeDesc) in all cases. The default initialized value should suffice.

carb::cpp::string_view sessionId#

The current session ID.

The session ID needs to be constant among all telemetry events for a session so that they can be correlated post-mortem. Once a session ID has been set for this process, it cannot be modified without shutting down with IObservabilityProvider::finish() and reinitializing. Carbonite based apps using omni.structuredlog should get this value from omni::structuredlog::IStructuredLogSettings::getSessionId().

Note

This value will be overridden if a value is provided for the key session.id is provided in resources below.

OtelSettings *settings = nullptr#

Optional settings structure.

This is held until finish() is called. If used, this object must be implemented by the host app to provide a pass-through to its own internal configuration system. This will only be used in cases where a corresponding OpenTelemetry environment variable does not exist for the process already.

Logger *logger = nullptr#

Optional logger object to receive log messages from internal operations in the core library.

If this object is nullptr, any internal log messages will simply be formatted and printed to stderr as needed. If this object is provided, all log messages from the core library will be passed through this object instead. If a log message is generated as a result of trying to process another log message, that message will only be emitted on the first instance to avoid the potential for unintentional recursion. This logger will have a reference added to it during the IObservabilityProvider::initialize() call and will live until the corresponding IObservabilityProvider::finish() call. If the host app needs to unload the module that holds the code for this logger object, it must first shutdown this library to release this logger object. The host app can still programmatically register other loggers with IObservabilityProvider::registerLogger() if needed.

carb::cpp::span<ResourcePair> resources#

Optional list of resource key/value pairs to be added to each emitted telemetry signal.

Each key/value pair in this list will be internally added through calls to IObservabilityProvider::addResource()` before OpenTelemetry is initialized and configured. This can be used to provide custom resource values when initializing the this library with the State RAII helper class.

Note

If this list contains a value for the key session.id, it will override the session ID value provided in sessionId above.