Skip to content

Commit 961f204

Browse files
authored
Merge branch 'main' into add_user_agent_for_http_client
2 parents 202847b + 1dc810d commit 961f204

File tree

95 files changed

+988
-177
lines changed

Some content is hidden

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

95 files changed

+988
-177
lines changed

api/include/opentelemetry/common/kv_properties.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,4 +270,4 @@ class KeyValueProperties
270270
size_t Size() const noexcept { return num_entries_; }
271271
};
272272
} // namespace common
273-
OPENTELEMETRY_END_NAMESPACE
273+
OPENTELEMETRY_END_NAMESPACE

api/include/opentelemetry/context/propagation/composite_propagator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ class CompositePropagator : public TextMapPropagator
8989
};
9090
} // namespace propagation
9191
} // namespace context
92-
OPENTELEMETRY_END_NAMESPACE;
92+
OPENTELEMETRY_END_NAMESPACE

api/include/opentelemetry/metrics/noop.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class NoopUpDownCounter : public UpDownCounter<T>
5858
nostd::string_view /* description */,
5959
nostd::string_view /* unit */) noexcept
6060
{}
61-
~NoopUpDownCounter() = default;
61+
~NoopUpDownCounter() override = default;
6262
void Add(T /* value */) noexcept override {}
6363
void Add(T /* value */, const opentelemetry::context::Context & /* context */) noexcept override
6464
{}

api/include/opentelemetry/std/utility.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ auto size(const C &c) noexcept(noexcept(c.size())) -> decltype(c.size())
5454
}
5555

5656
template <class T, std::size_t N>
57-
std::size_t size(T (&array)[N]) noexcept
57+
std::size_t size(T (&/* array */)[N]) noexcept
5858
{
5959
return N;
6060
}

api/include/opentelemetry/std/variant.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -146,58 +146,58 @@ template <std::size_t I, class... Types>
146146
constexpr std::variant_alternative_t<I, std::variant<Types...>> &get(std::variant<Types...> &v)
147147
{
148148
return std::get<I, Types...>(v);
149-
};
149+
}
150150

151151
template <std::size_t I, class... Types>
152152
constexpr std::variant_alternative_t<I, std::variant<Types...>> &&get(std::variant<Types...> &&v)
153153
{
154154
return std::get<I, Types...>(std::forward<decltype(v)>(v));
155-
};
155+
}
156156

157157
template <std::size_t I, class... Types>
158158
constexpr const std::variant_alternative_t<I, std::variant<Types...>> &get(
159159
const std::variant<Types...> &v)
160160
{
161161
return std::get<I, Types...>(v);
162-
};
162+
}
163163

164164
template <std::size_t I, class... Types>
165165
constexpr const std::variant_alternative_t<I, std::variant<Types...>> &&get(
166166
const std::variant<Types...> &&v)
167167
{
168168
return std::get<I, Types...>(std::forward<decltype(v)>(v));
169-
};
169+
}
170170

171171
template <class T, class... Types>
172172
constexpr T &get(std::variant<Types...> &v)
173173
{
174174
return std::get<T, Types...>(v);
175-
};
175+
}
176176

177177
template <class T, class... Types>
178178
constexpr T &&get(std::variant<Types...> &&v)
179179
{
180180
return std::get<T, Types...>(std::forward<decltype(v)>(v));
181-
};
181+
}
182182

183183
template <class T, class... Types>
184184
constexpr const T &get(const std::variant<Types...> &v)
185185
{
186186
return std::get<T, Types...>(v);
187-
};
187+
}
188188

189189
template <class T, class... Types>
190190
constexpr const T &&get(const std::variant<Types...> &&v)
191191
{
192192
return std::get<T, Types...>(std::forward<decltype(v)>(v));
193-
};
193+
}
194194

195195
template <class _Callable, class... _Variants>
196196
constexpr auto visit(_Callable &&_Obj, _Variants &&... _Args)
197197
{
198198
return std::visit<_Callable, _Variants...>(static_cast<_Callable &&>(_Obj),
199199
static_cast<_Variants &&>(_Args)...);
200-
};
200+
}
201201

202202
#endif
203203

api/include/opentelemetry/trace/context.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ inline context::Context SetSpan(opentelemetry::context::Context &context,
3030
}
3131

3232
} // namespace trace
33-
OPENTELEMETRY_END_NAMESPACE
33+
OPENTELEMETRY_END_NAMESPACE

