Skip to content

Commit

Permalink
Fix -Werror=suggest-override and style
Browse files Browse the repository at this point in the history
Signed-off-by: owent <[email protected]>
  • Loading branch information
owent committed Nov 25, 2022
1 parent c497f89 commit e28b065
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ class ElasticSearchRecordable final : public sdk::logs::Recordable
* Set Resource of this log
* @param Resource the resource to set
*/
void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept;
void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept override;

/**
* Set instrumentation_scope for this log.
* @param instrumentation_scope the instrumentation scope to set
*/
void SetInstrumentationScope(const opentelemetry::sdk::instrumentationscope::InstrumentationScope
&instrumentation_scope) noexcept;
&instrumentation_scope) noexcept override;

private:
// Define a JSON object that will be populated with the log data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,21 @@ class LogRecord : public opentelemetry::logs::LogRecord
return attributes_map_;
}

void SetTraceId(const opentelemetry::trace::TraceId& trace_id) noexcept override
void SetTraceId(const opentelemetry::trace::TraceId &trace_id) noexcept override
{
trace_id_ = trace_id;
}

const opentelemetry::trace::TraceId &GetTraceId() const noexcept { return trace_id_; }

void SetSpanId(const opentelemetry::trace::SpanId& span_id) noexcept override { span_id_ = span_id; }
void SetSpanId(const opentelemetry::trace::SpanId &span_id) noexcept override
{
span_id_ = span_id;
}

const opentelemetry::trace::SpanId &GetSpanId() const noexcept { return span_id_; }

void SetTraceFlags(const opentelemetry::trace::TraceFlags& trace_flags) noexcept override
void SetTraceFlags(const opentelemetry::trace::TraceFlags &trace_flags) noexcept override
{
trace_flags_ = trace_flags;
}
Expand Down
2 changes: 1 addition & 1 deletion exporters/ostream/test/ostream_log_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# include "opentelemetry/logs/provider.h"
# include "opentelemetry/nostd/span.h"
# include "opentelemetry/sdk/logs/logger_provider.h"
# include "opentelemetry/sdk/logs/simple_log_record_processor.h"
# include "opentelemetry/sdk/logs/read_write_log_record.h"
# include "opentelemetry/sdk/logs/simple_log_record_processor.h"

# include <gtest/gtest.h>
# include <iostream>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ class OtlpLogRecordable final : public opentelemetry::sdk::logs::Recordable
* Set Resource of this log
* @param Resource the resource to set
*/
void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept;
void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept override;

/**
* Set instrumentation_scope for this log.
* @param instrumentation_scope the instrumentation scope to set
*/
void SetInstrumentationScope(const opentelemetry::sdk::instrumentationscope::InstrumentationScope
&instrumentation_scope) noexcept;
&instrumentation_scope) noexcept override;

private:
proto::logs::v1::LogRecord proto_record_;
Expand Down
10 changes: 2 additions & 8 deletions exporters/otlp/src/otlp_log_recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,15 @@ namespace otlp

const opentelemetry::sdk::resource::Resource &OtlpLogRecordable::GetResource() const noexcept
{
OPENTELEMETRY_LIKELY_IF(nullptr != resource_)
{
return *resource_;
}
OPENTELEMETRY_LIKELY_IF(nullptr != resource_) { return *resource_; }

return opentelemetry::sdk::logs::ReadableLogRecord::GetDefaultResource();
}

const opentelemetry::sdk::instrumentationscope::InstrumentationScope &
OtlpLogRecordable::GetInstrumentationScope() const noexcept
{
OPENTELEMETRY_LIKELY_IF(nullptr != instrumentation_scope_)
{
return *instrumentation_scope_;
}
OPENTELEMETRY_LIKELY_IF(nullptr != instrumentation_scope_) { return *instrumentation_scope_; }

return opentelemetry::sdk::logs::ReadableLogRecord::GetDefaultInstrumentationScope();
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/logs/multi_recordable.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ class MultiRecordable final : public Recordable
* Set Resource of this log
* @param Resource the resource to set
*/
void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept;
void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept override;

/**
* Set instrumentation_scope for this log.
* @param instrumentation_scope the instrumentation scope to set
*/
void SetInstrumentationScope(const opentelemetry::sdk::instrumentationscope::InstrumentationScope
&instrumentation_scope) noexcept;
&instrumentation_scope) noexcept override;

