Skip to content

Commit

Permalink
merged from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
malkia committed Jun 16, 2024
2 parents 49b559b + 9af3c99 commit 5d79394
Show file tree
Hide file tree
Showing 106 changed files with 896 additions and 400 deletions.
1 change: 1 addition & 0 deletions .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
CC="clang" CXX="clang++" cmake \
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-w;-Xiwyu;--mapping_file=${TOPDIR}/.iwyu.imp;" \
-DBUILD_TESTING=OFF \
-DWITH_DEPRECATED_SDK_FACTORY=OFF \
-DBUILD_W3CTRACECONTEXT_TEST=OFF \
..
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Increment the:
* [API/SDK] Provider cleanup
[#2664](https://github.com/open-telemetry/opentelemetry-cpp/pull/2664)

* [Code health] include-what-you-use cleanup
[#2692](https://github.com/open-telemetry/opentelemetry-cpp/pull/2692)

Important changes:

* [API/SDK] Provider cleanup
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ if(WITH_PROMETHEUS)
endif()

if(WITH_ABSEIL)
find_package(absl CONFIG REQUIRED)
if(NOT TARGET absl::strings)
find_package(absl CONFIG REQUIRED)
endif()
endif()

if(WITH_OTLP_GRPC
Expand Down
2 changes: 2 additions & 0 deletions all_api_includes.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <opentelemetry/baggage/propagation/baggage_propagator.h>
#include <opentelemetry/context/propagation/global_propagator.h>
#include <opentelemetry/logs/provider.h>
#include <opentelemetry/trace/provider.h>

8 changes: 7 additions & 1 deletion api/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")

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

Expand Down Expand Up @@ -73,3 +73,9 @@ config_setting(
constraint_values = ["@bazel_tools//tools/cpp:msvc"],
flag_values = {":with_cxx_stdlib": "best"},
)

bool_flag(
name = "with_abseil",
build_setting_default = False,
deprecation = "The value of this flag is ignored. Bazel builds always depend on Abseil for its pre-adopted `std::` types. You should remove this flag from your build command.",
)
2 changes: 1 addition & 1 deletion api/include/opentelemetry/nostd/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# include <type_traits>

# include "opentelemetry/config.h"
# include "opentelemetry/nostd/detail/void.h"
# include "opentelemetry/nostd/detail/void.h" // IWYU pragma: export
# include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down
4 changes: 2 additions & 2 deletions api/include/opentelemetry/nostd/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# include <initializer_list>
# include <type_traits>

# include "opentelemetry/nostd/detail/decay.h"
# include "opentelemetry/nostd/detail/invoke.h"
# include "opentelemetry/nostd/detail/decay.h" // IWYU pragma: export
# include "opentelemetry/nostd/detail/invoke.h" // IWYU pragma: export
# include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down
3 changes: 1 addition & 2 deletions api/include/opentelemetry/plugin/detail/dynamic_load_unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

#pragma once

#include <dlfcn.h>
#include <algorithm>
#include <memory>

#include <dlfcn.h>

#include "opentelemetry/plugin/detail/dynamic_library_handle.h"
#include "opentelemetry/plugin/detail/loader_info.h"
#include "opentelemetry/plugin/detail/utility.h"
Expand Down
4 changes: 2 additions & 2 deletions api/include/opentelemetry/plugin/dynamic_load.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include <string>

#ifdef _WIN32
# include "opentelemetry/plugin/detail/dynamic_load_windows.h"
# include "opentelemetry/plugin/detail/dynamic_load_windows.h" // IWYU pragma: export
#else
# include "opentelemetry/plugin/detail/dynamic_load_unix.h"
# include "opentelemetry/plugin/detail/dynamic_load_unix.h" // IWYU pragma: export
#endif
#include "opentelemetry/version.h"

Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/plugin/factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <memory>
#include <string>

#include "opentelemetry/plugin/detail/utility.h"
#include "opentelemetry/plugin/detail/utility.h" // IWYU pragma: export
#include "opentelemetry/plugin/tracer.h"
#include "opentelemetry/version.h"

Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/plugin/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <memory>

#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/plugin/detail/tracer_handle.h"
#include "opentelemetry/plugin/detail/tracer_handle.h" // IWYU pragma: export
#include "opentelemetry/trace/span_context_kv_iterable.h"
#include "opentelemetry/trace/tracer.h"
#include "opentelemetry/version.h"
Expand Down
20 changes: 16 additions & 4 deletions examples/batch/main.cc
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <stdint.h>
#include <stdio.h>
#include <chrono>
#include <iostream>
#include <memory>
#include <string>
#include <thread>
#include <utility>

#include "opentelemetry/exporters/ostream/span_exporter_factory.h"
#include "opentelemetry/nostd/detail/decay.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/sdk/trace/batch_span_processor_factory.h"
#include "opentelemetry/sdk/trace/batch_span_processor_options.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/recordable.h"
#include "opentelemetry/sdk/trace/tracer_provider.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"

#include <chrono>
#include <thread>
#include "opentelemetry/trace/span_id.h"
#include "opentelemetry/trace/tracer.h"
#include "opentelemetry/trace/tracer_provider.h"

constexpr int kNumSpans = 10;
namespace trace_api = opentelemetry::trace;
Expand Down
6 changes: 6 additions & 0 deletions examples/common/foo_library/foo_library.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/sdk/version/version.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"
#include "opentelemetry/trace/tracer.h"
#include "opentelemetry/trace/tracer_provider.h"

namespace trace = opentelemetry::trace;
namespace nostd = opentelemetry::nostd;
Expand Down
11 changes: 9 additions & 2 deletions examples/common/logs_foo_library/foo_library.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <map>
#include <string>
#include "opentelemetry/logs/log_record.h"
#include "opentelemetry/logs/logger.h"
#include "opentelemetry/logs/logger_provider.h"
#include "opentelemetry/logs/provider.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/sdk/version/version.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"
#include "opentelemetry/trace/span.h"
#include "opentelemetry/trace/span_context.h"
#include "opentelemetry/trace/tracer.h"
#include "opentelemetry/trace/tracer_provider.h"

namespace logs = opentelemetry::logs;
namespace trace = opentelemetry::trace;
Expand Down
14 changes: 12 additions & 2 deletions examples/common/metrics_foo_library/foo_library.cc
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "foo_library.h"
#include <stdint.h>
#include <stdlib.h>
#include <chrono>
#include <map>
#include <memory>
#include <thread>
#include <utility>
#include <vector>

#include "foo_library.h"
#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/context/context.h"
#include "opentelemetry/metrics/async_instruments.h"
#include "opentelemetry/metrics/meter.h"
#include "opentelemetry/metrics/meter_provider.h"
#include "opentelemetry/metrics/observer_result.h"
#include "opentelemetry/metrics/provider.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/nostd/variant.h"

namespace nostd = opentelemetry::nostd;
namespace metrics_api = opentelemetry::metrics;
Expand Down
11 changes: 9 additions & 2 deletions examples/logs_simple/main.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <memory>
#include <utility>

#include "opentelemetry/exporters/ostream/log_record_exporter.h"
#include "opentelemetry/exporters/ostream/span_exporter_factory.h"
#include "opentelemetry/logs/log_record.h"
#include "opentelemetry/logs/logger_provider.h"
#include "opentelemetry/logs/provider.h"
#include "opentelemetry/sdk/logs/exporter.h"
#include "opentelemetry/sdk/logs/logger_provider.h"
#include "opentelemetry/sdk/logs/logger_provider_factory.h"
#include "opentelemetry/sdk/logs/processor.h"
#include "opentelemetry/sdk/logs/recordable.h"
#include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/recordable.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/tracer_provider.h"

#include "logs_foo_library/foo_library.h"

Expand Down
17 changes: 14 additions & 3 deletions examples/metrics_simple/metrics_ostream.cc
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <chrono>
#include <memory>
#include <string>
#include <thread>
#include <utility>
#include <vector>

#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/exporters/ostream/metric_exporter_factory.h"
#include "opentelemetry/metrics/meter_provider.h"
#include "opentelemetry/metrics/provider.h"
#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h"
#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h"
#include "opentelemetry/sdk/metrics/aggregation/aggregation_config.h"
#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader_factory.h"
#include "opentelemetry/sdk/metrics/meter.h"
#include "opentelemetry/sdk/metrics/export/periodic_exporting_metric_reader_options.h"
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/sdk/metrics/meter_provider.h"
#include "opentelemetry/sdk/metrics/meter_provider_factory.h"
#include "opentelemetry/sdk/metrics/metric_reader.h"
#include "opentelemetry/sdk/metrics/push_metric_exporter.h"
#include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h"
#include "opentelemetry/sdk/metrics/view/instrument_selector.h"
#include "opentelemetry/sdk/metrics/view/instrument_selector_factory.h"
#include "opentelemetry/sdk/metrics/view/meter_selector.h"
#include "opentelemetry/sdk/metrics/view/meter_selector_factory.h"
#include "opentelemetry/sdk/metrics/view/view.h"
#include "opentelemetry/sdk/metrics/view/view_factory.h"

#include "metrics_foo_library/foo_library.h"
Expand Down
18 changes: 17 additions & 1 deletion examples/multi_processor/main.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <algorithm>
#include <iostream>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

#include "opentelemetry/exporters/memory/in_memory_span_data.h"
#include "opentelemetry/exporters/memory/in_memory_span_exporter_factory.h"
#include "opentelemetry/exporters/ostream/span_exporter_factory.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/recordable.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_context.h"
#include "opentelemetry/sdk/trace/span_data.h"
#include "opentelemetry/sdk/trace/tracer_provider.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/span_id.h"
#include "opentelemetry/trace/span_metadata.h"
#include "opentelemetry/trace/trace_id.h"
#include "opentelemetry/trace/tracer_provider.h"

#include "foo_library/foo_library.h"

Expand Down
18 changes: 14 additions & 4 deletions examples/multithreaded/main.cc
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <algorithm>
#include <memory>
#include <string>
#include <thread>
#include <utility>
#include <vector>

#include "opentelemetry/exporters/ostream/span_exporter_factory.h"
#include "opentelemetry/nostd/detail/decay.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/recordable.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"

#include <algorithm>
#include <thread>
#include "opentelemetry/trace/span_id.h"
#include "opentelemetry/trace/tracer.h"
#include "opentelemetry/trace/tracer_provider.h"

namespace trace_api = opentelemetry::trace;
namespace trace_sdk = opentelemetry::sdk::trace;
Expand Down
8 changes: 5 additions & 3 deletions examples/plugin/load/main.cc
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/plugin/dynamic_load.h"

#include <cstring>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <iterator>
#include <memory>
#include <string>

#include "opentelemetry/plugin/dynamic_load.h"
#include "opentelemetry/plugin/factory.h"
#include "opentelemetry/trace/tracer.h"

int main(int argc, char *argv[])
{
if (argc != 3)
Expand Down
7 changes: 7 additions & 0 deletions examples/plugin/plugin/factory_impl.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <memory>
#include <new>
#include <utility>

#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/plugin/factory.h"
#include "opentelemetry/plugin/hook.h"
#include "opentelemetry/plugin/tracer.h"
#include "tracer.h"
#include "opentelemetry/plugin/dynamic_load.h"

Expand Down
Loading

0 comments on commit 5d79394

Please sign in to comment.