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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ Increment the:
* [EXPORTER] Allow custom HttpClient in OTLP HTTP
[#3930](https://github.com/open-telemetry/opentelemetry-cpp/pull/3930)

* [CODE HEALTH] Fix clang-tidy unnecessary value param warnings
[#3931](https://github.com/open-telemetry/opentelemetry-cpp/pull/3931)

Important changes:

* [BUILD] Revisit EventLogger deprecation
Expand Down
3 changes: 2 additions & 1 deletion examples/grpc/tracer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ void CleanupTracer()
opentelemetry::sdk::trace::Provider::SetTracerProvider(none);
}

opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer> get_tracer(std::string tracer_name)
opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer> get_tracer(
const std::string &tracer_name)
{
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
return provider->GetTracer(tracer_name);
Expand Down
3 changes: 2 additions & 1 deletion examples/http/tracer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ void CleanupTracer()
opentelemetry::sdk::trace::Provider::SetTracerProvider(none);
}

opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer> get_tracer(std::string tracer_name)
opentelemetry::nostd::shared_ptr<opentelemetry::trace::Tracer> get_tracer(
const std::string &tracer_name)
{
auto provider = opentelemetry::trace::Provider::GetTracerProvider();
return provider->GetTracer(tracer_name);
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/test/otlp_file_metric_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ProtobufGlobalSymbolGuard
};

template <class IntegerType>
static IntegerType JsonToInteger(nlohmann::json value)
static IntegerType JsonToInteger(const nlohmann::json &value)
{
if (value.is_string())
{
Expand Down
3 changes: 2 additions & 1 deletion exporters/otlp/test/otlp_grpc_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ TEST_F(OtlpGrpcExporterTestPeer, ConfigRetryGenericValuesFromEnv)
# ifdef ENABLE_OTLP_RETRY_PREVIEW
struct TestTraceService : public opentelemetry::proto::collector::trace::v1::TraceService::Service
{
TestTraceService(std::vector<grpc::StatusCode> status_codes) : status_codes_(status_codes) {}
TestTraceService(const std::vector<grpc::StatusCode> &status_codes) : status_codes_(status_codes)
{}

inline grpc::Status Export(
grpc::ServerContext *,
Expand Down
4 changes: 2 additions & 2 deletions exporters/otlp/test/otlp_grpc_metric_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ class OtlpGrpcMetricExporterTestPeer : public ::testing::Test

std::unique_ptr<sdk::metrics::PushMetricExporter> GetExporter(
std::unique_ptr<proto::collector::metrics::v1::MetricsService::StubInterface> stub_interface,
std::shared_ptr<OtlpGrpcClient> client)
const std::shared_ptr<OtlpGrpcClient> &client)
{
return std::unique_ptr<sdk::metrics::PushMetricExporter>(
new OtlpGrpcMetricExporter(std::move(stub_interface), std::move(client)));
}

std::unique_ptr<sdk::metrics::PushMetricExporter> GetExporter(
const OtlpGrpcMetricExporterOptions &options,
std::shared_ptr<OtlpGrpcClient> client)
const std::shared_ptr<OtlpGrpcClient> &client)
{
return std::unique_ptr<sdk::metrics::PushMetricExporter>(
new OtlpGrpcMetricExporter(options, std::move(client)));
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/test/otlp_http_metric_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace otlp
{

template <class IntegerType>
static IntegerType JsonToInteger(nlohmann::json value)
static IntegerType JsonToInteger(const nlohmann::json &value)
{
if (value.is_string())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class PrometheusExporterUtils
* Counter => Prometheus Counter
*/
template <typename T>
static void SetData(std::vector<T> values,
static void SetData(const std::vector<T> &values,
const opentelemetry::sdk::metrics::PointAttributes &labels,
const opentelemetry::sdk::instrumentationscope::InstrumentationScope *scope,
::prometheus::MetricType type,
Expand All @@ -175,7 +175,7 @@ class PrometheusExporterUtils
* Histogram => Prometheus Histogram
*/
template <typename T>
static void SetData(std::vector<T> values,
static void SetData(const std::vector<T> &values,
const std::vector<double> &boundaries,
const std::vector<uint64_t> &counts,
const opentelemetry::sdk::metrics::PointAttributes &labels,
Expand Down
4 changes: 2 additions & 2 deletions exporters/prometheus/src/exporter_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ void PrometheusExporterUtils::SetTarget(
*/
template <typename T>
void PrometheusExporterUtils::SetData(
std::vector<T> values,
const std::vector<T> &values,
const metric_sdk::PointAttributes &labels,
const opentelemetry::sdk::instrumentationscope::InstrumentationScope *scope,
prometheus_client::MetricType type,
Expand All @@ -661,7 +661,7 @@ void PrometheusExporterUtils::SetData(
*/
template <typename T>
void PrometheusExporterUtils::SetData(
std::vector<T> values,
const std::vector<T> &values,
const std::vector<double> &boundaries,
const std::vector<uint64_t> &counts,
const metric_sdk::PointAttributes &labels,
Expand Down
6 changes: 3 additions & 3 deletions ext/include/opentelemetry/ext/http/server/http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ class HttpRequestCallback

virtual ~HttpRequestCallback() = default;

HttpRequestCallback(CallbackFunction func) : callback(func) {}
HttpRequestCallback(CallbackFunction func) : callback(std::move(func)) {}

HttpRequestCallback &operator=(CallbackFunction func)
{
callback = func;
callback = std::move(func);
return (*this);
}

Expand Down Expand Up @@ -133,7 +133,7 @@ class HttpServer : private SocketTools::Reactor::SocketCallback
second = nullptr;
}

HttpRequestHandler &operator=(std::pair<std::string, HttpRequestCallback *> other)
HttpRequestHandler &operator=(const std::pair<std::string, HttpRequestCallback *> &other)
{
first = other.first;
second = other.second;
Expand Down
2 changes: 1 addition & 1 deletion ext/include/opentelemetry/ext/http/server/socket_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ struct SocketData

SocketData() : socket(), flags(0) {}

bool operator==(Socket s) { return (socket == s); }
bool operator==(const Socket &s) { return (socket == s); }
};

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once
#include <functional>
#include <utility>

#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
#include "opentelemetry/version.h"
Expand Down Expand Up @@ -48,7 +49,7 @@ class ScopeConfigurator
Builder &AddCondition(std::function<bool(const InstrumentationScope &)> scope_matcher,
T scope_config)
{
conditions_.emplace_back(scope_matcher, scope_config);
conditions_.emplace_back(std::move(scope_matcher), scope_config);
return *this;
}

Expand Down Expand Up @@ -135,7 +136,7 @@ class ScopeConfigurator
private:
// Prevent direct initialization of ScopeConfigurator objects.
explicit ScopeConfigurator(std::function<T(const InstrumentationScope &)> configurator)
: configurator_(configurator)
: configurator_(std::move(configurator))
{}

std::function<T(const InstrumentationScope &)> configurator_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class DefaultAggregation

static std::unique_ptr<Aggregation> CreateAggregation(
AggregationType aggregation_type,
InstrumentDescriptor instrument_descriptor,
const InstrumentDescriptor &instrument_descriptor,
const AggregationConfig *aggregation_config = nullptr)
{
switch (aggregation_type)
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ using MetricAttributes = opentelemetry::sdk::metrics::FilteredOrderedAttributeMa
class ExemplarData
{
public:
static ExemplarData Create(std::shared_ptr<opentelemetry::trace::SpanContext> context,
static ExemplarData Create(const std::shared_ptr<opentelemetry::trace::SpanContext> &context,
const opentelemetry::common::SystemTimestamp &timestamp,
const PointDataAttributes &point_data_attr)
{
Expand Down Expand Up @@ -68,7 +68,7 @@ class ExemplarData
static PointType CreateDropPointData() { return DropPointData{}; }

private:
ExemplarData(std::shared_ptr<opentelemetry::trace::SpanContext> context,
ExemplarData(const std::shared_ptr<opentelemetry::trace::SpanContext> &context,
opentelemetry::common::SystemTimestamp timestamp,
const PointDataAttributes &point_data_attr)
: context_(*context.get()), timestamp_(timestamp), point_data_attr_(point_data_attr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AlignedHistogramBucketExemplarReservoir : public FixedSizeExemplarReservoi

AlignedHistogramBucketExemplarReservoir(
size_t size,
std::shared_ptr<ReservoirCellSelector> reservoir_cell_selector,
const std::shared_ptr<ReservoirCellSelector> &reservoir_cell_selector,
MapAndResetCellType map_and_reset_cell)
: FixedSizeExemplarReservoir(size + 1, reservoir_cell_selector, map_and_reset_cell)
{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FixedSizeExemplarReservoir : public ExemplarReservoir

public:
FixedSizeExemplarReservoir(size_t size,
std::shared_ptr<ReservoirCellSelector> reservoir_cell_selector,
const std::shared_ptr<ReservoirCellSelector> &reservoir_cell_selector,
MapAndResetCellType map_and_reset_cell)
: storage_(size),
reservoir_cell_selector_(reservoir_cell_selector),
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/metrics/exemplar/reservoir.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ class ExemplarReservoir

static nostd::shared_ptr<ExemplarReservoir> GetSimpleFixedSizeExemplarReservoir(
size_t size,
std::shared_ptr<ReservoirCellSelector> reservoir_cell_selector,
const std::shared_ptr<ReservoirCellSelector> &reservoir_cell_selector,
MapAndResetCellType map_and_reset_cell);

static nostd::shared_ptr<ExemplarReservoir> GetAlignedHistogramBucketExemplarReservoir(
size_t size,
std::shared_ptr<ReservoirCellSelector> reservoir_cell_selector,
const std::shared_ptr<ReservoirCellSelector> &reservoir_cell_selector,
MapAndResetCellType map_and_reset_cell);

static nostd::shared_ptr<ExemplarReservoir> GetNoExemplarReservoir();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ class SimpleFixedSizeExemplarReservoir : public FixedSizeExemplarReservoir
return std::shared_ptr<ReservoirCellSelector>{new SimpleFixedSizeCellSelector{size}};
}

SimpleFixedSizeExemplarReservoir(size_t size,
std::shared_ptr<ReservoirCellSelector> reservoir_cell_selector,
MapAndResetCellType map_and_reset_cell)
SimpleFixedSizeExemplarReservoir(
size_t size,
const std::shared_ptr<ReservoirCellSelector> &reservoir_cell_selector,
MapAndResetCellType map_and_reset_cell)
: FixedSizeExemplarReservoir(size, reservoir_cell_selector, map_and_reset_cell)
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ class MetricFilter
const PointAttributes &attributes)>;

// static
static std::unique_ptr<MetricFilter> Create(TestMetricFn test_metric_fn,
TestAttributesFn test_attributes_fn)
static std::unique_ptr<MetricFilter> Create(const TestMetricFn &test_metric_fn,
const TestAttributesFn &test_attributes_fn)
{
return std::make_unique<MetricFilter>(test_metric_fn, test_attributes_fn);
}

MetricFilter(TestMetricFn test_metric_fn, TestAttributesFn test_attributes_fn)
MetricFilter(const TestMetricFn &test_metric_fn, const TestAttributesFn &test_attributes_fn)
: test_metric_fn_(test_metric_fn), test_attributes_fn_(test_attributes_fn)
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace metrics
class AsyncMetricStorage : public MetricStorage, public AsyncWritableMetricStorage
{
public:
AsyncMetricStorage(InstrumentDescriptor instrument_descriptor,
AsyncMetricStorage(const InstrumentDescriptor &instrument_descriptor,
const AggregationType aggregation_type,
#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW
ExemplarFilterType exempler_filter_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace metrics
class SyncMultiMetricStorage : public SyncWritableMetricStorage
{
public:
void AddStorage(std::shared_ptr<SyncWritableMetricStorage> storage)
void AddStorage(const std::shared_ptr<SyncWritableMetricStorage> &storage)
{
storages_.push_back(storage);
}
Expand Down Expand Up @@ -73,7 +73,7 @@ class SyncMultiMetricStorage : public SyncWritableMetricStorage
class AsyncMultiMetricStorage : public AsyncWritableMetricStorage
{
public:
void AddStorage(std::shared_ptr<AsyncWritableMetricStorage> storage)
void AddStorage(const std::shared_ptr<AsyncWritableMetricStorage> &storage)
{
storages_.push_back(storage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage
#endif // ENABLE_METRICS_EXEMPLAR_PREVIEW

public:
SyncMetricStorage(InstrumentDescriptor instrument_descriptor,
SyncMetricStorage(const InstrumentDescriptor &instrument_descriptor,
const AggregationType aggregation_type,
std::shared_ptr<const AttributesProcessor> attributes_processor,
#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/metrics/sync_instruments.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace metrics
class Synchronous
{
public:
Synchronous(InstrumentDescriptor instrument_descriptor,
Synchronous(const InstrumentDescriptor &instrument_descriptor,
std::unique_ptr<SyncWritableMetricStorage> storage)
: instrument_descriptor_(instrument_descriptor), storage_(std::move(storage))
{}
Expand Down
6 changes: 3 additions & 3 deletions sdk/include/opentelemetry/sdk/metrics/view/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class View
{
public:
View(const std::string &name,
const std::string &description = "",
AggregationType aggregation_type = AggregationType::kDefault,
std::shared_ptr<AggregationConfig> aggregation_config = nullptr,
const std::string &description = "",
AggregationType aggregation_type = AggregationType::kDefault,
const std::shared_ptr<AggregationConfig> &aggregation_config = nullptr,
std::unique_ptr<opentelemetry::sdk::metrics::AttributesProcessor> attributes_processor =
std::unique_ptr<opentelemetry::sdk::metrics::AttributesProcessor>(
new opentelemetry::sdk::metrics::DefaultAttributesProcessor()))
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/metrics/view/view_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class OPENTELEMETRY_EXPORT ViewFactory
static std::unique_ptr<View> Create(const std::string &name,
const std::string &description,
AggregationType aggregation_type,
std::shared_ptr<AggregationConfig> aggregation_config);
const std::shared_ptr<AggregationConfig> &aggregation_config);

static std::unique_ptr<View> Create(const std::string &name,
const std::string &description,
AggregationType aggregation_type,
std::shared_ptr<AggregationConfig> aggregation_config,
const std::shared_ptr<AggregationConfig> &aggregation_config,
std::unique_ptr<AttributesProcessor> attributes_processor);
};

Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/trace/recordable.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class Recordable
* Add a link to a span with default (empty) attributes.
* @param span_context the span context of the linked span
*/
void AddLink(opentelemetry::trace::SpanContext span_context)
void AddLink(const opentelemetry::trace::SpanContext &span_context)
{
AddLink(span_context, opentelemetry::sdk::GetEmptyAttributes());
}
Expand Down
5 changes: 3 additions & 2 deletions sdk/include/opentelemetry/sdk/trace/span_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

#include "opentelemetry/common/attribute_value.h"
Expand Down Expand Up @@ -40,7 +41,7 @@ class SpanDataEvent
SpanDataEvent(std::string name,
opentelemetry::common::SystemTimestamp timestamp,
const opentelemetry::common::KeyValueIterable &attributes)
: name_(name), timestamp_(timestamp), attribute_map_(attributes)
: name_(std::move(name)), timestamp_(timestamp), attribute_map_(attributes)
{}

/**
Expand Down Expand Up @@ -79,7 +80,7 @@ class SpanDataLink
public:
SpanDataLink(opentelemetry::trace::SpanContext span_context,
const opentelemetry::common::KeyValueIterable &attributes)
: span_context_(span_context), attribute_map_(attributes)
: span_context_(std::move(span_context)), attribute_map_(attributes)
{}

/**
Expand Down
Loading
Loading