diff --git a/api/include/opentelemetry/context/runtime_context.h b/api/include/opentelemetry/context/runtime_context.h index 5cb793b23a..fbcf425c2c 100644 --- a/api/include/opentelemetry/context/runtime_context.h +++ b/api/include/opentelemetry/context/runtime_context.h @@ -150,6 +150,18 @@ class RuntimeContext GetStorage() = storage; } + /** + * Provide a pointer to const runtime context storage. + * + * The returned pointer can only be used for extending the lifetime of the runtime context + * storage. + * + */ + static nostd::shared_ptr GetConstRuntimeContextStorage() noexcept + { + return GetRuntimeContextStorage(); + } + private: static nostd::shared_ptr GetRuntimeContextStorage() noexcept {