Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 28 additions & 0 deletions deps/opentelemetry-cpp/.devcontainer/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

FROM otel/cpp_format_tools

ARG GRPC_VERSION=v1.55.0
ARG PROTOBUF_VERSION=23.4
ARG ABSEIL_CPP_VERSION=20240116.1

ENV PROTOBUF_VERSION=${PROTOBUF_VERSION}
ENV ABSEIL_CPP_VERSION=${ABSEIL_CPP_VERSION}

COPY ci /opt/ci

RUN apt update && apt install -y wget \
ninja-build \
libcurl4-openssl-dev \
markdownlint

RUN cd /opt/ci && bash setup_cmake.sh
RUN cd /opt/ci && bash setup_ci_environment.sh
RUN cd /opt && bash ci/setup_googletest.sh \
&& bash ci/setup_grpc.sh -r ${GRPC_VERSION}

ADD https://github.com/bazelbuild/bazelisk/releases/download/v1.22.1/bazelisk-linux-amd64 /usr/local/bin

RUN git config --global core.autocrlf input \
&& chmod +x /usr/local/bin/bazelisk-linux-amd64
26 changes: 26 additions & 0 deletions deps/opentelemetry-cpp/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.162.0/containers/javascript-node
{
"name": "opentelemetry-cpp",
"build": {
"context": "..",
"dockerfile": "Dockerfile.dev",
"args": {
"GRPC_VERSION": "v1.55.0",
"PROTOBUF_VERSION": "23.4",
"ABSEIL_CPP_VERSION":"20240116.1"
}
},
"settings": {
"terminal.integrated.shell.linux": "/bin/sh"
},
"extensions": [
"ms-vscode.cpptools",
"ms-azuretools.vscode-docker",
"ms-vscode.cpptools-extension-pack"
],

"remoteUser": "root"
}
6 changes: 6 additions & 0 deletions deps/opentelemetry-cpp/.iwyu.imp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
[
# Work around for C++ STL
{ "include": ["<bits/chrono.h>", "private", "<chrono>", "public"] },
{ "include": ["<bits/std_abs.h>", "private", "<cstdlib>", "public"] },
{ "include": ["<ext/alloc_traits.h>", "private", "<memory>", "public"] },
{ "include": ["<bits/types/struct_tm.h>", "private", "<time.h>", "public"] },
{ "include": ["<bits/types/struct_FILE.h>", "private", "<stdio.h>", "public"] },

# Local opentelemetry-cpp style

Expand All @@ -14,6 +18,8 @@
{ "include": ["<gtest/gtest-test-part.h>", "private", "<gtest/gtest.h>", "public"] },
{ "include": ["<gtest/gtest-param-test.h>", "private", "<gtest/gtest.h>", "public"] },
{ "include": ["<gtest/gtest_pred_impl.h>", "private", "<gtest/gtest.h>", "public"] },
{ "include": ["<gtest/gtest-typed-test.h>", "private", "<gtest/gtest.h>", "public"] },
{ "include": ["<gtest/gtest-assertion-result.h>", "private", "<gtest/gtest.h>", "public"] },

# We prefer to include <gmock/gmock.h> for simplicity
{ "include": ["<gmock/gmock-function-mocker.h>", "private", "<gmock/gmock.h>", "public"] },
Expand Down
25 changes: 25 additions & 0 deletions deps/opentelemetry-cpp/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

module(
name = "opentelemetry-cpp",
version = "1.17.0",
compatibility_level = 0,
repo_name = "io_opentelemetry_cpp",
)

bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "com_google_absl")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "curl", version = "8.8.0")
bazel_dep(name = "grpc", version = "1.63.1.bcr.1", repo_name = "com_github_grpc_grpc")
bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "github_nlohmann_json")
bazel_dep(name = "opentelemetry-proto", version = "1.5.0", repo_name = "com_github_opentelemetry_proto")
bazel_dep(name = "opentracing-cpp", version = "1.6.0", repo_name = "com_github_opentracing")
bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "prometheus-cpp", version = "1.3.0", repo_name = "com_github_jupp0r_prometheus_cpp")
bazel_dep(name = "protobuf", version = "26.0", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "zlib", version = "1.3.1.bcr.1")

