Class InstrumentationScope
Defined in File instrumentation_scope.h
Class Documentation
-
class InstrumentationScope
Public Functions
-
InstrumentationScope(const InstrumentationScope&) = default
-
inline std::size_t HashCode() const noexcept
-
inline bool operator==(const InstrumentationScope &other) const noexcept
Compare 2 instrumentation libraries.
- Parameters:
other – the instrumentation scope to compare to.
- Returns:
true if the 2 instrumentation libraries are equal, false otherwise.
-
inline bool equal(const nostd::string_view name, const nostd::string_view version, const nostd::string_view schema_url = "") const noexcept
Check whether the instrumentation scope has given name and version. This could be used to check version equality and avoid heap allocation.
- Parameters:
name – name of the instrumentation scope to compare.
version – version of the instrumentation scope to compare.
schema_url – schema url of the telemetry emitted by the scope.
- Returns:
true if name and version in this instrumentation scope are equal with the given name and version.
-
inline const std::string &GetName() const noexcept
-
inline const std::string &GetVersion() const noexcept
-
inline const std::string &GetSchemaURL() const noexcept
-
inline const InstrumentationScopeAttributes &GetAttributes() const noexcept
-
inline void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept
Public Static Functions
-
static inline nostd::unique_ptr<InstrumentationScope> Create(nostd::string_view name, nostd::string_view version = "", nostd::string_view schema_url = "", InstrumentationScopeAttributes &&attributes = {})
Returns a newly created InstrumentationScope with the specified library name and version.
- Parameters:
name – name of the instrumentation scope.
version – version of the instrumentation scope.
schema_url – schema url of the telemetry emitted by the library.
attributes – attributes of the instrumentation scope.
- Returns:
the newly created InstrumentationScope.
-
static inline nostd::unique_ptr<InstrumentationScope> Create(nostd::string_view name, nostd::string_view version, nostd::string_view schema_url, const InstrumentationScopeAttributes &attributes)
Returns a newly created InstrumentationScope with the specified library name and version.
- Parameters:
name – name of the instrumentation scope.
version – version of the instrumentation scope.
schema_url – schema url of the telemetry emitted by the library.
attributes – attributes of the instrumentation scope.
- Returns:
the newly created InstrumentationScope.
-
template<class ArgumentType, nostd::enable_if_t<opentelemetry::common::detail::is_key_value_iterable<ArgumentType>::value>* = nullptr>
static inline nostd::unique_ptr<InstrumentationScope> Create(nostd::string_view name, nostd::string_view version, nostd::string_view schema_url, const ArgumentType &arg) Returns a newly created InstrumentationScope with the specified library name and version.
- Parameters:
name – name of the instrumentation scope.
version – version of the instrumentation scope.
schema_url – schema url of the telemetry emitted by the library.
arg – arguments used to create attributes of the instrumentation scope.
- Returns:
the newly created InstrumentationScope.
-
InstrumentationScope(const InstrumentationScope&) = default