Skip to content

Commit 3c4afd0

Browse files
authored
[API] Deprecate event logger (open-telemetry#3285)
1 parent 021eb99 commit 3c4afd0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+560
-775
lines changed

.clang-format

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,15 @@ IndentPPDirectives: AfterHash
5959

6060
# Include blocks style
6161
IncludeBlocks: Preserve
62+
63+
AttributeMacros:
64+
- OPENTELEMETRY_UNLIKELY
65+
- OPENTELEMETRY_LIKELY
66+
- OPENTELEMETRY_MAYBE_UNUSED
67+
- OPENTELEMETRY_DEPRECATED
68+
- OPENTELEMETRY_API_SINGLETON
69+
- OPENTELEMETRY_LOCAL_SYMBOL
70+
- OPENTELEMETRY_EXPORT
71+
- OPENTELEMETRY_SANITIZER_NO_MEMORY
72+
- OPENTELEMETRY_SANITIZER_NO_THREAD
73+
- OPENTELEMETRY_SANITIZER_NO_ADDRESS

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ if(OTELCPP_MAINTAINER_MODE)
603603
add_compile_options(/wd4127)
604604
add_compile_options(/wd4512)
605605
add_compile_options(/wd4267)
606+
add_compile_options(/wd4996)
606607

607608
# Enforced warnings
608609
add_compile_options(/we4265) # 'class': class has virtual functions, but

api/include/opentelemetry/logs/event_logger.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
OPENTELEMETRY_BEGIN_NAMESPACE
1515
namespace logs
1616
{
17+
#if OPENTELEMETRY_ABI_VERSION_NO < 2
1718
/**
1819
* Handles event log record creation.
1920
**/
20-
class EventLogger
21+
class OPENTELEMETRY_DEPRECATED EventLogger
2122
{
2223
public:
2324
virtual ~EventLogger() = default;
@@ -76,5 +77,6 @@ class EventLogger
7677
void IgnoreTraitResult(ValueType &&...)
7778
{}
7879
};
80+
#endif
7981
} // namespace logs
8082
OPENTELEMETRY_END_NAMESPACE

api/include/opentelemetry/logs/event_logger_provider.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ namespace logs
1414
class EventLogger;
1515
class Logger;
1616

17+
#if OPENTELEMETRY_ABI_VERSION_NO < 2
1718
/**
1819
* Creates new EventLogger instances.
1920
*/
20-
class EventLoggerProvider
21+
class OPENTELEMETRY_DEPRECATED EventLoggerProvider
2122
{
2223
public:
2324
virtual ~EventLoggerProvider() = default;
@@ -31,5 +32,6 @@ class EventLoggerProvider
3132
nostd::shared_ptr<Logger> delegate_logger,
3233
nostd::string_view event_domain) noexcept = 0;
3334
};
35+
#endif
3436
} // namespace logs
3537
OPENTELEMETRY_END_NAMESPACE

api/include/opentelemetry/logs/noop.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class NoopLoggerProvider final : public LoggerProvider
9090
nostd::shared_ptr<Logger> logger_;
9191
};
9292

93+
#if OPENTELEMETRY_ABI_VERSION_NO < 2
9394
class NoopEventLogger final : public EventLogger
9495
{
9596
public:
@@ -124,6 +125,7 @@ class NoopEventLoggerProvider final : public EventLoggerProvider
124125
private:
125126
nostd::shared_ptr<EventLogger> event_logger_;
126127
};
128+
#endif
127129

128130
} // namespace logs
129131
OPENTELEMETRY_END_NAMESPACE