bazel_dep(name = "google_benchmark", version = "1.8.3", dev_dependency = True, repo_name = "com_github_google_benchmark")
bazel_dep(name = "googletest", version = "1.14.0.bcr.1", dev_dependency = True, repo_name = "com_google_googletest")
10 changes: 10 additions & 0 deletions deps/opentelemetry-cpp/api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ target_compile_definitions(
opentelemetry_api
INTERFACE OPENTELEMETRY_ABI_VERSION_NO=${OPENTELEMETRY_ABI_VERSION_NO})

if(WITH_OTLP_RETRY_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_OTLP_RETRY_PREVIEW)
endif()

if(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW)
Expand All @@ -126,6 +131,11 @@ if(WITH_METRICS_EXEMPLAR_PREVIEW)
INTERFACE ENABLE_METRICS_EXEMPLAR_PREVIEW)
endif()

if(WITH_THREAD_INSTRUMENTATION_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_THREAD_INSTRUMENTATION_PREVIEW)
endif()

if(WITH_OTLP_HTTP_COMPRESSION)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_OTLP_COMPRESSION_PREVIEW)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ inline nostd::shared_ptr<Baggage> GetBaggage(const context::Context &context) no
}

inline context::Context SetBaggage(context::Context &context,
nostd::shared_ptr<Baggage> baggage) noexcept
const nostd::shared_ptr<Baggage> &baggage) noexcept
{
return context.SetValue(kBaggageHeader, baggage);
}
Expand Down
36 changes: 21 additions & 15 deletions deps/opentelemetry-cpp/api/include/opentelemetry/context/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ class Context
// hold a shared_ptr to the head of the DataList linked list
template <class T>
Context(const T &keys_and_values) noexcept
{
head_ = nostd::shared_ptr<DataList>{new DataList(keys_and_values)};
}
: head_{nostd::shared_ptr<DataList>{new DataList(keys_and_values)}}
{}

// Creates a context object from a key and value, this will
// hold a shared_ptr to the head of the DataList linked list
Context(nostd::string_view key, ContextValue value) noexcept
{
head_ = nostd::shared_ptr<DataList>{new DataList(key, value)};
}
: head_{nostd::shared_ptr<DataList>{new DataList(key, value)}}
{}

// Accepts a new iterable and then returns a new context that
// contains the new key and value data. It attaches the
Expand Down Expand Up @@ -92,22 +90,21 @@ class Context