api/include/opentelemetry/trace/span_metadata.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ struct EndSpanOptions
4040
};
4141

4242
} // namespace trace
43-
OPENTELEMETRY_END_NAMESPACE
43+
OPENTELEMETRY_END_NAMESPACE

api/include/opentelemetry/trace/span_startoptions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ struct StartSpanOptions
4242
};
4343

4444
} // namespace trace
45-
OPENTELEMETRY_END_NAMESPACE
45+
OPENTELEMETRY_END_NAMESPACE

api/test/metrics/noop_sync_instrument_test.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ TEST(UpDownCountr, Record)
4747
counter->Add(10l, {{"k1", "1"}, {"k2", 2}}, opentelemetry::context::Context{});
4848
}
4949

50-
#endif
50+
#endif

examples/common/metrics_foo_library/foo_library.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ std::map<std::string, std::string> get_random_attr()
3232
class MeasurementFetcher
3333
{
3434
public:
35-
static void Fetcher(opentelemetry::metrics::ObserverResult observer_result, void *state)
35+
static void Fetcher(opentelemetry::metrics::ObserverResult observer_result, void * /* state */)
3636
{
3737
std::map<std::string, std::string> labels = get_random_attr();
3838
auto labelkv = opentelemetry::common::KeyValueIterableView<decltype(labels)>{labels};

examples/http/server.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ class RequestHandler : public HTTP_SERVER_NS::HttpRequestCallback
2929
std::string span_name = request.uri;
3030

3131
// extract context from http header
32-
const HttpTextMapCarrier<std::map<std::string, std::string>> carrier(
33-
(std::map<std::string, std::string> &)request.headers);
32+
std::map<std::string, std::string> &request_headers =
33+
const_cast<std::map<std::string, std::string> &>(request.headers);
34+
const HttpTextMapCarrier<std::map<std::string, std::string>> carrier(request_headers);
3435
auto prop = context::propagation::GlobalTextMapPropagator::GetGlobalPropagator();
3536
auto current_ctx = context::RuntimeContext::GetCurrent();
3637
auto new_context = prop->Extract(carrier, current_ctx);

examples/http/server.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ class HttpServer : public HTTP_SERVER_NS::HttpRequestCallback
5050
~HttpServer() { Stop(); }
5151
};
5252

53-
} // namespace
53+
} // namespace

examples/plugin/plugin/factory_impl.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class FactoryImpl final : public plugin::Factory::FactoryImpl
2525
public:
2626
// opentelemetry::plugin::Factory::FactoryImpl
2727
nostd::unique_ptr<plugin::TracerHandle> MakeTracerHandle(
28-
nostd::string_view tracer_config,
29-
nostd::unique_ptr<char[]> &error_message) const noexcept override
28+
nostd::string_view /* tracer_config */,
29+
nostd::unique_ptr<char[]> & /* error_message */) const noexcept override
3030
{
3131
std::shared_ptr<Tracer> tracer{new (std::nothrow) Tracer{""}};
3232
if (tracer == nullptr)
@@ -46,4 +46,4 @@ static nostd::unique_ptr<plugin::Factory::FactoryImpl> MakeFactoryImpl(
4646
return nostd::unique_ptr<plugin::Factory::FactoryImpl>{new (std::nothrow) FactoryImpl{}};
4747
}
4848

49-
OPENTELEMETRY_DEFINE_PLUGIN_HOOK(MakeFactoryImpl);
49+
OPENTELEMETRY_DEFINE_PLUGIN_HOOK(MakeFactoryImpl)

examples/plugin/plugin/tracer.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Span final : public trace::Span
2727
std::cout << "StartSpan: " << name << "\n";
2828
}
2929

30-
~Span() { std::cout << "~Span\n"; }
30+
~Span() override { std::cout << "~Span\n"; }
3131

3232
// opentelemetry::trace::Span
3333
void SetAttribute(nostd::string_view /*name*/,

exporters/jaeger/src/jaeger_exporter.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void JaegerExporter::InitializeEndpoint()
9393
assert(false);
9494
}
9595

