Skip to content

Commit

Permalink
[Code Health] include-what-you-use cleanup, part 4 (#3040)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Sep 11, 2024
1 parent c37df23 commit c6d3945
Show file tree
Hide file tree
Showing 89 changed files with 912 additions and 305 deletions.
8 changes: 7 additions & 1 deletion .iwyu.imp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
# Work around for C++ STL
{ "include": ["<bits/chrono.h>", "private", "<chrono>", "public"] },

# Local opentelemetry-cpp
# Local opentelemetry-cpp style

# We prefer to include <gtest/gtest.h> for simplicity
{ "include": ["<gtest/gtest-message.h>", "private", "<gtest/gtest.h>", "public"] },
{ "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"] },

# We prefer to include <gmock/gmock.h> for simplicity
{ "include": ["<gmock/gmock-function-mocker.h>", "private", "<gmock/gmock.h>", "public"] },
{ "include": ["<gmock/gmock-spec-builders.h>", "private", "<gmock/gmock.h>", "public"] },
]

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

#pragma once

#include <stddef.h>
#include <memory>
#include <vector>

#include "opentelemetry/exporters/memory/in_memory_data.h"
#include "opentelemetry/sdk/trace/recordable.h"
#include "opentelemetry/sdk/trace/span_data.h"

#include <vector>
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@

#pragma once

#include <stddef.h>
#include <atomic>
#include <mutex>
#include <chrono>
#include <memory>
#include <ostream>
#include <utility>

#include "opentelemetry/exporters/memory/in_memory_span_data.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/sdk/common/exporter_utils.h"
#include "opentelemetry/sdk/common/global_log_handler.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/recordable.h"
#include "opentelemetry/sdk/trace/span_data.h"
#include "opentelemetry/sdk_config.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down
1 change: 1 addition & 0 deletions exporters/zipkin/src/zipkin_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <memory>
#include <ostream>
#include <string>
#include <utility>

#include "nlohmann/json.hpp"

Expand Down
5 changes: 3 additions & 2 deletions ext/include/opentelemetry/ext/http/common/url_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

#pragma once

#include <stdlib.h>
#include <cstdint>
#include <string>
#include <vector>
#include "opentelemetry/nostd/string_view.h"