api/include/opentelemetry/logs/provider.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ OPENTELEMETRY_BEGIN_NAMESPACE
1515
namespace logs
1616
{
1717

18+
#if OPENTELEMETRY_ABI_VERSION_NO < 2
1819
class EventLoggerProvider;
20+
#endif
1921
class LoggerProvider;
2022

2123
/**
@@ -45,13 +47,15 @@ class OPENTELEMETRY_EXPORT Provider
4547
GetProvider() = tp;
4648
}
4749

50+
#if OPENTELEMETRY_ABI_VERSION_NO < 2
4851
/**
4952
* Returns the singleton EventLoggerProvider.
5053
*
5154
* By default, a no-op EventLoggerProvider is returned. This will never return a
5255
* nullptr EventLoggerProvider.
5356
*/
54-
static nostd::shared_ptr<EventLoggerProvider> GetEventLoggerProvider() noexcept
57+
OPENTELEMETRY_DEPRECATED static nostd::shared_ptr<EventLoggerProvider>
58+
GetEventLoggerProvider() noexcept
5559
{
5660
std::lock_guard<common::SpinLockMutex> guard(GetLock());
5761
return nostd::shared_ptr<EventLoggerProvider>(GetEventProvider());
@@ -60,11 +64,13 @@ class OPENTELEMETRY_EXPORT Provider
6064
/**
6165
* Changes the singleton EventLoggerProvider.
6266
*/
63-
static void SetEventLoggerProvider(const nostd::shared_ptr<EventLoggerProvider> &tp) noexcept
67+
OPENTELEMETRY_DEPRECATED static void SetEventLoggerProvider(
68+
const nostd::shared_ptr<EventLoggerProvider> &tp) noexcept
6469
{
6570
std::lock_guard<common::SpinLockMutex> guard(GetLock());
6671
GetEventProvider() = tp;
6772
}
73+
#endif
6874

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

82+
#if OPENTELEMETRY_ABI_VERSION_NO < 2
83+
OPENTELEMETRY_DEPRECATED
7684
OPENTELEMETRY_API_SINGLETON static nostd::shared_ptr<EventLoggerProvider> &
7785
GetEventProvider() noexcept
7886
{
7987
static nostd::shared_ptr<EventLoggerProvider> provider(new NoopEventLoggerProvider);
8088
return provider;
8189
}
90+
#endif
8291

8392
OPENTELEMETRY_API_SINGLETON static common::SpinLockMutex &GetLock() noexcept
8493
{

api/include/opentelemetry/semconv/exception_attributes.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ namespace exception
2626
* It's no longer recommended to record exceptions that are handled and do not escape the scope of a
2727
* span.
2828
*/
29-
OPENTELEMETRY_DEPRECATED
30-
static constexpr const char *kExceptionEscaped = "exception.escaped";
29+
OPENTELEMETRY_DEPRECATED static constexpr const char *kExceptionEscaped = "exception.escaped";
3130

3231
/**
3332
* The exception message.

api/include/opentelemetry/semconv/incubating/code_attributes.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ namespace code
2525
* @deprecated
2626
* Replaced by @code code.column.number @endcode
2727
*/
28-
OPENTELEMETRY_DEPRECATED
29-
static constexpr const char *kCodeColumn = "code.column";
28+
OPENTELEMETRY_DEPRECATED static constexpr const char *kCodeColumn = "code.column";
3029

3130
/**
3231
* The column number in @code code.file.path @endcode best representing the operation. It SHOULD
@@ -51,8 +50,7 @@ static constexpr const char *kCodeFilepath = "code.filepath";
5150
* @deprecated
5251
* Replaced by @code code.function.name @endcode
5352
*/
54-
OPENTELEMETRY_DEPRECATED
55-
static constexpr const char *kCodeFunction = "code.function";
53+
OPENTELEMETRY_DEPRECATED static constexpr const char *kCodeFunction = "code.function";
5654

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

7774
/**
7875
* The "namespace" within which @code code.function.name @endcode is defined. Usually the qualified

api/include/opentelemetry/semconv/incubating/container_attributes.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ static constexpr const char *kContainerCommandLine = "container.command_line";
4343
* @deprecated
4444
* Replaced by @code cpu.mode @endcode
4545
*/
46-
OPENTELEMETRY_DEPRECATED
47-
static constexpr const char *kContainerCpuState = "container.cpu.state";
46+
OPENTELEMETRY_DEPRECATED static constexpr const char *kContainerCpuState = "container.cpu.state";
4847

4948
/**
5049
* The name of the CSI (<a href="https://github.com/container-storage-interface/spec">Container
@@ -118,8 +117,7 @@ static constexpr const char *kContainerLabel = "container.label";
118117
* @deprecated
119118
* Replaced by @code container.label @endcode.
120119
*/
121-
OPENTELEMETRY_DEPRECATED
122-
static constexpr const char *kContainerLabels = "container.labels";
120+
OPENTELEMETRY_DEPRECATED static constexpr const char *kContainerLabels = "container.labels";
123121

124122
/**
125123
* Container name used by container runtime.

0 commit comments

Comments
 (0)