96-
bool JaegerExporter::Shutdown(std::chrono::microseconds timeout) noexcept
96+
bool JaegerExporter::Shutdown(std::chrono::microseconds /* timeout */) noexcept
9797
{
9898
const std::lock_guard<opentelemetry::common::SpinLockMutex> locked(lock_);
9999
is_shutdown_ = true;

exporters/jaeger/src/recordable.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void JaegerRecordable::SetInstrumentationScope(
191191
}
192192

193193
void JaegerRecordable::AddLink(const trace::SpanContext &span_context,
194-
const common::KeyValueIterable &attributes) noexcept
194+
const common::KeyValueIterable & /* attributes */) noexcept
195195
{
196196
// Note: "The Link’s attributes cannot be represented in Jaeger explicitly."
197197
// -- https://opentelemetry.io/docs/reference/specification/trace/sdk_exporters/jaeger/#links

exporters/jaeger/src/udp_transport.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class UDPTransport : public Transport
3535
static constexpr auto kUDPPacketMaxLength = 65000;
3636

3737
UDPTransport(const std::string &addr, uint16_t port);
38-
virtual ~UDPTransport();
38+
~UDPTransport() override;
3939

4040
int EmitBatch(const thrift::Batch &batch) override;
4141

exporters/memory/src/in_memory_span_exporter_factory.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ std::unique_ptr<opentelemetry::sdk::trace::SpanExporter> InMemorySpanExporterFac
1616
std::shared_ptr<InMemorySpanData> &data)
1717
{
1818
return Create(data, MAX_BUFFER_SIZE);
19-
};
19+
}
2020

2121
std::unique_ptr<opentelemetry::sdk::trace::SpanExporter> InMemorySpanExporterFactory::Create(
2222
std::shared_ptr<InMemorySpanData> &data,

exporters/ostream/include/opentelemetry/exporters/ostream/common_utils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ inline void print_value(const opentelemetry::sdk::common::OwnedAttributeValue &v
7878

7979
} // namespace ostream_common
8080
} // namespace exporter
81-
OPENTELEMETRY_END_NAMESPACE
81+
OPENTELEMETRY_END_NAMESPACE

exporters/ostream/src/span_exporter_factory.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace trace
1515
std::unique_ptr<trace_sdk::SpanExporter> OStreamSpanExporterFactory::Create()
1616
{
1717
return Create(std::cout);
18-
};
18+
}
1919

2020
std::unique_ptr<trace_sdk::SpanExporter> OStreamSpanExporterFactory::Create(std::ostream &sout)
2121
{

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ class OtlpGrpcMetricExporter : public opentelemetry::sdk::metrics::MetricExporte
8484
} // namespace otlp
8585
} // namespace exporter
8686
OPENTELEMETRY_END_NAMESPACE
87-
#endif
87+
#endif

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ struct OtlpGrpcMetricExporterOptions : public OtlpGrpcExporterOptions
2727

2828
} // namespace otlp
2929
} // namespace exporter
30-
OPENTELEMETRY_END_NAMESPACE
30+
OPENTELEMETRY_END_NAMESPACE

exporters/otlp/include/opentelemetry/exporters/otlp/protobuf_include_suffix.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313

1414
#if defined(_MSC_VER)
1515
# pragma warning(pop)
16-
#endif
16+
#endif

exporters/otlp/src/otlp_populate_attribute_utils.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void OtlpPopulateAttributeUtils::PopulateAttribute(
176176
}
177177
else if (nostd::holds_alternative<std::vector<bool>>(value))
178178
{
179-
for (const auto &val : nostd::get<std::vector<bool>>(value))
179+
for (const auto val : nostd::get<std::vector<bool>>(value))
180180
{
181181
attribute->mutable_value()->mutable_array_value()->add_values()->set_bool_value(val);
182182
}
@@ -242,4 +242,4 @@ void OtlpPopulateAttributeUtils::PopulateAttribute(
242242

243243
} // namespace otlp
244244
} // namespace exporter
245-
OPENTELEMETRY_END_NAMESPACE
245+
OPENTELEMETRY_END_NAMESPACE

exporters/otlp/src/otlp_recordable.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ proto::common::v1::InstrumentationScope OtlpRecordable::GetProtoInstrumentationS
7777
void OtlpRecordable::SetResource(const sdk::resource::Resource &resource) noexcept
7878
{
7979
resource_ = &resource;
80-
};
80+
}
8181

8282
void OtlpRecordable::SetAttribute(nostd::string_view key,
8383
const common::AttributeValue &value) noexcept

exporters/prometheus/src/exporter.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ PrometheusExporter::PrometheusExporter() : is_shutdown_(false)
3434
}
3535