private:
std::unordered_map<std::size_t, nostd::unique_ptr<Recordable>> recordables_;
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/logs/read_write_log_record.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class ReadWriteLogRecord final : public ReadableLogRecord
* Set Resource of this log
* @param Resource the resource to set
*/
void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept;
void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept override;

/**
* Get instrumentation_scope of this log.
Expand All @@ -161,7 +161,7 @@ class ReadWriteLogRecord final : public ReadableLogRecord
* @param instrumentation_scope the instrumentation scope to set
*/
void SetInstrumentationScope(const opentelemetry::sdk::instrumentationscope::InstrumentationScope
&instrumentation_scope) noexcept;
&instrumentation_scope) noexcept override;

private:
// Default values are set by the respective data structures' constructors for all fields,
Expand Down
5 changes: 1 addition & 4 deletions sdk/src/logs/read_write_log_record.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ void ReadWriteLogRecord::SetResource(
const opentelemetry::sdk::instrumentationscope::InstrumentationScope &
ReadWriteLogRecord::GetInstrumentationScope() const noexcept
{
OPENTELEMETRY_LIKELY_IF(nullptr != instrumentation_scope_)
{
return *instrumentation_scope_;
}
OPENTELEMETRY_LIKELY_IF(nullptr != instrumentation_scope_) { return *instrumentation_scope_; }

return GetDefaultInstrumentationScope();
}
Expand Down
6 changes: 3 additions & 3 deletions sdk/test/logs/batch_log_record_processor_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ namespace nostd = opentelemetry::nostd;
class MockLogRecordable final : public opentelemetry::sdk::logs::Recordable
{
public:
void SetTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override {}
void SetTimestamp(opentelemetry::common::SystemTimestamp) noexcept override {}

void SetObservedTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override {}
void SetObservedTimestamp(opentelemetry::common::SystemTimestamp) noexcept override {}

void SetSeverity(opentelemetry::logs::Severity severity) noexcept override {}
void SetSeverity(opentelemetry::logs::Severity) noexcept override {}

nostd::string_view GetBody() const noexcept { return body_; }

Expand Down
8 changes: 4 additions & 4 deletions sdk/test/logs/logger_provider_sdk_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ TEST(LoggerProviderSDK, LoggerProviderLoggerArguments)
class DummyLogRecordable final : public opentelemetry::sdk::logs::Recordable
{
public:
void SetTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override {}
void SetTimestamp(opentelemetry::common::SystemTimestamp) noexcept override {}

void SetObservedTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override {}
void SetObservedTimestamp(opentelemetry::common::SystemTimestamp) noexcept override {}

void SetSeverity(opentelemetry::logs::Severity severity) noexcept override {}
void SetSeverity(opentelemetry::logs::Severity) noexcept override {}

void SetBody(const opentelemetry::common::AttributeValue &message) noexcept override {}
void SetBody(const opentelemetry::common::AttributeValue &) noexcept override {}

void SetTraceId(const opentelemetry::trace::TraceId &) noexcept override {}

Expand Down
4 changes: 2 additions & 2 deletions sdk/test/logs/logger_sdk_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ TEST(LoggerSDK, LogToNullProcessor)
class MockLogRecordable final : public opentelemetry::sdk::logs::Recordable
{
public:
void SetTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override {}
void SetTimestamp(opentelemetry::common::SystemTimestamp) noexcept override {}

void SetObservedTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override {}
void SetObservedTimestamp(opentelemetry::common::SystemTimestamp) noexcept override {}

opentelemetry::logs::Severity GetSeverity() const noexcept { return severity_; }

Expand Down
6 changes: 3 additions & 3 deletions sdk/test/logs/simple_log_record_processor_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ namespace nostd = opentelemetry::nostd;
class TestLogRecordable final : public opentelemetry::sdk::logs::Recordable
{
public:
void SetTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override {}
void SetTimestamp(opentelemetry::common::SystemTimestamp) noexcept override {}

void SetObservedTimestamp(opentelemetry::common::SystemTimestamp timestamp) noexcept override {}
void SetObservedTimestamp(opentelemetry::common::SystemTimestamp) noexcept override {}

void SetSeverity(opentelemetry::logs::Severity severity) noexcept override {}
void SetSeverity(opentelemetry::logs::Severity) noexcept override {}

nostd::string_view GetBody() const noexcept { return body_; }

Expand Down

0 comments on commit e28b065

Please sign in to comment.