8000 [API] Deprecate event logger by owent · Pull Request #3285 · open-telemetry/opentelemetry-cpp · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,15 @@ IndentPPDirectives: AfterHash

# Include blocks style
IncludeBlocks: Preserve

AttributeMacros:
- OPENTELEMETRY_UNLIKELY
- OPENTELEMETRY_LIKELY
- OPENTELEMETRY_MAYBE_UNUSED
- OPENTELEMETRY_DEPRECATED
- OPENTELEMETRY_API_SINGLETON
- OPENTELEMETRY_LOCAL_SYMBOL
- OPENTELEMETRY_EXPORT
- OPENTELEMETRY_SANITIZER_NO_MEMORY
- OPENTELEMETRY_SANITIZER_NO_THREAD
- OPENTELEMETRY_SANITIZER_NO_ADDRESS
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ if(OTELCPP_MAINTAINER_MODE)
add_compile_options(/wd4127)
add_compile_options(/wd4512)
add_compile_options(/wd4267)
add_compile_options(/wd4996)

# Enforced warnings
add_compile_options(/we4265) # 'class': class has virtual functions, but
Expand Down
4 changes: 3 additions & 1 deletion api/include/opentelemetry/logs/event_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
OPENTELEMETRY_BEGIN_NAMESPACE
namespace logs
{
#if OPENTELEMETRY_ABI_VERSION_NO < 2
/**
* Handles event log record creation.
**/
class EventLogger
class OPENTELEMETRY_DEPRECATED EventLogger
{
public:
virtual ~EventLogger() = default;
Expand Down Expand Up @@ -76,5 +77,6 @@ class EventLogger
void IgnoreTraitResult(ValueType &&...)
{}
};
#endif
} // namespace logs
OPENTELEMETRY_END_NAMESPACE
4 changes: 3 additions & 1 deletion api/include/opentelemetry/logs/event_logger_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ namespace logs
class EventLogger;
class Logger;

#if OPENTELEMETRY_ABI_VERSION_NO < 2
/**
* Creates new EventLogger instances.
*/
class EventLoggerProvider
class OPENTELEMETRY_DEPRECATED EventLoggerProvider
{
public:
virtual ~EventLoggerProvider() = default;
Expand All @@ -31,5 +32,6 @@ class EventLoggerProvider
nostd::shared_ptr<Logger> delegate_logger,
nostd::string_view event_domain) noexcept = 0;
};
#endif
} // namespace logs
OPENTELEMETRY_END_NAMESPACE
2 changes: 2 additions & 0 deletions api/include/opentelemetry/logs/noop.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class NoopLoggerProvider final : public LoggerProvider
nostd::shared_ptr<Logger> logger_;
};

