Skip to content

Commit

Permalink
[SDK] Header files cleanup, use forward declarations (#2182)
Browse files Browse the repository at this point in the history
  • Loading branch information
cngzhnp authored Jun 20, 2023
1 parent 2db5f29 commit cfcda57
Show file tree
Hide file tree
Showing 172 changed files with 859 additions and 361 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/nostd/function_ref.h"
#include "opentelemetry/nostd/span.h"
#include "opentelemetry/nostd/string_view.h"
#include "opentelemetry/nostd/utility.h"
#include "opentelemetry/trace/span_context.h"
#include "opentelemetry/trace/span_context_kv_iterable.h"
#include "opentelemetry/version.h"

Expand Down
4 changes: 4 additions & 0 deletions examples/batch/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/exporters/ostream/span_exporter_factory.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/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"

Expand Down
3 changes: 3 additions & 0 deletions examples/grpc/tracer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
#include "opentelemetry/context/propagation/text_map_propagator.h"
#include "opentelemetry/exporters/ostream/span_exporter_factory.h"
#include "opentelemetry/nostd/shared_ptr.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_context.h"
#include "opentelemetry/sdk/trace/tracer_context_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/propagation/http_trace_context.h"
Expand Down
3 changes: 3 additions & 0 deletions examples/http/tracer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#pragma once

#include "opentelemetry/exporters/ostream/span_exporter_factory.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_context.h"
#include "opentelemetry/sdk/trace/tracer_context_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"
Expand Down
2 changes: 2 additions & 0 deletions examples/jaeger/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/exporters/jaeger/jaeger_exporter_factory.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"
Expand Down
3 changes: 3 additions & 0 deletions examples/logs_simple/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@

#ifdef ENABLE_LOGS_PREVIEW
# include "opentelemetry/exporters/ostream/span_exporter_factory.h"
# include "opentelemetry/sdk/trace/exporter.h"
# include "opentelemetry/sdk/trace/processor.h"
# include "opentelemetry/sdk/trace/simple_processor_factory.h"
# include "opentelemetry/sdk/trace/tracer_provider_factory.h"
# include "opentelemetry/trace/provider.h"

# include "opentelemetry/exporters/ostream/log_record_exporter.h"
# include "opentelemetry/logs/provider.h"
# include "opentelemetry/sdk/logs/logger_provider_factory.h"
# include "opentelemetry/sdk/logs/processor.h"
# include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h"

# ifdef BAZEL_BUILD
Expand Down
2 changes: 2 additions & 0 deletions examples/multithreaded/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "opentelemetry/exporters/ostream/span_exporter_factory.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"
Expand Down
4 changes: 4 additions & 0 deletions examples/otlp/grpc_log_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
# include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h"
# include "opentelemetry/exporters/otlp/otlp_grpc_log_record_exporter_factory.h"
# include "opentelemetry/logs/provider.h"
# include "opentelemetry/sdk/logs/exporter.h"
# include "opentelemetry/sdk/logs/logger_provider_factory.h"
# include "opentelemetry/sdk/logs/processor.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/simple_processor_factory.h"
# include "opentelemetry/sdk/trace/tracer_provider_factory.h"
# include "opentelemetry/trace/provider.h"
Expand Down
1 change: 1 addition & 0 deletions examples/otlp/grpc_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"
Expand Down
2 changes: 2 additions & 0 deletions examples/otlp/http_log_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
# include "opentelemetry/logs/provider.h"
# include "opentelemetry/sdk/common/global_log_handler.h"
# include "opentelemetry/sdk/logs/logger_provider_factory.h"
# include "opentelemetry/sdk/logs/processor.h"
# include "opentelemetry/sdk/logs/simple_log_record_processor_factory.h"
# include "opentelemetry/sdk/trace/processor.h"
# include "opentelemetry/sdk/trace/simple_processor_factory.h"
# include "opentelemetry/sdk/trace/tracer_provider_factory.h"
# include "opentelemetry/trace/provider.h"
Expand Down
1 change: 1 addition & 0 deletions examples/otlp/http_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "opentelemetry/exporters/otlp/otlp_http_exporter_factory.h"
#include "opentelemetry/exporters/otlp/otlp_http_exporter_options.h"
#include "opentelemetry/sdk/common/global_log_handler.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"
Expand Down
2 changes: 2 additions & 0 deletions examples/simple/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/exporters/ostream/span_exporter_factory.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"
Expand Down
2 changes: 2 additions & 0 deletions examples/zipkin/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/exporters/zipkin/zipkin_exporter_factory.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/sdk/trace/processor.h"
#include "opentelemetry/sdk/trace/simple_processor_factory.h"
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
#include "opentelemetry/trace/provider.h"
Expand Down
6 changes: 6 additions & 0 deletions exporters/elasticsearch/src/es_log_recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
#ifdef ENABLE_LOGS_PREVIEW

# include "opentelemetry/exporters/elasticsearch/es_log_recordable.h"
# include "opentelemetry/logs/severity.h"
# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
# include "opentelemetry/sdk/resource/resource.h"
# include "opentelemetry/trace/span_id.h"
# include "opentelemetry/trace/trace_flags.h"
# include "opentelemetry/trace/trace_id.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace exporter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "opentelemetry/trace/trace_id.h"
#include "opentelemetry/trace/tracer_provider.h"

#include "opentelemetry/sdk/common/empty_attributes.h"
#include "opentelemetry/sdk/trace/exporter.h"
#include "opentelemetry/sdk/trace/samplers/always_on.h"

Expand Down
1 change: 1 addition & 0 deletions exporters/jaeger/src/recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "opentelemetry/exporters/jaeger/recordable.h"
#include "opentelemetry/sdk/common/global_log_handler.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/sdk/resource/semantic_conventions.h"

OPENTELEMETRY_BEGIN_NAMESPACE
Expand Down
10 changes: 7 additions & 3 deletions exporters/jaeger/test/jaeger_exporter_test.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

#include <opentelemetry/exporters/jaeger/jaeger_exporter.h>
#include <memory>
#include <vector>
#include "opentelemetry/exporters/jaeger/jaeger_exporter.h"
#include "opentelemetry/sdk/trace/batch_span_processor.h"
#include "opentelemetry/sdk/trace/batch_span_processor_options.h"
#include "opentelemetry/sdk/trace/tracer.h"
#include "opentelemetry/sdk/trace/tracer_provider.h"
#include "opentelemetry/trace/span_startoptions.h"

#ifdef BAZEL_BUILD
# include "exporters/jaeger/src/thrift_sender.h"
Expand All @@ -16,6 +17,9 @@
#include <gtest/gtest.h>
#include "gmock/gmock.h"

#include <memory>
#include <vector>

namespace trace = opentelemetry::trace;
namespace nostd = opentelemetry::nostd;
namespace sdktrace = opentelemetry::sdk::trace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
#pragma once
#ifdef ENABLE_LOGS_PREVIEW

# include "opentelemetry/common/attribute_value.h"
# include "opentelemetry/common/spin_lock_mutex.h"
# include "opentelemetry/nostd/type_traits.h"
# include "opentelemetry/sdk/common/attribute_utils.h"
# include "opentelemetry/sdk/logs/exporter.h"

# include "opentelemetry/version.h"

# include <iostream>
# include <sstream>
# include <unordered_map>

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

#include <iostream>
#include <string>

#include "opentelemetry/common/spin_lock_mutex.h"
#include "opentelemetry/sdk/metrics/data/metric_data.h"
#include "opentelemetry/sdk/metrics/export/metric_producer.h"
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/sdk/metrics/push_metric_exporter.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace sdk
{
namespace resource
{
class Resource;
} // namespace resource
} // namespace sdk

namespace exporter
{
namespace metrics
Expand Down
2 changes: 2 additions & 0 deletions exporters/ostream/src/log_record_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#ifdef ENABLE_LOGS_PREVIEW
# include "opentelemetry/exporters/ostream/log_record_exporter.h"
# include "opentelemetry/exporters/ostream/common_utils.h"
# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
# include "opentelemetry/sdk/logs/read_write_log_record.h"
# include "opentelemetry/sdk/resource/resource.h"
# include "opentelemetry/sdk_config.h"

# include <iostream>
Expand Down
12 changes: 8 additions & 4 deletions exporters/ostream/src/metric_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/exporters/ostream/metric_exporter.h"
#include <algorithm>
#include <chrono>
#include <ctime>
#include <map>
#include "opentelemetry/exporters/ostream/common_utils.h"
#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h"
#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/sdk_config.h"

#include <algorithm>
#include <chrono>
#include <ctime>
#include <map>
#include <mutex>

namespace
{
std::string timeToString(opentelemetry::common::SystemTimestamp time_stamp)
Expand Down
5 changes: 4 additions & 1 deletion exporters/ostream/test/ostream_log_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@

#ifdef ENABLE_LOGS_PREVIEW

# include <array>
# include "opentelemetry/exporters/ostream/log_record_exporter.h"
# include "opentelemetry/logs/provider.h"
# include "opentelemetry/nostd/span.h"
# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
# include "opentelemetry/sdk/logs/logger_provider.h"
# include "opentelemetry/sdk/logs/read_write_log_record.h"
# include "opentelemetry/sdk/logs/simple_log_record_processor.h"
# include "opentelemetry/sdk/version/version.h"

# include <gtest/gtest.h>

# include <array>
# include <iostream>

namespace sdklogs = opentelemetry::sdk::logs;
Expand Down
14 changes: 8 additions & 6 deletions exporters/ostream/test/ostream_metric_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@
// SPDX-License-Identifier: Apache-2.0

#include <gtest/gtest.h>
#include <memory>
#include <vector>
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/sdk/resource/resource_detector.h"
#include "opentelemetry/sdk/version/version.h"

#include <iostream>
#include "opentelemetry/exporters/ostream/metric_exporter.h"
#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h"
#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h"
#include "opentelemetry/sdk/metrics/data/metric_data.h"
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/sdk/resource/resource_detector.h"
#include "opentelemetry/sdk/version/version.h"

#include <iostream>
#include <memory>
#include <vector>

namespace metric_sdk = opentelemetry::sdk::metrics;
namespace nostd = opentelemetry::nostd;
Expand Down
1 change: 1 addition & 0 deletions exporters/otlp/src/otlp_metric_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "opentelemetry/exporters/otlp/otlp_metric_utils.h"
#include "opentelemetry/exporters/otlp/otlp_populate_attribute_utils.h"
#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"

OPENTELEMETRY_BEGIN_NAMESPACE

Expand Down
2 changes: 2 additions & 0 deletions exporters/otlp/test/otlp_grpc_log_record_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
# include "opentelemetry/sdk/logs/batch_log_record_processor.h"
# include "opentelemetry/sdk/logs/exporter.h"
# include "opentelemetry/sdk/logs/logger_provider.h"
# include "opentelemetry/sdk/logs/recordable.h"
# include "opentelemetry/sdk/resource/resource.h"
# include "opentelemetry/sdk/trace/exporter.h"
# include "opentelemetry/sdk/trace/processor.h"
# include "opentelemetry/sdk/trace/simple_processor_factory.h"
# include "opentelemetry/sdk/trace/tracer_provider_factory.h"
# include "opentelemetry/trace/provider.h"
Expand Down
1 change: 1 addition & 0 deletions exporters/otlp/test/otlp_http_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# include "opentelemetry/ext/http/client/http_client_factory.h"
# include "opentelemetry/ext/http/server/http_server.h"
# include "opentelemetry/sdk/trace/batch_span_processor.h"
# include "opentelemetry/sdk/trace/batch_span_processor_options.h"
# include "opentelemetry/sdk/trace/tracer_provider.h"
# include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h"
# include "opentelemetry/trace/provider.h"
Expand Down
2 changes: 2 additions & 0 deletions exporters/otlp/test/otlp_http_metric_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
#include "opentelemetry/common/key_value_iterable_view.h"
#include "opentelemetry/ext/http/client/http_client_factory.h"
#include "opentelemetry/ext/http/server/http_server.h"
#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h"
#include "opentelemetry/sdk/metrics/aggregation/default_aggregation.h"
#include "opentelemetry/sdk/metrics/aggregation/histogram_aggregation.h"
#include "opentelemetry/sdk/metrics/data/metric_data.h"
#include "opentelemetry/sdk/metrics/export/metric_producer.h"
#include "opentelemetry/sdk/metrics/instruments.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h"
Expand Down
1 change: 1 addition & 0 deletions exporters/otlp/test/otlp_recordable_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/exporters/otlp/otlp_recordable.h"
#include "opentelemetry/sdk/resource/resource.h"

#if defined(__GNUC__)
// GCC raises -Wsuggest-override warnings on GTest,
Expand Down
1 change: 1 addition & 0 deletions exporters/zipkin/src/recordable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "opentelemetry/exporters/zipkin/recordable.h"
#include "opentelemetry/sdk/resource/resource.h"
#include "opentelemetry/sdk/resource/semantic_conventions.h"

#include <map>
Expand Down
4 changes: 3 additions & 1 deletion exporters/zipkin/test/zipkin_exporter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#ifndef HAVE_CPP_STDLIB

# include "opentelemetry/exporters/zipkin/zipkin_exporter.h"
# include <string>
# include "opentelemetry/ext/http/client/curl/http_client_curl.h"
# include "opentelemetry/ext/http/server/http_server.h"
# include "opentelemetry/sdk/trace/batch_span_processor.h"
# include "opentelemetry/sdk/trace/batch_span_processor_options.h"
# include "opentelemetry/sdk/trace/tracer_provider.h"
# include "opentelemetry/trace/provider.h"

Expand All @@ -16,6 +16,8 @@

# include "nlohmann/json.hpp"

# include <string>

# if defined(_MSC_VER)
# include "opentelemetry/sdk/common/env_variables.h"
using opentelemetry::sdk::common::setenv;
Expand Down
1 change: 1 addition & 0 deletions ext/test/w3c_tracecontext_test/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "opentelemetry/ext/http/client/curl/http_client_curl.h"
#include "opentelemetry/ext/http/server/http_server.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"
Expand Down
Loading

0 comments on commit cfcda57

Please sign in to comment.