#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace ext
{
Expand Down
21 changes: 13 additions & 8 deletions ext/test/http/curl_http_test.cc
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/ext//http/client/curl/http_client_curl.h"
#include "opentelemetry/ext/http/client/http_client_factory.h"
#include "opentelemetry/ext/http/server/http_server.h"

#include <assert.h>
#include <gtest/gtest.h>
#include <string.h>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <fstream>
#include <map>
#include <memory>
#include <thread>
#include <mutex>
#include <string>
#include <utility>
#include <vector>

#define HTTP_PORT 19000
#include "opentelemetry/ext//http/client/curl/http_client_curl.h"
#include "opentelemetry/ext/http/client/curl/http_operation_curl.h"
#include "opentelemetry/ext/http/client/http_client.h"
#include "opentelemetry/ext/http/client/http_client_factory.h"
#include "opentelemetry/ext/http/server/http_server.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/string_view.h"

#include <gtest/gtest.h>
#define HTTP_PORT 19000

namespace curl = opentelemetry::ext::http::client::curl;
namespace http_client = opentelemetry::ext::http::client;
Expand Down
7 changes: 5 additions & 2 deletions ext/test/http/url_parser_test.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/ext/http/common/url_parser.h"

#include <gtest/gtest.h>
#include <map>
#include <string>
#include <utility>

#include "opentelemetry/ext/http/common/url_parser.h"

namespace http_common = opentelemetry::ext::http::common;

Expand Down
25 changes: 22 additions & 3 deletions ext/test/w3c_tracecontext_test/main.cc
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <stdint.h>
#include <stdlib.h>
#include <algorithm>
#include <initializer_list>
#include <iostream>
#include <map>
#include <nlohmann/json.hpp>
#include <string>
#include <utility>
#include <vector>

#include "opentelemetry/context/context_value.h"
#include "opentelemetry/context/propagation/text_map_propagator.h"
#include "opentelemetry/context/runtime_context.h"
#include "opentelemetry/exporters/ostream/span_exporter.h"
#include "opentelemetry/ext/http/client/curl/http_client_curl.h"
#include "opentelemetry/ext/http/client/curl/http_operation_curl.h"
#include "opentelemetry/ext/http/client/http_client.h"
#include "opentelemetry/ext/http/server/http_server.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.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.h"
#include "opentelemetry/sdk/trace/tracer_context.h"
#include "opentelemetry/sdk/trace/tracer_provider.h"
#include "opentelemetry/trace/propagation/http_trace_context.h"
#include "opentelemetry/trace/provider.h"
#include "opentelemetry/trace/scope.h"

#include <algorithm>
#include "nlohmann/json.hpp"
#include "opentelemetry/trace/tracer.h"
#include "opentelemetry/trace/tracer_provider.h"

namespace trace_api = opentelemetry::trace;
namespace http_client = opentelemetry::ext::http::client;
Expand Down
8 changes: 7 additions & 1 deletion sdk/include/opentelemetry/sdk/common/attribute_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@

#pragma once

#include <cstdint>
#include <initializer_list>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/variant.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down
7 changes: 7 additions & 0 deletions sdk/include/opentelemetry/sdk/common/attributemap_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@

#pragma once

#include <stddef.h>
#include <functional>
#include <map>
#include <string>
#include <utility>
#include <vector>

#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/variant.h"
Expand Down
3 changes: 3 additions & 0 deletions sdk/include/opentelemetry/sdk/common/circular_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

#include <atomic>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>

#include "opentelemetry/nostd/span.h"
#include "opentelemetry/sdk/common/atomic_unique_ptr.h"
#include "opentelemetry/sdk/common/circular_buffer_range.h"
#include "opentelemetry/version.h"
Expand Down
3 changes: 2 additions & 1 deletion sdk/include/opentelemetry/sdk/common/circular_buffer_range.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

#pragma once

#include <stddef.h>
#include <cassert>
#include <utility>
#include <type_traits>

#include "opentelemetry/nostd/span.h"
#include "opentelemetry/version.h"
Expand Down
2 changes: 2 additions & 0 deletions sdk/include/opentelemetry/sdk/metrics/observer_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

#include <unordered_map>

#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/metrics/observer_result.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h"
#include "opentelemetry/sdk/metrics/view/attributes_processor.h"
#include "opentelemetry/version.h"
Expand Down
13 changes: 8 additions & 5 deletions sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@

#pragma once

#include <stddef.h>
#include <functional>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>

#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/sdk/common/attribute_utils.h"
#include "opentelemetry/sdk/common/attributemap_hash.h"
#include "opentelemetry/sdk/metrics/aggregation/aggregation.h"
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/sdk/metrics/view/attributes_processor.h"
#include "opentelemetry/version.h"

#include <functional>
#include <memory>
#include <unordered_map>

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
Expand Down
16 changes: 5 additions & 11 deletions sdk/include/opentelemetry/sdk/metrics/state/multi_metric_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,20 @@

#pragma once

#include <stdint.h>
#include <memory>
#include <unordered_map>
#include <vector>

#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/common/timestamp.h"
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/context/context.h"
#include "opentelemetry/sdk/metrics/state/attributes_hashmap.h"
#include "opentelemetry/sdk/metrics/state/metric_storage.h"
#include "opentelemetry/sdk/metrics/view/attributes_processor.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace common
{
class KeyValueIterable;
} // namespace common

namespace context
{
class Context;
} // namespace context

namespace sdk
{
namespace metrics
Expand Down
1 change: 0 additions & 1 deletion sdk/include/opentelemetry/sdk/metrics/sync_instruments.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "opentelemetry/metrics/sync_instruments.h"
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/sdk/metrics/state/metric_storage.h"
#include "opentelemetry/sdk_config.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

#include <string>
#include <unordered_map>
#include <utility>

#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h"
#include "opentelemetry/version.h"

Expand Down
6 changes: 5 additions & 1 deletion sdk/include/opentelemetry/sdk/metrics/view/view_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@

#pragma once

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

#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/sdk/metrics/view/instrument_selector.h"
#include "opentelemetry/sdk/metrics/view/meter_selector.h"
#include "opentelemetry/sdk/metrics/view/predicate.h"
#include "opentelemetry/sdk/metrics/view/view.h"
#include "opentelemetry/version.h"

Expand Down
3 changes: 3 additions & 0 deletions sdk/include/opentelemetry/sdk/trace/simple_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
#include <chrono>
#include <memory>
#include <mutex>
#include <utility>

#include "opentelemetry/common/spin_lock_mutex.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/sdk/common/exporter_utils.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/recordable.h"
#include "opentelemetry/trace/span_context.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down
8 changes: 6 additions & 2 deletions sdk/include/opentelemetry/sdk/trace/span_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@
#include <vector>

#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/common/macros.h"
#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/common/timestamp.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/sdk/common/attribute_utils.h"
#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/sdk/trace/recordable.h"
#include "opentelemetry/trace/span.h"
#include "opentelemetry/trace/span_context.h"
#include "opentelemetry/trace/span_id.h"
#include "opentelemetry/trace/span_metadata.h"
#include "opentelemetry/trace/trace_flags.h"
#include "opentelemetry/trace/trace_id.h"
#include "opentelemetry/version.h"

Expand Down
2 changes: 0 additions & 2 deletions sdk/include/opentelemetry/sdk/trace/tracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
#pragma once

#include <stdint.h>
#include <memory>

#include "opentelemetry/common/key_value_iterable.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/sdk/trace/id_generator.h"
Expand Down
Loading

0 comments on commit c6d3945

Please sign in to comment.