#if OPENTELEMETRY_ABI_VERSION_NO < 2
class NoopEventLogger final : public EventLogger
{
public:
Expand Down Expand Up @@ -124,6 +125,7 @@ class NoopEventLoggerProvider final : public EventLoggerProvider
private:
nostd::shared_ptr<EventLogger> event_logger_;
};
#endif

} // namespace logs
OPENTELEMETRY_END_NAMESPACE
13 changes: 11 additions & 2 deletions api/include/opentelemetry/logs/provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ OPENTELEMETRY_BEGIN_NAMESPACE
namespace logs
{

#if OPENTELEMETRY_ABI_VERSION_NO < 2
class EventLoggerProvider;
#endif
class LoggerProvider;

/**
Expand Down Expand Up @@ -45,13 +47,15 @@ class OPENTELEMETRY_EXPORT Provider
GetProvider() = tp;
}

#if OPENTELEMETRY_ABI_VERSION_NO < 2
/**
* Returns the singleton EventLoggerProvider.
*
* By default, a no-op EventLoggerProvider is returned. This will never return a
* nullptr EventLoggerProvider.
*/
static nostd::shared_ptr<EventLoggerProvider> GetEventLoggerProvider() noexcept
OPENTELEMETRY_DEPRECATED static nostd::shared_ptr<EventLoggerProvider>
GetEventLoggerProvider() noexcept
{
std::lock_guard<common::SpinLockMutex> guard(GetLock());
return nostd::shared_ptr<EventLoggerProvider>(GetEventProvider());
Expand All @@ -60,11 +64,13 @@ class OPENTELEMETRY_EXPORT Provider
/**
* Changes the singleton EventLoggerProvider.
*/
static void SetEventLoggerProvider(const nostd::shared_ptr<EventLoggerProvider> &tp) noexcept
OPENTELEMETRY_DEPRECATED static void SetEventLoggerProvider(
const nostd::shared_ptr<EventLoggerProvider> &tp) noexcept
{
std::lock_guard<common::SpinLockMutex> guard(GetLock());
GetEventProvider() = tp;
}
#endif

private:
OPENTELEMETRY_API_SINGLETON static nostd::shared_ptr<LoggerProvider> &GetProvider() noexcept
Expand All @@ -73,12 +79,15 @@ class OPENTELEMETRY_EXPORT Provider
return provider;
}

#if OPENTELEMETRY_ABI_VERSION_NO < 2
OPENTELEMETRY_DEPRECATED
OPENTELEMETRY_API_SINGLETON static nostd::shared_ptr<EventLoggerProvider> &
GetEventProvider() noexcept
{
static nostd::shared_ptr<EventLoggerProvider> provider(new NoopEventLoggerProvider);
return provider;
}
#endif

OPENTELEMETRY_API_SINGLETON static common::SpinLockMutex &GetLock() noexcept
{
Expand Down
3 changes: 1 addition & 2 deletions api/include/opentelemetry/semconv/exception_attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ namespace exception
* It's no longer recommended to record exceptions that are handled and do not escape the scope of a
* span.
*/
OPENTELEMETRY_DEPRECATED
static constexpr const char *kExceptionEscaped = "exception.escaped";
OPENTELEMETRY_DEPRECATED static constexpr const char *kExceptionEscaped = "exception.escaped";

/**
* The exception message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ namespace code
* @deprecated
* Replaced by @code code.column.number @endcode
*/
OPENTELEMETRY_DEPRECATED
static constexpr const char *kCodeColumn = "code.column";
OPENTELEMETRY_DEPRECATED static constexpr const char *kCodeColumn = "code.column";

/**
* The column number in @code code.file.path @endcode best representing the operation. It SHOULD
Expand All @@ -51,8 +50,7 @@ static constexpr const char *kCodeFilepath = "code.filepath";
* @deprecated
* Replaced by @code code.function.name @endcode
*/
OPENTELEMETRY_DEPRECATED
static constexpr const char *kCodeFunction = "code.function";
OPENTELEMETRY_DEPRECATED static constexpr const char *kCodeFunction = "code.function";

/**
* The method or function name, or equivalent (usually rightmost part of the code unit's name).
Expand All @@ -71,8 +69,7 @@ static constexpr const char *kCodeLineNumber = "code.line.number";
* @deprecated
* Replaced by @code code.line.number @endcode
*/
OPENTELEMETRY_DEPRECATED
static constexpr const char *kCodeLineno = "code.lineno";
OPENTELEMETRY_DEPRECATED static constexpr const char *kCodeLineno = "code.lineno";

/**
* The "namespace" within which @code code.function.name @endcode is defined. Usually the qualified
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ static constexpr const char *kContainerCommandLine = "container.command_line";
* @deprecated
* Replaced by @code cpu.mode @endcode
*/
OPENTELEMETRY_DEPRECATED
static constexpr const char *kContainerCpuState = "container.cpu.state";
OPENTELEMETRY_DEPRECATED static constexpr const char *kContainerCpuState = "container.cpu.state";

/**
* The name of the CSI (<a href="https://github.com/container-storage-interface/spec">Container
Expand Down Expand Up @@ -118,8 +117,7 @@ static constexpr const char *kContainerLabel = "container.label";
* @deprecated
* Replaced by @code container.label @endcode.
*/
OPENTELEMETRY_DEPRECATED
static constexpr const char *kContainerLabels = "container.labels";
OPENTELEMETRY_DEPRECATED static constexpr const char *kContainerLabels = "container.labels";

/**
* Container name used by container runtime.
Expand Down
Loading
Loading
0