3636
sdk::metrics::AggregationTemporality PrometheusExporter::GetAggregationTemporality(
37-
sdk::metrics::InstrumentType instrument_type) const noexcept
37+
sdk::metrics::InstrumentType /* instrument_type */) const noexcept
3838
{
3939
// Prometheus exporter only support Cumulative
4040
return sdk::metrics::AggregationTemporality::kCumulative;
@@ -69,7 +69,7 @@ sdk::common::ExportResult PrometheusExporter::Export(
6969
return sdk::common::ExportResult::kSuccess;
7070
}
7171

72-
bool PrometheusExporter::ForceFlush(std::chrono::microseconds timeout) noexcept
72+
bool PrometheusExporter::ForceFlush(std::chrono::microseconds /* timeout */) noexcept
7373
{
7474
return true;
7575
}
@@ -81,7 +81,7 @@ bool PrometheusExporter::ForceFlush(std::chrono::microseconds timeout) noexcept
8181
* collection to to client an HTTP request being sent,
8282
* so we flush the data.
8383
*/
84-
bool PrometheusExporter::Shutdown(std::chrono::microseconds timeout) noexcept
84+
bool PrometheusExporter::Shutdown(std::chrono::microseconds /* timeout */) noexcept
8585
{
8686
is_shutdown_ = true;
8787
return true;

exporters/prometheus/src/exporter_utils.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void PrometheusExporterUtils::SetMetricBasic(prometheus_client::ClientMetric &me
230230
metric.label[i++].value = AttributeValueToString(label.second);
231231
}
232232
}
233-
};
233+
}
234234

235235
std::string PrometheusExporterUtils::AttributeValueToString(
236236
const opentelemetry::sdk::common::OwnedAttributeValue &value)

exporters/zipkin/src/recordable.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ void Recordable::AddEvent(nostd::string_view name,
188188
span_["annotations"].push_back(annotation);
189189
}
190190

191-
void Recordable::AddLink(const trace_api::SpanContext &span_context,
192-
const common::KeyValueIterable &attributes) noexcept
191+
void Recordable::AddLink(const trace_api::SpanContext & /* span_context */,
192+
const common::KeyValueIterable & /* attributes */) noexcept
193193
{
194194
// TODO: Currently not supported by specs:
195195
// https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk_exporters/zipkin.md

exporters/zipkin/src/zipkin_exporter.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void ZipkinExporter::InitializeLocalEndpoint()
110110
local_end_point_["port"] = url_parser_.port_;
111111
}
112112

113-
bool ZipkinExporter::Shutdown(std::chrono::microseconds timeout) noexcept
113+
bool ZipkinExporter::Shutdown(std::chrono::microseconds /* timeout */) noexcept
114114
{
115115
const std::lock_guard<opentelemetry::common::SpinLockMutex> locked(lock_);
116116
is_shutdown_ = true;

ext/include/opentelemetry/ext/http/client/curl/http_client_curl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class HttpClientSync : public opentelemetry::ext::http::client::HttpClientSync
263263
return opentelemetry::ext::http::client::Result(std::move(response), session_state);
264264
}
265265

266-
~HttpClientSync() {}
266+
~HttpClientSync() override {}
267267

268268
private:
269269
nostd::shared_ptr<HttpCurlGlobalInitializer> curl_global_initializer_;
@@ -274,7 +274,7 @@ class HttpClient : public opentelemetry::ext::http::client::HttpClient
274274
public:
275275
// The call (curl_global_init) is not thread safe. Ensure this is called only once.
276276
HttpClient();
277-
~HttpClient();
277+
~HttpClient() override;
278278

279279
std::shared_ptr<opentelemetry::ext::http::client::Session> CreateSession(
280280
nostd::string_view url) noexcept override;

ext/include/opentelemetry/ext/http/client/nosend/http_client_nosend.h

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# include <gtest/gtest.h>
1616
# include "gmock/gmock.h"
1717

18-
using namespace testing;
1918
OPENTELEMETRY_BEGIN_NAMESPACE
2019
namespace ext
2120
{

ext/include/opentelemetry/ext/http/server/http_server.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class HttpRequestCallback
5454

5555
public:
5656
HttpRequestCallback() {}
57+
virtual ~HttpRequestCallback() = default;
5758

5859
HttpRequestCallback &operator=(HttpRequestCallback other)
5960
{
@@ -175,7 +176,7 @@ class HttpServer : private SocketTools::Reactor::SocketCallback
175176
addListeningPort(port);
176177
}
177178

178-
~HttpServer()
179+
~HttpServer() override
179180
{
180181
for (auto &sock : m_listeningSockets)
181182
{

0 commit comments

Comments
 (0)