Skip to content

Commit

Permalink
Included formatting changes from tools/format.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
msiddhu committed Jul 3, 2024
1 parent b0edc69 commit 9e36d31
Show file tree
Hide file tree
Showing 45 changed files with 96 additions and 91 deletions.
2 changes: 1 addition & 1 deletion bazel/extra_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

# Load prometheus C++ dependencies.

load("@com_github_jupp0r_prometheus_cpp//bazel:repositories.bzl", "prometheus_cpp_repositories")
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
load("@com_github_jupp0r_prometheus_cpp//bazel:repositories.bzl", "prometheus_cpp_repositories")
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

def opentelemetry_extra_deps():
Expand Down
6 changes: 3 additions & 3 deletions examples/grpc/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

package(default_visibility = ["//visibility:public"])

load("@rules_proto//proto:defs.bzl", "proto_library")
load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@rules_proto//proto:defs.bzl", "proto_library")

package(default_visibility = ["//visibility:public"])

proto_library(
name = "messages_proto",
Expand Down
4 changes: 2 additions & 2 deletions exporters/otlp/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

package(default_visibility = ["//visibility:public"])

load("//bazel:otel_cc_benchmark.bzl", "otel_cc_benchmark")

package(default_visibility = ["//visibility:public"])

cc_library(
name = "otlp_recordable",
srcs = [
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/common/attributemap_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ inline void GetHash(size_t &seed, const T &arg)
template <class T>
inline void GetHash(size_t &seed, const std::vector<T> &arg)
{
for (const auto& v : arg)
for (const auto &v : arg)
{
GetHash<T>(seed, v);
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/common/global_log_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ OPENTELEMETRY_END_NAMESPACE
{ \
using opentelemetry::sdk::common::internal_log::GlobalLogHandler; \
using opentelemetry::sdk::common::internal_log::LogHandler; \
if ((level) > GlobalLogHandler::GetLogLevel()) \
if ((level) > GlobalLogHandler::GetLogLevel()) \
{ \
break; \
} \
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/logs/logger_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class LoggerContext
{
public:
explicit LoggerContext(std::vector<std::unique_ptr<LogRecordProcessor>> &&processors,
const opentelemetry::sdk::resource::Resource& resource =
const opentelemetry::sdk::resource::Resource &resource =
opentelemetry::sdk::resource::Resource::Create({})) noexcept;

/**
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/logs/logger_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class OPENTELEMETRY_EXPORT LoggerProvider final : public opentelemetry::logs::Lo
* not be a nullptr
*/
explicit LoggerProvider(std::unique_ptr<LogRecordProcessor> &&processor,
const opentelemetry::sdk::resource::Resource& resource =
const opentelemetry::sdk::resource::Resource &resource =
opentelemetry::sdk::resource::Resource::Create({})) noexcept;

explicit LoggerProvider(std::vector<std::unique_ptr<LogRecordProcessor>> &&processors,
const opentelemetry::sdk::resource::Resource& resource =
const opentelemetry::sdk::resource::Resource &resource =
opentelemetry::sdk::resource::Resource::Create({})) noexcept;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DefaultAggregation

static std::unique_ptr<Aggregation> CreateAggregation(
AggregationType aggregation_type,
const InstrumentDescriptor& instrument_descriptor,
const InstrumentDescriptor &instrument_descriptor,
const AggregationConfig *aggregation_config = nullptr)
{
switch (aggregation_type)
Expand Down Expand Up @@ -113,9 +113,10 @@ class DefaultAggregation
}
}

static std::unique_ptr<Aggregation> CloneAggregation(AggregationType aggregation_type,
const InstrumentDescriptor& instrument_descriptor,
const Aggregation &to_copy)
static std::unique_ptr<Aggregation> CloneAggregation(
AggregationType aggregation_type,
const InstrumentDescriptor &instrument_descriptor,
const Aggregation &to_copy)
{
const PointType point_data = to_copy.ToPoint();
bool is_monotonic = true;
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/metrics/data/exemplar_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class ExemplarData
static PointType CreateDropPointData() { return DropPointData{}; }

private:
ExemplarData(const 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
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/metrics/meter_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class MeterContext : public std::enable_shared_from_this<MeterContext>
*/
MeterContext(
std::unique_ptr<ViewRegistry> views = std::unique_ptr<ViewRegistry>(new ViewRegistry()),
const opentelemetry::sdk::resource::Resource& resource =
const opentelemetry::sdk::resource::Resource &resource =
opentelemetry::sdk::resource::Resource::Create({})) noexcept;

/**
Expand Down Expand Up @@ -131,7 +131,7 @@ class MeterContext : public std::enable_shared_from_this<MeterContext>
*
* @param meter
*/
void AddMeter(const std::shared_ptr<Meter>& meter);
void AddMeter(const std::shared_ptr<Meter> &meter);

void RemoveMeter(nostd::string_view name,
nostd::string_view version,
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/metrics/meter_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class OPENTELEMETRY_EXPORT MeterProvider final : public opentelemetry::metrics::
* @param resource The resources for this meter provider.
*/
MeterProvider(
std::unique_ptr<ViewRegistry> views = std::unique_ptr<ViewRegistry>(new ViewRegistry()),
const sdk::resource::Resource& resource = sdk::resource::Resource::Create({})) noexcept;
std::unique_ptr<ViewRegistry> views = std::unique_ptr<ViewRegistry>(new ViewRegistry()),
const sdk::resource::Resource &resource = sdk::resource::Resource::Create({})) noexcept;

/**
* Initialize a new meter provider with a specified context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace metrics
class AsyncMetricStorage : public MetricStorage, public AsyncWritableMetricStorage
{
public:
AsyncMetricStorage(const InstrumentDescriptor& instrument_descriptor,
AsyncMetricStorage(const InstrumentDescriptor &instrument_descriptor,
const AggregationType aggregation_type,
#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW
ExemplarFilterType exempler_filter_type,
Expand Down
23 changes: 13 additions & 10 deletions sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ class AttributesHashMap
* If not present, it uses the provided callback to generate
* value and store in the hash
*/
Aggregation *GetOrSetDefault(const opentelemetry::common::KeyValueIterable &attributes,
const AttributesProcessor *attributes_processor,
const std::function<std::unique_ptr<Aggregation>()>& aggregation_callback,
size_t hash)
Aggregation *GetOrSetDefault(
const opentelemetry::common::KeyValueIterable &attributes,
const AttributesProcessor *attributes_processor,
const std::function<std::unique_ptr<Aggregation>()> &aggregation_callback,
size_t hash)
{
auto it = hash_map_.find(hash);
if (it != hash_map_.end())
Expand All @@ -88,8 +89,9 @@ class AttributesHashMap
return hash_map_[hash].second.get();
}

Aggregation *GetOrSetDefault(const std::function<std::unique_ptr<Aggregation>()>& aggregation_callback,
size_t hash)
Aggregation *GetOrSetDefault(
const std::function<std::unique_ptr<Aggregation>()> &aggregation_callback,
size_t hash)
{
auto it = hash_map_.find(hash);
if (it != hash_map_.end())
Expand All @@ -107,9 +109,10 @@ class AttributesHashMap
return hash_map_[hash].second.get();
}

Aggregation *GetOrSetDefault(const MetricAttributes &attributes,
const std::function<std::unique_ptr<Aggregation>()>& aggregation_callback,
size_t hash)
Aggregation *GetOrSetDefault(
const MetricAttributes &attributes,
const std::function<std::unique_ptr<Aggregation>()> &aggregation_callback,
size_t hash)
{
auto it = hash_map_.find(hash);
if (it != hash_map_.end())
Expand Down Expand Up @@ -199,7 +202,7 @@ class AttributesHashMap
size_t attributes_limit_;

Aggregation *GetOrSetOveflowAttributes(
const std::function<std::unique_ptr<Aggregation>()>& aggregation_callback)
const std::function<std::unique_ptr<Aggregation>()> &aggregation_callback)
{
auto agg = aggregation_callback();
return GetOrSetOveflowAttributes(std::move(agg));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace metrics
class SyncMultiMetricStorage : public SyncWritableMetricStorage
{
public:
void AddStorage(const std::shared_ptr<SyncWritableMetricStorage>& storage)
void AddStorage(const std::shared_ptr<SyncWritableMetricStorage> &storage)
{
storages_.push_back(storage);
}
Expand Down Expand Up @@ -81,7 +81,7 @@ class SyncMultiMetricStorage : public SyncWritableMetricStorage
class AsyncMultiMetricStorage : public AsyncWritableMetricStorage
{
public:
void AddStorage(const 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 @@ -56,7 +56,7 @@ class SyncMetricStorage : public MetricStorage, public SyncWritableMetricStorage
#endif // ENABLE_METRICS_EXEMPLAR_PREVIEW

public:
SyncMetricStorage(const InstrumentDescriptor& instrument_descriptor,
SyncMetricStorage(const InstrumentDescriptor &instrument_descriptor,
const AggregationType aggregation_type,
const AttributesProcessor *attributes_processor,
#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TemporalMetricStorage
nostd::span<std::shared_ptr<CollectorHandle>> collectors,
opentelemetry::common::SystemTimestamp sdk_start_ts,
opentelemetry::common::SystemTimestamp collection_ts,
const std::shared_ptr<AttributesHashMap>& delta_metrics,
const std::shared_ptr<AttributesHashMap> &delta_metrics,
nostd::function_ref<bool(MetricData)> callback) noexcept;

private:
Expand Down
12 changes: 6 additions & 6 deletions sdk/include/opentelemetry/sdk/metrics/sync_instruments.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Synchronous
class LongCounter : public Synchronous, public opentelemetry::metrics::Counter<uint64_t>
{
public:
LongCounter(const InstrumentDescriptor& instrument_descriptor,
LongCounter(const InstrumentDescriptor &instrument_descriptor,
std::unique_ptr<SyncWritableMetricStorage> storage);

void Add(uint64_t value,
Expand All @@ -56,7 +56,7 @@ class DoubleCounter : public Synchronous, public opentelemetry::metrics::Counter
{

public:
DoubleCounter(const InstrumentDescriptor& instrument_descriptor,
DoubleCounter(const InstrumentDescriptor &instrument_descriptor,
std::unique_ptr<SyncWritableMetricStorage> storage);

void Add(double value,
Expand All @@ -72,7 +72,7 @@ class DoubleCounter : public Synchronous, public opentelemetry::metrics::Counter
class LongUpDownCounter : public Synchronous, public opentelemetry::metrics::UpDownCounter<int64_t>
{
public:
LongUpDownCounter(const InstrumentDescriptor& instrument_descriptor,
LongUpDownCounter(const InstrumentDescriptor &instrument_descriptor,
std::unique_ptr<SyncWritableMetricStorage> storage);

void Add(int64_t value,
Expand All @@ -88,7 +88,7 @@ class LongUpDownCounter : public Synchronous, public opentelemetry::metrics::UpD
class DoubleUpDownCounter : public Synchronous, public opentelemetry::metrics::UpDownCounter<double>
{
public:
DoubleUpDownCounter(const InstrumentDescriptor& instrument_descriptor,
DoubleUpDownCounter(const InstrumentDescriptor &instrument_descriptor,
std::unique_ptr<SyncWritableMetricStorage> storage);

void Add(double value,
Expand All @@ -104,7 +104,7 @@ class DoubleUpDownCounter : public Synchronous, public opentelemetry::metrics::U
class LongHistogram : public Synchronous, public opentelemetry::metrics::Histogram<uint64_t>
{
public:
LongHistogram(const InstrumentDescriptor& instrument_descriptor,
LongHistogram(const InstrumentDescriptor &instrument_descriptor,
std::unique_ptr<SyncWritableMetricStorage> storage);

#if OPENTELEMETRY_ABI_VERSION_NO >= 2
Expand All @@ -124,7 +124,7 @@ class LongHistogram : public Synchronous, public opentelemetry::metrics::Histogr
class DoubleHistogram : public Synchronous, public opentelemetry::metrics::Histogram<double>
{
public:
DoubleHistogram(const InstrumentDescriptor& instrument_descriptor,
DoubleHistogram(const InstrumentDescriptor &instrument_descriptor,
std::unique_ptr<SyncWritableMetricStorage> storage);

#if OPENTELEMETRY_ABI_VERSION_NO >= 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class FilteringAttributesProcessor : public AttributesProcessor
{
public:
FilteringAttributesProcessor(
const std::unordered_map<std::string, bool>& allowed_attribute_keys = {})
const std::unordered_map<std::string, bool> &allowed_attribute_keys = {})
: allowed_attribute_keys_(allowed_attribute_keys)
{}

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 @@ -116,7 +116,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(const opentelemetry::trace::SpanContext& span_context)
void AddLink(const opentelemetry::trace::SpanContext &span_context)
{
AddLink(span_context, opentelemetry::sdk::GetEmptyAttributes());
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/trace/samplers/parent.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace trace
class ParentBasedSampler : public Sampler
{
public:
explicit ParentBasedSampler(const std::shared_ptr<Sampler>& delegate_sampler) noexcept;
explicit ParentBasedSampler(const std::shared_ptr<Sampler> &delegate_sampler) noexcept;
/** The decision either respects the parent span's sampling decision or delegates to
* delegateSampler for root spans
* @return Returns DROP always
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/trace/span_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class SpanDataEvent
class SpanDataLink
{
public:
SpanDataLink(const opentelemetry::trace::SpanContext& span_context,
SpanDataLink(const opentelemetry::trace::SpanContext &span_context,
const opentelemetry::common::KeyValueIterable &attributes)
: span_context_(span_context), attribute_map_(attributes)
{}
Expand Down
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/trace/tracer_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class TracerContext
public:
explicit TracerContext(
std::vector<std::unique_ptr<SpanProcessor>> &&processor,
const opentelemetry::sdk::resource::Resource& resource =
const opentelemetry::sdk::resource::Resource &resource =
opentelemetry::sdk::resource::Resource::Create({}),
std::unique_ptr<Sampler> sampler = std::unique_ptr<AlwaysOnSampler>(new AlwaysOnSampler),
std::unique_ptr<IdGenerator> id_generator =
Expand Down
4 changes: 2 additions & 2 deletions sdk/include/opentelemetry/sdk/trace/tracer_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class OPENTELEMETRY_EXPORT TracerProvider final : public opentelemetry::trace::T
*/
explicit TracerProvider(
std::unique_ptr<SpanProcessor> processor,
const opentelemetry::sdk::resource::Resource& resource =
const opentelemetry::sdk::resource::Resource &resource =
opentelemetry::sdk::resource::Resource::Create({}),
std::unique_ptr<Sampler> sampler = std::unique_ptr<AlwaysOnSampler>(new AlwaysOnSampler),
std::unique_ptr<IdGenerator> id_generator =
std::unique_ptr<IdGenerator>(new RandomIdGenerator())) noexcept;

explicit TracerProvider(
std::vector<std::unique_ptr<SpanProcessor>> &&processors,
const opentelemetry::sdk::resource::Resource& resource =
const opentelemetry::sdk::resource::Resource &resource =
opentelemetry::sdk::resource::Resource::Create({}),
std::unique_ptr<Sampler> sampler = std::unique_ptr<AlwaysOnSampler>(new AlwaysOnSampler),
std::unique_ptr<IdGenerator> id_generator =
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/logs/logger_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace logs
{

LoggerContext::LoggerContext(std::vector<std::unique_ptr<LogRecordProcessor>> &&processors,
const opentelemetry::sdk::resource::Resource& resource) noexcept
const opentelemetry::sdk::resource::Resource &resource) noexcept
: resource_(resource),
processor_(
std::unique_ptr<LogRecordProcessor>(new MultiLogRecordProcessor(std::move(processors))))
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/logs/logger_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace logs
{

LoggerProvider::LoggerProvider(std::unique_ptr<LogRecordProcessor> &&processor,
const opentelemetry::sdk::resource::Resource& resource) noexcept
const opentelemetry::sdk::resource::Resource &resource) noexcept
{
std::vector<std::unique_ptr<LogRecordProcessor>> processors;
processors.emplace_back(std::move(processor));
Expand All @@ -38,7 +38,7 @@ LoggerProvider::LoggerProvider(std::unique_ptr<LogRecordProcessor> &&processor,
}

LoggerProvider::LoggerProvider(std::vector<std::unique_ptr<LogRecordProcessor>> &&processors,
const opentelemetry::sdk::resource::Resource& resource) noexcept
const opentelemetry::sdk::resource::Resource &resource) noexcept
: context_{std::make_shared<LoggerContext>(std::move(processors), std::move(resource))}
{}

Expand Down
4 changes: 1 addition & 3 deletions sdk/src/metrics/aggregation/lastvalue_aggregation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ LongLastValueAggregation::LongLastValueAggregation()
point_data_.value_ = static_cast<int64_t>(0);
}

LongLastValueAggregation::LongLastValueAggregation(LastValuePointData &&data)
: point_data_{data}
{}
LongLastValueAggregation::LongLastValueAggregation(LastValuePointData &&data) : point_data_{data} {}

LongLastValueAggregation::LongLastValueAggregation(const LastValuePointData &data)
: point_data_{data}
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/metrics/meter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ std::vector<MetricData> Meter::Collect(CollectorHandle *collector,
for (auto &metric_storage : storage_registry_)
{
metric_storage.second->Collect(collector, ctx->GetCollectors(), ctx->GetSDKStartTime(),
collect_ts, [&metric_data_list](const MetricData& metric_data) {
collect_ts, [&metric_data_list](const MetricData &metric_data) {
metric_data_list.push_back(metric_data);
return true;
});
Expand Down
Loading

0 comments on commit 9e36d31

Please sign in to comment.