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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,19 @@ Increment the:
* [CODE HEALTH] Fix clang-tidy performance warnings
[#3941](https://github.com/open-telemetry/opentelemetry-cpp/pull/3941)

* [SDK] Swap Tracer/Meter/LoggerConfig disabled for enabled
[#3942](https://github.com/open-telemetry/opentelemetry-cpp/pull/3942)

Important changes:

* [SDK] Swap Tracer/Meter/LoggerConfig disabled for enabled
[#3942](https://github.com/open-telemetry/opentelemetry-cpp/pull/3942)

* In TracerConfig(bool), MeterConfig(bool), and LoggerConfig(bool),
the boolean parameter now represents `enabled` instead of `disabled`.
* User code calling these constructors explicitly must be adjusted
to pass `false` to disable.

* [BUILD] Revisit EventLogger deprecation
[#3855](https://github.com/open-telemetry/opentelemetry-cpp/pull/3855)

Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/logs/logger_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class OPENTELEMETRY_EXPORT LoggerConfig
static LoggerConfig Default();

private:
explicit LoggerConfig(const bool disabled = false) : disabled_(disabled) {}
explicit LoggerConfig(const bool enabled = true) : enabled_(enabled) {}

bool disabled_;
bool enabled_;
};
} // namespace logs
} // namespace sdk
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/metrics/meter_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class OPENTELEMETRY_EXPORT MeterConfig
static MeterConfig Default();

private:
explicit MeterConfig(const bool disabled = false) : disabled_(disabled) {}
bool disabled_;
explicit MeterConfig(const bool enabled = true) : enabled_(enabled) {}
bool enabled_;
};
} // namespace metrics
} // namespace sdk
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/trace/tracer_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class OPENTELEMETRY_EXPORT TracerConfig
static TracerConfig Default();

private:
explicit TracerConfig(const bool disabled = false) : disabled_(disabled) {}
bool disabled_;
explicit TracerConfig(const bool enabled = true) : enabled_(enabled) {}
bool enabled_;
};
} // namespace trace
} // namespace sdk
Expand Down
6 changes: 3 additions & 3 deletions sdk/src/logs/logger_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ namespace logs

OPENTELEMETRY_EXPORT bool LoggerConfig::operator==(const LoggerConfig &other) const noexcept
{
return disabled_ == other.disabled_;
return enabled_ == other.enabled_;
}

OPENTELEMETRY_EXPORT bool LoggerConfig::IsEnabled() const noexcept
{
return !disabled_;
return enabled_;
}

OPENTELEMETRY_EXPORT LoggerConfig LoggerConfig::Enabled()
Expand All @@ -26,7 +26,7 @@ OPENTELEMETRY_EXPORT LoggerConfig LoggerConfig::Enabled()

OPENTELEMETRY_EXPORT LoggerConfig LoggerConfig::Disabled()
{
static const auto kDisabledConfig = LoggerConfig(true);
static const auto kDisabledConfig = LoggerConfig(false);
return kDisabledConfig;
}

Expand Down
6 changes: 3 additions & 3 deletions sdk/src/metrics/meter_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ namespace metrics

OPENTELEMETRY_EXPORT bool MeterConfig::operator==(const MeterConfig &other) const noexcept
{
return disabled_ == other.disabled_;
return enabled_ == other.enabled_;
}

OPENTELEMETRY_EXPORT bool MeterConfig::IsEnabled() const noexcept
{
return !disabled_;
return enabled_;
}

OPENTELEMETRY_EXPORT MeterConfig MeterConfig::Disabled()
{
static const auto kDisabledConfig = MeterConfig(true);
static const auto kDisabledConfig = MeterConfig(false);
return kDisabledConfig;
}

Expand Down
6 changes: 3 additions & 3 deletions sdk/src/trace/tracer_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace trace

OPENTELEMETRY_EXPORT TracerConfig TracerConfig::Disabled()
{
static const auto kDisabledConfig = TracerConfig(true);
static const auto kDisabledConfig = TracerConfig(false);
return kDisabledConfig;
}

Expand All @@ -28,12 +28,12 @@ OPENTELEMETRY_EXPORT TracerConfig TracerConfig::Default()

OPENTELEMETRY_EXPORT bool TracerConfig::IsEnabled() const noexcept
{
return !disabled_;
return enabled_;
}

OPENTELEMETRY_EXPORT bool TracerConfig::operator==(const TracerConfig &other) const noexcept
{
return disabled_ == other.disabled_;
return enabled_ == other.enabled_;
}

} // namespace trace
Expand Down
Loading