private:
// A linked list to contain the keys and values of this context node
class DataList
struct DataList
{
public:
char *key_;
char *key_ = nullptr;

nostd::shared_ptr<DataList> next_;
nostd::shared_ptr<DataList> next_{nullptr};

size_t key_length_;
size_t key_length_ = 0UL;

ContextValue value_;

DataList() { next_ = nullptr; }
DataList() = default;

// Builds a data list off of a key and value iterable and returns the head
template <class T>
DataList(const T &keys_and_vals) : key_{nullptr}, next_(nostd::shared_ptr<DataList>{nullptr})
DataList(const T &keys_and_vals)
{
bool first = true;
auto *node = this;
Expand All @@ -132,9 +129,18 @@ class Context
{
key_ = new char[key.size()];
key_length_ = key.size();
memcpy(key_, key.data(), key.size() * sizeof(char));
value_ = value;
std::memcpy(key_, key.data(), key.size() * sizeof(char));
next_ = nostd::shared_ptr<DataList>{nullptr};
value_ = value;
}

DataList(const DataList &other)
: key_(new char[other.key_length_]),
next_(other.next_),
key_length_(other.key_length_),
value_(other.value_)
{
std::memcpy(key_, other.key_, other.key_length_ * sizeof(char));
}

DataList &operator=(DataList &&other) noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class OPENTELEMETRY_EXPORT GlobalTextMapPropagator
return nostd::shared_ptr<TextMapPropagator>(GetPropagator());
}

static void SetGlobalPropagator(nostd::shared_ptr<TextMapPropagator> prop) noexcept
static void SetGlobalPropagator(const nostd::shared_ptr<TextMapPropagator> &prop) noexcept
{
std::lock_guard<common::SpinLockMutex> guard(GetLock());
GetPropagator() = prop;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ class OPENTELEMETRY_EXPORT RuntimeContext
*
* @param storage a custom runtime context storage
*/
static void SetRuntimeContextStorage(nostd::shared_ptr<RuntimeContextStorage> storage) noexcept
static void SetRuntimeContextStorage(
const nostd::shared_ptr<RuntimeContextStorage> &storage) noexcept
{
GetStorage() = storage;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,15 @@

#define OPENTELEMETRY_CONCAT(A, B) OPENTELEMETRY_CONCAT_(A, B)
#define OPENTELEMETRY_CONCAT_(A, B) A##B

// Import the C++20 feature-test macros
#ifdef __has_include
# if __has_include(<version>)
# include <version>
# endif
#elif defined(_MSC_VER) && ((defined(__cplusplus) && __cplusplus >= 202002L) || \
(defined(_MSVC_LANG) && _MSVC_LANG >= 202002L))
# if _MSC_VER >= 1922
# include <version>
# endif
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ namespace logs
class EventId
{
public:
EventId(int64_t id, nostd::string_view name) noexcept : id_{id}
EventId(int64_t id, nostd::string_view name) noexcept
: id_{id}, name_{nostd::unique_ptr<char[]>{new char[name.length() + 1]}}
{
name_ = nostd::unique_ptr<char[]>{new char[name.length() + 1]};
std::copy(name.begin(), name.end(), name_.get());
name_.get()[name.length()] = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class OPENTELEMETRY_EXPORT Provider
/**
* Changes the singleton LoggerProvider.
*/
static void SetLoggerProvider(nostd::shared_ptr<LoggerProvider> tp) noexcept
static void SetLoggerProvider(const nostd::shared_ptr<LoggerProvider> &tp) noexcept
{
std::lock_guard<common::SpinLockMutex> guard(GetLock());
GetProvider() = tp;
Expand All @@ -60,7 +60,7 @@ class OPENTELEMETRY_EXPORT Provider
/**
* Changes the singleton EventLoggerProvider.
*/
static void SetEventLoggerProvider(nostd::shared_ptr<EventLoggerProvider> tp) noexcept
static void SetEventLoggerProvider(const nostd::shared_ptr<EventLoggerProvider> &tp) noexcept
{
std::lock_guard<common::SpinLockMutex> guard(GetLock());
GetEventProvider() = tp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#pragma once

#include <cstdint>

#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/version.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Provider
/**
* Changes the singleton MeterProvider.
*/
static void SetMeterProvider(nostd::shared_ptr<MeterProvider> tp) noexcept
static void SetMeterProvider(const nostd::shared_ptr<MeterProvider> &tp) noexcept
{
std::lock_guard<common::SpinLockMutex> guard(GetLock());
GetProvider() = tp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ template <class ReturnType, class FunctionObject, std::size_t... BoundIndices>
struct MakeVisitationMatrix<ReturnType, FunctionObject, index_sequence<>,
index_sequence<BoundIndices...>> {
using ResultType = ReturnType (*)(FunctionObject&&);
// cppcheck-suppress [duplInheritedMember]
static constexpr ResultType Run() {
return &call_with_indices<ReturnType, FunctionObject,
(BoundIndices - 1)...>;
Expand Down Expand Up @@ -722,6 +723,7 @@ struct VariantCoreAccess {
Self* self, Args&&... args) {
Destroy(*self);
using New = typename absl::OTABSL_OPTION_NAMESPACE_NAME::variant_alternative<NewIndex, Self>::type;
// cppcheck-suppress [legacyUninitvar]
New* const result = ::new (static_cast<void*>(&self->state_))
New(absl::OTABSL_OPTION_NAMESPACE_NAME::forward<Args>(args)...);
self->index_ = NewIndex;
Expand Down Expand Up @@ -1310,6 +1312,7 @@ class VariantStateBaseDestructorNontrivial : protected VariantStateBase<T...> {
VariantStateBaseDestructorNontrivial* self;
};

// cppcheck-suppress [duplInheritedMember]
void destroy() { VisitIndices<sizeof...(T)>::Run(Destroyer{this}, index_); }

~VariantStateBaseDestructorNontrivial() { destroy(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class shared_ptr

struct alignas(kAlignment) PlacementBuffer
{
char data[kMaxSize];
char data[kMaxSize]{};
};

class shared_ptr_wrapper
Expand Down
13 changes: 13 additions & 0 deletions deps/opentelemetry-cpp/api/include/opentelemetry/nostd/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ OPENTELEMETRY_END_NAMESPACE
# ifdef HAVE_ABSEIL
# include "absl/types/variant.h"
# else
# include "opentelemetry/nostd/internal/absl/base/options.h"

namespace absl
{
namespace OTABSL_OPTION_NAMESPACE_NAME
{
template <class T>
struct variant_size;
template <typename... Ts>
class variant;
} // namespace OTABSL_OPTION_NAMESPACE_NAME
} // namespace absl

# include "opentelemetry/nostd/internal/absl/types/variant.h"
# endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DynamicLibraryHandle;
class Span final : public trace::Span
{
public:
Span(std::shared_ptr<trace::Tracer> &&tracer, nostd::shared_ptr<trace::Span> span) noexcept
Span(std::shared_ptr<trace::Tracer> &&tracer, const nostd::shared_ptr<trace::Span> &span) noexcept
: tracer_{std::move(tracer)}, span_{span}
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ namespace error
* <p>
* If the operation has completed successfully, instrumentations SHOULD NOT set @code error.type
* @endcode. <p> If a specific domain defines its own set of error identifiers (such as HTTP or gRPC
* status codes), it's RECOMMENDED to: <p> <ul> <li>Use a domain-specific attribute</li> <li>Set
* @code error.type @endcode to capture all errors, regardless of whether they are defined within
* the domain-specific set or not.</li>
* status codes), it's RECOMMENDED to: <ul> <li>Use a domain-specific attribute</li> <li>Set @code
* error.type @endcode to capture all errors, regardless of whether they are defined within the
* domain-specific set or not.</li>
* </ul>
*/
static constexpr const char *kErrorType = "error.type";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ namespace http
* <p>
* histogram
*/
static constexpr const char *kMetricHttpClientRequestDuration =
"metric.http.client.request.duration";
static constexpr const char *kMetricHttpClientRequestDuration = "http.client.request.duration";
static constexpr const char *descrMetricHttpClientRequestDuration =
"Duration of HTTP client requests.";
static constexpr const char *unitMetricHttpClientRequestDuration = "s";
Expand All @@ -52,8 +51,7 @@ CreateSyncDoubleMetricHttpClientRequestDuration(metrics::Meter *meter)
* <p>
* histogram
*/
static constexpr const char *kMetricHttpServerRequestDuration =
"metric.http.server.request.duration";
static constexpr const char *kMetricHttpServerRequestDuration = "http.server.request.duration";
static constexpr const char *descrMetricHttpServerRequestDuration =
"Duration of HTTP server requests.";
static constexpr const char *unitMetricHttpServerRequestDuration = "s";
Expand Down
Loading
Loading