diff --git a/examples/configuration/extensions.yaml b/examples/configuration/extensions.yaml index 2ca218d251..1c7aa47313 100644 --- a/examples/configuration/extensions.yaml +++ b/examples/configuration/extensions.yaml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # The file format version -file_format: "0.1" +file_format: "1.0" # Configure if the SDK is disabled or not. This is not required to be provided # to ensure the SDK isn't disabled, the default value when this is not provided diff --git a/functional/configuration/shelltests/propagator_both.yaml b/functional/configuration/shelltests/propagator_both.yaml index 6e4e4e6fd9..ef8dcf12f8 100644 --- a/functional/configuration/shelltests/propagator_both.yaml +++ b/functional/configuration/shelltests/propagator_both.yaml @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -file_format: 1.0.0 +file_format: "1.0" propagator: composite: diff --git a/functional/configuration/shelltests/propagator_broken.yaml b/functional/configuration/shelltests/propagator_broken.yaml index ddad6d9eeb..9f3a157eda 100644 --- a/functional/configuration/shelltests/propagator_broken.yaml +++ b/functional/configuration/shelltests/propagator_broken.yaml @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -file_format: 1.0.0 +file_format: "1.0" propagator: composite: diff --git a/functional/configuration/shelltests/propagator_composite_list.yaml b/functional/configuration/shelltests/propagator_composite_list.yaml index 26a6030a22..5d9a6b6245 100644 --- a/functional/configuration/shelltests/propagator_composite_list.yaml +++ b/functional/configuration/shelltests/propagator_composite_list.yaml @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -file_format: 1.0.0 +file_format: "1.0" propagator: composite_list: "tracecontext,baggage,b3,b3multi" diff --git a/functional/configuration/shelltests/propagator_duplicates.yaml b/functional/configuration/shelltests/propagator_duplicates.yaml index df371636e5..06f3d374a7 100644 --- a/functional/configuration/shelltests/propagator_duplicates.yaml +++ b/functional/configuration/shelltests/propagator_duplicates.yaml @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -file_format: 1.0.0 +file_format: "1.0" propagator: composite: diff --git a/functional/configuration/shelltests/propagator_multi.yaml b/functional/configuration/shelltests/propagator_multi.yaml index d1aec0864f..7fcd96b53a 100644 --- a/functional/configuration/shelltests/propagator_multi.yaml +++ b/functional/configuration/shelltests/propagator_multi.yaml @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -file_format: 1.0.0 +file_format: "1.0" propagator: composite: diff --git a/functional/configuration/shelltests/propagator_ottrace.yaml b/functional/configuration/shelltests/propagator_ottrace.yaml index 221022e965..1c12a48b15 100644 --- a/functional/configuration/shelltests/propagator_ottrace.yaml +++ b/functional/configuration/shelltests/propagator_ottrace.yaml @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -file_format: 1.0.0 +file_format: "1.0" propagator: composite: diff --git a/functional/configuration/shelltests/propagator_single.yaml b/functional/configuration/shelltests/propagator_single.yaml index 7b1a6bd91a..e957d3f84a 100644 --- a/functional/configuration/shelltests/propagator_single.yaml +++ b/functional/configuration/shelltests/propagator_single.yaml @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -file_format: 1.0.0 +file_format: "1.0" propagator: composite: diff --git a/functional/configuration/shelltests/propagator_unknown.yaml b/functional/configuration/shelltests/propagator_unknown.yaml index 38eb157513..3c1587c2a7 100644 --- a/functional/configuration/shelltests/propagator_unknown.yaml +++ b/functional/configuration/shelltests/propagator_unknown.yaml @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -file_format: 1.0.0 +file_format: "1.0" propagator: composite: diff --git a/functional/configuration/shelltests/propagator_xray.yaml b/functional/configuration/shelltests/propagator_xray.yaml index 872968d000..c825729cb0 100644 --- a/functional/configuration/shelltests/propagator_xray.yaml +++ b/functional/configuration/shelltests/propagator_xray.yaml @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -file_format: 1.0.0 +file_format: "1.0" propagator: composite: diff --git a/functional/configuration/shelltests/sampler_jaeger.yaml b/functional/configuration/shelltests/sampler_jaeger.yaml index c4d4a819a4..687f5de9e1 100644 --- a/functional/configuration/shelltests/sampler_jaeger.yaml +++ b/functional/configuration/shelltests/sampler_jaeger.yaml @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -file_format: 1.0.0 +file_format: "1.0" tracer_provider: processors: diff --git a/sdk/include/opentelemetry/sdk/configuration/configuration_parser.h b/sdk/include/opentelemetry/sdk/configuration/configuration_parser.h index cd4f6e3af5..fbf0db5edd 100644 --- a/sdk/include/opentelemetry/sdk/configuration/configuration_parser.h +++ b/sdk/include/opentelemetry/sdk/configuration/configuration_parser.h @@ -5,8 +5,89 @@ #include +#include "opentelemetry/sdk/configuration/aggregation_configuration.h" +#include "opentelemetry/sdk/configuration/always_off_sampler_configuration.h" +#include "opentelemetry/sdk/configuration/always_on_sampler_configuration.h" +#include "opentelemetry/sdk/configuration/attribute_limits_configuration.h" +#include "opentelemetry/sdk/configuration/attribute_value_configuration.h" +#include "opentelemetry/sdk/configuration/attributes_configuration.h" +#include "opentelemetry/sdk/configuration/base2_exponential_bucket_histogram_aggregation_configuration.h" +#include "opentelemetry/sdk/configuration/batch_log_record_processor_configuration.h" +#include "opentelemetry/sdk/configuration/batch_span_processor_configuration.h" +#include "opentelemetry/sdk/configuration/boolean_array_attribute_value_configuration.h" +#include "opentelemetry/sdk/configuration/boolean_attribute_value_configuration.h" #include "opentelemetry/sdk/configuration/configuration.h" +#include "opentelemetry/sdk/configuration/configuration_parser.h" +#include "opentelemetry/sdk/configuration/console_log_record_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/console_push_metric_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/console_span_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/default_aggregation_configuration.h" +#include "opentelemetry/sdk/configuration/default_histogram_aggregation.h" +#include "opentelemetry/sdk/configuration/document.h" #include "opentelemetry/sdk/configuration/document_node.h" +#include "opentelemetry/sdk/configuration/double_array_attribute_value_configuration.h" +#include "opentelemetry/sdk/configuration/double_attribute_value_configuration.h" +#include "opentelemetry/sdk/configuration/drop_aggregation_configuration.h" +#include "opentelemetry/sdk/configuration/explicit_bucket_histogram_aggregation_configuration.h" +#include "opentelemetry/sdk/configuration/extension_log_record_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/extension_log_record_processor_configuration.h" +#include "opentelemetry/sdk/configuration/extension_metric_producer_configuration.h" +#include "opentelemetry/sdk/configuration/extension_pull_metric_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/extension_push_metric_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/extension_sampler_configuration.h" +#include "opentelemetry/sdk/configuration/extension_span_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/extension_span_processor_configuration.h" +#include "opentelemetry/sdk/configuration/headers_configuration.h" +#include "opentelemetry/sdk/configuration/include_exclude_configuration.h" +#include "opentelemetry/sdk/configuration/instrument_type.h" +#include "opentelemetry/sdk/configuration/integer_array_attribute_value_configuration.h" +#include "opentelemetry/sdk/configuration/integer_attribute_value_configuration.h" +#include "opentelemetry/sdk/configuration/invalid_schema_exception.h" +#include "opentelemetry/sdk/configuration/jaeger_remote_sampler_configuration.h" +#include "opentelemetry/sdk/configuration/last_value_aggregation_configuration.h" +#include "opentelemetry/sdk/configuration/log_record_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/log_record_limits_configuration.h" +#include "opentelemetry/sdk/configuration/log_record_processor_configuration.h" +#include "opentelemetry/sdk/configuration/logger_provider_configuration.h" +#include "opentelemetry/sdk/configuration/meter_provider_configuration.h" +#include "opentelemetry/sdk/configuration/metric_producer_configuration.h" +#include "opentelemetry/sdk/configuration/metric_reader_configuration.h" +#include "opentelemetry/sdk/configuration/open_census_metric_producer_configuration.h" +#include "opentelemetry/sdk/configuration/otlp_file_log_record_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/otlp_file_push_metric_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/otlp_file_span_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/otlp_grpc_log_record_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/otlp_grpc_push_metric_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/otlp_grpc_span_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/otlp_http_encoding.h" +#include "opentelemetry/sdk/configuration/otlp_http_log_record_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/otlp_http_push_metric_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/otlp_http_span_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/parent_based_sampler_configuration.h" +#include "opentelemetry/sdk/configuration/periodic_metric_reader_configuration.h" +#include "opentelemetry/sdk/configuration/prometheus_pull_metric_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/propagator_configuration.h" +#include "opentelemetry/sdk/configuration/pull_metric_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/pull_metric_reader_configuration.h" +#include "opentelemetry/sdk/configuration/push_metric_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/resource_configuration.h" +#include "opentelemetry/sdk/configuration/sampler_configuration.h" +#include "opentelemetry/sdk/configuration/simple_log_record_processor_configuration.h" +#include "opentelemetry/sdk/configuration/simple_span_processor_configuration.h" +#include "opentelemetry/sdk/configuration/span_exporter_configuration.h" +#include "opentelemetry/sdk/configuration/span_limits_configuration.h" +#include "opentelemetry/sdk/configuration/span_processor_configuration.h" +#include "opentelemetry/sdk/configuration/string_array_attribute_value_configuration.h" +#include "opentelemetry/sdk/configuration/string_array_configuration.h" +#include "opentelemetry/sdk/configuration/string_attribute_value_configuration.h" +#include "opentelemetry/sdk/configuration/sum_aggregation_configuration.h" +#include "opentelemetry/sdk/configuration/temporality_preference.h" +#include "opentelemetry/sdk/configuration/trace_id_ratio_based_sampler_configuration.h" +#include "opentelemetry/sdk/configuration/tracer_provider_configuration.h" +#include "opentelemetry/sdk/configuration/view_configuration.h" +#include "opentelemetry/sdk/configuration/view_selector_configuration.h" +#include "opentelemetry/sdk/configuration/view_stream_configuration.h" +#include "opentelemetry/sdk/configuration/zipkin_span_exporter_configuration.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -18,7 +99,256 @@ namespace configuration class ConfigurationParser { public: - static std::unique_ptr Parse(std::unique_ptr doc); + OtlpHttpEncoding ParseOtlpHttpEncoding(const std::string &name) const; + + std::unique_ptr ParseStringArrayConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseIncludeExcludeConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseHeadersConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseAttributeLimitsConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr + ParseOtlpHttpLogRecordExporterConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr + ParseOtlpGrpcLogRecordExporterConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr + ParseOtlpFileLogRecordExporterConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr ParseConsoleLogRecordExporterConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr + ParseExtensionLogRecordExporterConfiguration(const std::string &name, + std::unique_ptr node) const; + + std::unique_ptr ParseLogRecordExporterConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseBatchLogRecordProcessorConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseSimpleLogRecordProcessorConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr + ParseExtensionLogRecordProcessorConfiguration(const std::string &name, + std::unique_ptr node) const; + + std::unique_ptr ParseLogRecordProcessorConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseLogRecordLimitsConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseLoggerProviderConfiguration( + const std::unique_ptr &node) const; + + DefaultHistogramAggregation ParseDefaultHistogramAggregation(const std::string &name) const; + + TemporalityPreference ParseTemporalityPreference(const std::string &name) const; + + std::unique_ptr + ParseOtlpHttpPushMetricExporterConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr + ParseOtlpGrpcPushMetricExporterConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr + ParseOtlpFilePushMetricExporterConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr + ParseConsolePushMetricExporterConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr + ParsePrometheusPullMetricExporterConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr + ParsePushMetricExporterExtensionConfiguration(const std::string &name, + std::unique_ptr node) const; + + std::unique_ptr + ParsePullMetricExporterExtensionConfiguration(const std::string &name, + std::unique_ptr node) const; + + std::unique_ptr ParsePushMetricExporterConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParsePullMetricExporterConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseOpenCensusMetricProducerConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseExtensionMetricProducerConfiguration( + const std::string &name, + std::unique_ptr node) const; + + std::unique_ptr ParseMetricProducerConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParsePeriodicMetricReaderConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParsePullMetricReaderConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseMetricReaderConfiguration( + const std::unique_ptr &node) const; + + InstrumentType ParseInstrumentType(const std::string &name) const; + + std::unique_ptr ParseViewSelectorConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseDefaultAggregationConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseDropAggregationConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr + ParseExplicitBucketHistogramAggregationConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr + ParseBase2ExponentialBucketHistogramAggregationConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseLastValueAggregationConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseSumAggregationConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseAggregationConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseViewStreamConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseViewConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseMeterProviderConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParsePropagatorConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseSpanLimitsConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseAlwaysOffSamplerConfiguration( + const std::unique_ptr &node, + size_t depth) const; + + std::unique_ptr ParseAlwaysOnSamplerConfiguration( + const std::unique_ptr &node, + size_t depth) const; + + std::unique_ptr ParseJaegerRemoteSamplerConfiguration( + const std::unique_ptr &node, + size_t depth) const; + + std::unique_ptr ParseParentBasedSamplerConfiguration( + const std::unique_ptr &node, + size_t depth) const; + + std::unique_ptr ParseTraceIdRatioBasedSamplerConfiguration( + const std::unique_ptr &node, + size_t depth) const; + + std::unique_ptr ParseSamplerExtensionConfiguration( + const std::string &name, + std::unique_ptr node, + size_t depth) const; + + std::unique_ptr ParseSamplerConfiguration( + const std::unique_ptr &node, + size_t depth) const; + + std::unique_ptr ParseOtlpHttpSpanExporterConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseOtlpGrpcSpanExporterConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseOtlpFileSpanExporterConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseConsoleSpanExporterConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseZipkinSpanExporterConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseExtensionSpanExporterConfiguration( + const std::string &name, + std::unique_ptr node) const; + + std::unique_ptr ParseSpanExporterConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseBatchSpanProcessorConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseSimpleSpanProcessorConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseExtensionSpanProcessorConfiguration( + const std::string &name, + std::unique_ptr node) const; + + std::unique_ptr ParseSpanProcessorConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseTracerProviderConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseStringAttributeValueConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseIntegerAttributeValueConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseDoubleAttributeValueConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseBooleanAttributeValueConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr + ParseStringArrayAttributeValueConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr + ParseIntegerArrayAttributeValueConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr + ParseDoubleArrayAttributeValueConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr + ParseBooleanArrayAttributeValueConfiguration(const std::unique_ptr &node) const; + + std::unique_ptr ParseAttributesConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr ParseResourceConfiguration( + const std::unique_ptr &node) const; + + std::unique_ptr Parse(std::unique_ptr doc); + +private: + std::string version_; + int version_major_; + int version_minor_; }; } // namespace configuration diff --git a/sdk/include/opentelemetry/sdk/configuration/integer_attribute_value_configuration.h b/sdk/include/opentelemetry/sdk/configuration/integer_attribute_value_configuration.h index 4fa558157d..0b72fd7afc 100644 --- a/sdk/include/opentelemetry/sdk/configuration/integer_attribute_value_configuration.h +++ b/sdk/include/opentelemetry/sdk/configuration/integer_attribute_value_configuration.h @@ -3,8 +3,6 @@ #pragma once -#include - #include "opentelemetry/sdk/configuration/attribute_value_configuration.h" #include "opentelemetry/sdk/configuration/attribute_value_configuration_visitor.h" #include "opentelemetry/version.h" @@ -25,7 +23,7 @@ class IntegerAttributeValueConfiguration : public AttributeValueConfiguration visitor->VisitInteger(this); } - std::size_t value; + long long value; }; } // namespace configuration diff --git a/sdk/src/configuration/configuration_parser.cc b/sdk/src/configuration/configuration_parser.cc index 7b0abcbca7..fbdd109435 100644 --- a/sdk/src/configuration/configuration_parser.cc +++ b/sdk/src/configuration/configuration_parser.cc @@ -105,7 +105,7 @@ namespace configuration // FIXME: proper sizing constexpr size_t MAX_SAMPLER_DEPTH = 10; -static OtlpHttpEncoding ParseOtlpHttpEncoding(const std::string &name) +OtlpHttpEncoding ConfigurationParser::ParseOtlpHttpEncoding(const std::string &name) const { if (name == "protobuf") { @@ -122,8 +122,8 @@ static OtlpHttpEncoding ParseOtlpHttpEncoding(const std::string &name) throw InvalidSchemaException(message); } -static std::unique_ptr ParseStringArrayConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseStringArrayConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -139,8 +139,8 @@ static std::unique_ptr ParseStringArrayConfiguration( return model; } -static std::unique_ptr ParseIncludeExcludeConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseIncludeExcludeConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -160,8 +160,8 @@ static std::unique_ptr ParseIncludeExcludeConfigura return model; } -static std::unique_ptr ParseHeadersConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseHeadersConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr kv_pair; @@ -188,8 +188,9 @@ static std::unique_ptr ParseHeadersConfiguration( return model; } -static std::unique_ptr ParseAttributeLimitsConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseAttributeLimitsConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -199,8 +200,9 @@ static std::unique_ptr ParseAttributeLimitsConfigu return model; } -static std::unique_ptr -ParseOtlpHttpLogRecordExporterConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseOtlpHttpLogRecordExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -226,8 +228,9 @@ ParseOtlpHttpLogRecordExporterConfiguration(const std::unique_ptr return model; } -static std::unique_ptr -ParseOtlpGrpcLogRecordExporterConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseOtlpGrpcLogRecordExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -251,8 +254,9 @@ ParseOtlpGrpcLogRecordExporterConfiguration(const std::unique_ptr return model; } -static std::unique_ptr -ParseOtlpFileLogRecordExporterConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseOtlpFileLogRecordExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -262,17 +266,19 @@ ParseOtlpFileLogRecordExporterConfiguration(const std::unique_ptr return model; } -static std::unique_ptr -ParseConsoleLogRecordExporterConfiguration(const std::unique_ptr & /* node */) +std::unique_ptr +ConfigurationParser::ParseConsoleLogRecordExporterConfiguration( + const std::unique_ptr & /* node */) const { auto model = std::make_unique(); return model; } -static std::unique_ptr -ParseExtensionLogRecordExporterConfiguration(const std::string &name, - std::unique_ptr node) +std::unique_ptr +ConfigurationParser::ParseExtensionLogRecordExporterConfiguration( + const std::string &name, + std::unique_ptr node) const { auto model = std::make_unique(); @@ -282,8 +288,9 @@ ParseExtensionLogRecordExporterConfiguration(const std::string &name, return model; } -static std::unique_ptr ParseLogRecordExporterConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseLogRecordExporterConfiguration( + const std::unique_ptr &node) const { std::unique_ptr model; @@ -329,8 +336,9 @@ static std::unique_ptr ParseLogRecordExporterCon return model; } -static std::unique_ptr -ParseBatchLogRecordProcessorConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseBatchLogRecordProcessorConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -346,8 +354,9 @@ ParseBatchLogRecordProcessorConfiguration(const std::unique_ptr &n return model; } -static std::unique_ptr -ParseSimpleLogRecordProcessorConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseSimpleLogRecordProcessorConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -358,9 +367,10 @@ ParseSimpleLogRecordProcessorConfiguration(const std::unique_ptr & return model; } -static std::unique_ptr -ParseExtensionLogRecordProcessorConfiguration(const std::string &name, - std::unique_ptr node) +std::unique_ptr +ConfigurationParser::ParseExtensionLogRecordProcessorConfiguration( + const std::string &name, + std::unique_ptr node) const { auto model = std::make_unique(); @@ -370,8 +380,9 @@ ParseExtensionLogRecordProcessorConfiguration(const std::string &name, return model; } -static std::unique_ptr ParseLogRecordProcessorConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseLogRecordProcessorConfiguration( + const std::unique_ptr &node) const { std::unique_ptr model; @@ -409,8 +420,9 @@ static std::unique_ptr ParseLogRecordProcessorC return model; } -static std::unique_ptr ParseLogRecordLimitsConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseLogRecordLimitsConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -420,8 +432,8 @@ static std::unique_ptr ParseLogRecordLimitsConfigu return model; } -static std::unique_ptr ParseLoggerProviderConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseLoggerProviderConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -449,7 +461,8 @@ static std::unique_ptr ParseLoggerProviderConfigura return model; } -static DefaultHistogramAggregation ParseDefaultHistogramAggregation(const std::string &name) +DefaultHistogramAggregation ConfigurationParser::ParseDefaultHistogramAggregation( + const std::string &name) const { if (name == "explicit_bucket_histogram") { @@ -466,7 +479,7 @@ static DefaultHistogramAggregation ParseDefaultHistogramAggregation(const std::s throw InvalidSchemaException(message); } -static TemporalityPreference ParseTemporalityPreference(const std::string &name) +TemporalityPreference ConfigurationParser::ParseTemporalityPreference(const std::string &name) const { if (name == "cumulative") { @@ -488,8 +501,9 @@ static TemporalityPreference ParseTemporalityPreference(const std::string &name) throw InvalidSchemaException(message); } -static std::unique_ptr -ParseOtlpHttpPushMetricExporterConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseOtlpHttpPushMetricExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -523,8 +537,9 @@ ParseOtlpHttpPushMetricExporterConfiguration(const std::unique_ptr return model; } -static std::unique_ptr -ParseOtlpGrpcPushMetricExporterConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseOtlpGrpcPushMetricExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -557,8 +572,9 @@ ParseOtlpGrpcPushMetricExporterConfiguration(const std::unique_ptr return model; } -static std::unique_ptr -ParseOtlpFilePushMetricExporterConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseOtlpFilePushMetricExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -576,8 +592,9 @@ ParseOtlpFilePushMetricExporterConfiguration(const std::unique_ptr return model; } -static std::unique_ptr -ParseConsolePushMetricExporterConfiguration(const std::unique_ptr & /* node */) +std::unique_ptr +ConfigurationParser::ParseConsolePushMetricExporterConfiguration( + const std::unique_ptr & /* node */) const { auto model = std::make_unique(); @@ -586,8 +603,9 @@ ParseConsolePushMetricExporterConfiguration(const std::unique_ptr return model; } -static std::unique_ptr -ParsePrometheusPullMetricExporterConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParsePrometheusPullMetricExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -600,9 +618,10 @@ ParsePrometheusPullMetricExporterConfiguration(const std::unique_ptr -ParsePushMetricExporterExtensionConfiguration(const std::string &name, - std::unique_ptr node) +std::unique_ptr +ConfigurationParser::ParsePushMetricExporterExtensionConfiguration( + const std::string &name, + std::unique_ptr node) const { auto model = std::make_unique(); @@ -612,9 +631,10 @@ ParsePushMetricExporterExtensionConfiguration(const std::string &name, return model; } -static std::unique_ptr -ParsePullMetricExporterExtensionConfiguration(const std::string &name, - std::unique_ptr node) +std::unique_ptr +ConfigurationParser::ParsePullMetricExporterExtensionConfiguration( + const std::string &name, + std::unique_ptr node) const { auto model = std::make_unique(); @@ -624,8 +644,9 @@ ParsePullMetricExporterExtensionConfiguration(const std::string &name, return model; } -static std::unique_ptr ParsePushMetricExporterConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParsePushMetricExporterConfiguration( + const std::unique_ptr &node) const { std::unique_ptr model; @@ -671,8 +692,9 @@ static std::unique_ptr ParsePushMetricExporterC return model; } -static std::unique_ptr ParsePullMetricExporterConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParsePullMetricExporterConfiguration( + const std::unique_ptr &node) const { std::unique_ptr model; @@ -706,17 +728,19 @@ static std::unique_ptr ParsePullMetricExporterC return model; } -static std::unique_ptr -ParseOpenCensusMetricProducerConfiguration(const std::unique_ptr & /* node */) +std::unique_ptr +ConfigurationParser::ParseOpenCensusMetricProducerConfiguration( + const std::unique_ptr & /* node */) const { auto model = std::make_unique(); return model; } -static std::unique_ptr -ParseExtensionMetricProducerConfiguration(const std::string &name, - std::unique_ptr node) +std::unique_ptr +ConfigurationParser::ParseExtensionMetricProducerConfiguration( + const std::string &name, + std::unique_ptr node) const { auto model = std::make_unique(); @@ -726,8 +750,8 @@ ParseExtensionMetricProducerConfiguration(const std::string &name, return model; } -static std::unique_ptr ParseMetricProducerConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseMetricProducerConfiguration( + const std::unique_ptr &node) const { std::unique_ptr model; @@ -761,8 +785,9 @@ static std::unique_ptr ParseMetricProducerConfigura return model; } -static std::unique_ptr ParsePeriodicMetricReaderConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParsePeriodicMetricReaderConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -786,8 +811,9 @@ static std::unique_ptr ParsePeriodicMetricRea return model; } -static std::unique_ptr ParsePullMetricReaderConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParsePullMetricReaderConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -808,8 +834,8 @@ static std::unique_ptr ParsePullMetricReaderConfi return model; } -static std::unique_ptr ParseMetricReaderConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseMetricReaderConfiguration( + const std::unique_ptr &node) const { std::unique_ptr model; @@ -849,7 +875,7 @@ static std::unique_ptr ParseMetricReaderConfiguration return model; } -static InstrumentType ParseInstrumentType(const std::string &name) +InstrumentType ConfigurationParser::ParseInstrumentType(const std::string &name) const { if (name == "") { @@ -891,8 +917,8 @@ static InstrumentType ParseInstrumentType(const std::string &name) throw InvalidSchemaException(message); } -static std::unique_ptr ParseViewSelectorConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseViewSelectorConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -909,24 +935,27 @@ static std::unique_ptr ParseViewSelectorConfiguration return model; } -static std::unique_ptr ParseDefaultAggregationConfiguration( - const std::unique_ptr & /* node */) +std::unique_ptr +ConfigurationParser::ParseDefaultAggregationConfiguration( + const std::unique_ptr & /* node */) const { auto model = std::make_unique(); return model; } -static std::unique_ptr ParseDropAggregationConfiguration( - const std::unique_ptr & /* node */) +std::unique_ptr +ConfigurationParser::ParseDropAggregationConfiguration( + const std::unique_ptr & /* node */) const { auto model = std::make_unique(); return model; } -static std::unique_ptr -ParseExplicitBucketHistogramAggregationConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseExplicitBucketHistogramAggregationConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -950,9 +979,9 @@ ParseExplicitBucketHistogramAggregationConfiguration(const std::unique_ptr -ParseBase2ExponentialBucketHistogramAggregationConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseBase2ExponentialBucketHistogramAggregationConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -963,24 +992,25 @@ ParseBase2ExponentialBucketHistogramAggregationConfiguration( return model; } -static std::unique_ptr ParseLastValueAggregationConfiguration( - const std::unique_ptr & /* node */) +std::unique_ptr +ConfigurationParser::ParseLastValueAggregationConfiguration( + const std::unique_ptr & /* node */) const { auto model = std::make_unique(); return model; } -static std::unique_ptr ParseSumAggregationConfiguration( - const std::unique_ptr & /* node */) +std::unique_ptr ConfigurationParser::ParseSumAggregationConfiguration( + const std::unique_ptr & /* node */) const { auto model = std::make_unique(); return model; } -static std::unique_ptr ParseAggregationConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseAggregationConfiguration( + const std::unique_ptr &node) const { std::unique_ptr model; std::unique_ptr child; @@ -1031,8 +1061,8 @@ static std::unique_ptr ParseAggregationConfiguration( return model; } -static std::unique_ptr ParseViewStreamConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseViewStreamConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1056,8 +1086,8 @@ static std::unique_ptr ParseViewStreamConfiguration( return model; } -static std::unique_ptr ParseViewConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseViewConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1071,8 +1101,8 @@ static std::unique_ptr ParseViewConfiguration( return model; } -static std::unique_ptr ParseMeterProviderConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseMeterProviderConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1103,8 +1133,8 @@ static std::unique_ptr ParseMeterProviderConfigurati return model; } -static std::unique_ptr ParsePropagatorConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParsePropagatorConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1147,8 +1177,8 @@ static std::unique_ptr ParsePropagatorConfiguration( return model; } -static std::unique_ptr ParseSpanLimitsConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseSpanLimitsConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1162,22 +1192,20 @@ static std::unique_ptr ParseSpanLimitsConfiguration( return model; } -static std::unique_ptr ParseSamplerConfiguration( - const std::unique_ptr &node, - size_t depth); - -static std::unique_ptr ParseAlwaysOffSamplerConfiguration( +std::unique_ptr +ConfigurationParser::ParseAlwaysOffSamplerConfiguration( const std::unique_ptr & /* node */, - size_t /* depth */) + size_t /* depth */) const { auto model = std::make_unique(); return model; } -static std::unique_ptr ParseAlwaysOnSamplerConfiguration( +std::unique_ptr +ConfigurationParser::ParseAlwaysOnSamplerConfiguration( const std::unique_ptr & /* node */, - size_t /* depth */) + size_t /* depth */) const { auto model = std::make_unique(); @@ -1185,9 +1213,10 @@ static std::unique_ptr ParseAlwaysOnSamplerConfigu } // NOLINTBEGIN(misc-no-recursion) -static std::unique_ptr ParseJaegerRemoteSamplerConfiguration( +std::unique_ptr +ConfigurationParser::ParseJaegerRemoteSamplerConfiguration( const std::unique_ptr &node, - size_t depth) + size_t depth) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1210,9 +1239,9 @@ static std::unique_ptr ParseJaegerRemoteSample // NOLINTEND(misc-no-recursion) // NOLINTBEGIN(misc-no-recursion) -static std::unique_ptr ParseParentBasedSamplerConfiguration( - const std::unique_ptr &node, - size_t depth) +std::unique_ptr +ConfigurationParser::ParseParentBasedSamplerConfiguration(const std::unique_ptr &node, + size_t depth) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1251,9 +1280,10 @@ static std::unique_ptr ParseParentBasedSamplerC } // NOLINTEND(misc-no-recursion) -static std::unique_ptr -ParseTraceIdRatioBasedSamplerConfiguration(const std::unique_ptr &node, - size_t /* depth */) +std::unique_ptr +ConfigurationParser::ParseTraceIdRatioBasedSamplerConfiguration( + const std::unique_ptr &node, + size_t /* depth */) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1263,10 +1293,10 @@ ParseTraceIdRatioBasedSamplerConfiguration(const std::unique_ptr & return model; } -static std::unique_ptr ParseSamplerExtensionConfiguration( - const std::string &name, - std::unique_ptr node, - size_t depth) +std::unique_ptr +ConfigurationParser::ParseSamplerExtensionConfiguration(const std::string &name, + std::unique_ptr node, + size_t depth) const { auto model = std::make_unique(); @@ -1278,9 +1308,9 @@ static std::unique_ptr ParseSamplerExtensionConfi } // NOLINTBEGIN(misc-no-recursion) -static std::unique_ptr ParseSamplerConfiguration( +std::unique_ptr ConfigurationParser::ParseSamplerConfiguration( const std::unique_ptr &node, - size_t depth) + size_t depth) const { /* * ParseSamplerConfiguration() is recursive, @@ -1342,8 +1372,9 @@ static std::unique_ptr ParseSamplerConfiguration( } // NOLINTEND(misc-no-recursion) -static std::unique_ptr ParseOtlpHttpSpanExporterConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseOtlpHttpSpanExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1369,8 +1400,9 @@ static std::unique_ptr ParseOtlpHttpSpanExpor return model; } -static std::unique_ptr ParseOtlpGrpcSpanExporterConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseOtlpGrpcSpanExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1394,8 +1426,9 @@ static std::unique_ptr ParseOtlpGrpcSpanExpor return model; } -static std::unique_ptr ParseOtlpFileSpanExporterConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseOtlpFileSpanExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1405,16 +1438,18 @@ static std::unique_ptr ParseOtlpFileSpanExpor return model; } -static std::unique_ptr ParseConsoleSpanExporterConfiguration( - const std::unique_ptr & /* node */) +std::unique_ptr +ConfigurationParser::ParseConsoleSpanExporterConfiguration( + const std::unique_ptr & /* node */) const { auto model = std::make_unique(); return model; } -static std::unique_ptr ParseZipkinSpanExporterConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseZipkinSpanExporterConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1424,9 +1459,10 @@ static std::unique_ptr ParseZipkinSpanExporterC return model; } -static std::unique_ptr ParseExtensionSpanExporterConfiguration( +std::unique_ptr +ConfigurationParser::ParseExtensionSpanExporterConfiguration( const std::string &name, - std::unique_ptr node) + std::unique_ptr node) const { auto model = std::make_unique(); @@ -1436,8 +1472,8 @@ static std::unique_ptr ParseExtensionSpanExp return model; } -static std::unique_ptr ParseSpanExporterConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseSpanExporterConfiguration( + const std::unique_ptr &node) const { std::unique_ptr model; @@ -1487,8 +1523,9 @@ static std::unique_ptr ParseSpanExporterConfiguration return model; } -static std::unique_ptr ParseBatchSpanProcessorConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseBatchSpanProcessorConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1504,8 +1541,9 @@ static std::unique_ptr ParseBatchSpanProcessorC return model; } -static std::unique_ptr ParseSimpleSpanProcessorConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseSimpleSpanProcessorConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1516,9 +1554,10 @@ static std::unique_ptr ParseSimpleSpanProcesso return model; } -static std::unique_ptr -ParseExtensionSpanProcessorConfiguration(const std::string &name, - std::unique_ptr node) +std::unique_ptr +ConfigurationParser::ParseExtensionSpanProcessorConfiguration( + const std::string &name, + std::unique_ptr node) const { auto model = std::make_unique(); @@ -1528,8 +1567,8 @@ ParseExtensionSpanProcessorConfiguration(const std::string &name, return model; } -static std::unique_ptr ParseSpanProcessorConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseSpanProcessorConfiguration( + const std::unique_ptr &node) const { std::unique_ptr model; @@ -1567,8 +1606,8 @@ static std::unique_ptr ParseSpanProcessorConfigurati return model; } -static std::unique_ptr ParseTracerProviderConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseTracerProviderConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1602,8 +1641,9 @@ static std::unique_ptr ParseTracerProviderConfigura return model; } -static std::unique_ptr ParseStringAttributeValueConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseStringAttributeValueConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1612,8 +1652,9 @@ static std::unique_ptr ParseStringAttributeVa return model; } -static std::unique_ptr ParseIntegerAttributeValueConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseIntegerAttributeValueConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1622,8 +1663,9 @@ static std::unique_ptr ParseIntegerAttribute return model; } -static std::unique_ptr ParseDoubleAttributeValueConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseDoubleAttributeValueConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1632,8 +1674,9 @@ static std::unique_ptr ParseDoubleAttributeVa return model; } -static std::unique_ptr ParseBooleanAttributeValueConfiguration( - const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseBooleanAttributeValueConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1642,8 +1685,9 @@ static std::unique_ptr ParseBooleanAttribute return model; } -static std::unique_ptr -ParseStringArrayAttributeValueConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseStringArrayAttributeValueConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1659,8 +1703,9 @@ ParseStringArrayAttributeValueConfiguration(const std::unique_ptr return model; } -static std::unique_ptr -ParseIntegerArrayAttributeValueConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseIntegerArrayAttributeValueConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1676,8 +1721,9 @@ ParseIntegerArrayAttributeValueConfiguration(const std::unique_ptr return model; } -static std::unique_ptr -ParseDoubleArrayAttributeValueConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseDoubleArrayAttributeValueConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1693,8 +1739,9 @@ ParseDoubleArrayAttributeValueConfiguration(const std::unique_ptr return model; } -static std::unique_ptr -ParseBooleanArrayAttributeValueConfiguration(const std::unique_ptr &node) +std::unique_ptr +ConfigurationParser::ParseBooleanArrayAttributeValueConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); @@ -1710,8 +1757,8 @@ ParseBooleanArrayAttributeValueConfiguration(const std::unique_ptr return model; } -static std::unique_ptr ParseAttributesConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseAttributesConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1798,8 +1845,8 @@ static std::unique_ptr ParseAttributesConfiguration( return model; } -static std::unique_ptr ParseResourceConfiguration( - const std::unique_ptr &node) +std::unique_ptr ConfigurationParser::ParseResourceConfiguration( + const std::unique_ptr &node) const { auto model = std::make_unique(); std::unique_ptr child; @@ -1829,7 +1876,40 @@ std::unique_ptr ConfigurationParser::Parse(std::unique_ptr(std::move(doc)); model->file_format = node->GetRequiredString("file_format"); - model->disabled = node->GetBoolean("disabled", false); + + { + int count; + int major; + int minor; + + count = sscanf(model->file_format.c_str(), "%d.%d", &major, &minor); + if (count != 2) + { + std::string message("Invalid file_format"); + throw InvalidSchemaException(message); + } + + if (major != 1) + { + std::string message("Unsupported file_format, major = "); + message.append(std::to_string(major)); + throw InvalidSchemaException(message); + } + + if (minor != 0) + { + std::string message("Unsupported file_format, major = "); + message.append(std::to_string(major)); + message.append(", minor = "); + message.append(std::to_string(minor)); + throw InvalidSchemaException(message); + } + + version_major_ = major; + version_minor_ = minor; + } + + model->disabled = node->GetBoolean("disabled", false); std::unique_ptr child; diff --git a/sdk/src/configuration/sdk_builder.cc b/sdk/src/configuration/sdk_builder.cc index 0da1af86dc..ecbf9c4165 100644 --- a/sdk/src/configuration/sdk_builder.cc +++ b/sdk/src/configuration/sdk_builder.cc @@ -187,7 +187,9 @@ class ResourceAttributeValueSetter void VisitInteger( const opentelemetry::sdk::configuration::IntegerAttributeValueConfiguration *model) override { - opentelemetry::common::AttributeValue attribute_value(model->value); + /* Provide exact type to opentelemetry::common::AttributeValue variant. */ + int64_t value = model->value; + opentelemetry::common::AttributeValue attribute_value(value); resource_attributes_.SetAttribute(name_, attribute_value); } diff --git a/sdk/src/configuration/yaml_configuration_parser.cc b/sdk/src/configuration/yaml_configuration_parser.cc index 627849362e..665efa927a 100644 --- a/sdk/src/configuration/yaml_configuration_parser.cc +++ b/sdk/src/configuration/yaml_configuration_parser.cc @@ -66,6 +66,7 @@ std::unique_ptr YamlConfigurationParser::ParseString(const std::s { std::unique_ptr doc; std::unique_ptr config; + ConfigurationParser config_parser; doc = RymlDocument::Parse(source, content); @@ -73,7 +74,7 @@ std::unique_ptr YamlConfigurationParser::ParseString(const std::s { if (doc) { - config = ConfigurationParser::Parse(std::move(doc)); + config = config_parser.Parse(std::move(doc)); } } catch (const std::exception &e) diff --git a/sdk/test/configuration/yaml_logs_test.cc b/sdk/test/configuration/yaml_logs_test.cc index b38c7c58ed..b74b502c75 100644 --- a/sdk/test/configuration/yaml_logs_test.cc +++ b/sdk/test/configuration/yaml_logs_test.cc @@ -30,7 +30,7 @@ static std::unique_ptr DoParse TEST(YamlLogs, no_processors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: )"; @@ -41,7 +41,7 @@ file_format: xx.yy TEST(YamlLogs, empty_processors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: )"; @@ -53,7 +53,7 @@ file_format: xx.yy TEST(YamlLogs, many_processors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -73,7 +73,7 @@ file_format: xx.yy TEST(YamlLogs, simple_processor) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -98,7 +98,7 @@ file_format: xx.yy TEST(YamlLogs, default_batch_processor) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - batch: @@ -127,7 +127,7 @@ file_format: xx.yy TEST(YamlLogs, batch_processor) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - batch: @@ -160,7 +160,7 @@ file_format: xx.yy TEST(YamlLogs, default_otlp_http) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -198,7 +198,7 @@ file_format: xx.yy TEST(YamlLogs, otlp_http) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -251,7 +251,7 @@ file_format: xx.yy TEST(YamlLogs, default_otlp_grpc) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -289,7 +289,7 @@ file_format: xx.yy TEST(YamlLogs, otlp_grpc) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -342,7 +342,7 @@ file_format: xx.yy TEST(YamlLogs, default_otlp_file) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -371,7 +371,7 @@ file_format: xx.yy TEST(YamlLogs, otlp_file) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -401,7 +401,7 @@ file_format: xx.yy TEST(YamlLogs, otlp_console) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -426,7 +426,7 @@ file_format: xx.yy TEST(YamlLogs, no_limits) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -443,7 +443,7 @@ file_format: xx.yy TEST(YamlLogs, default_limits) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: @@ -463,7 +463,7 @@ file_format: xx.yy TEST(YamlLogs, limits) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-logs" logger_provider: processors: - simple: diff --git a/sdk/test/configuration/yaml_metrics_test.cc b/sdk/test/configuration/yaml_metrics_test.cc index 4b202c2cf1..f063c55145 100644 --- a/sdk/test/configuration/yaml_metrics_test.cc +++ b/sdk/test/configuration/yaml_metrics_test.cc @@ -40,7 +40,7 @@ static std::unique_ptr DoParse TEST(YamlMetrics, no_readers) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: )"; @@ -51,7 +51,7 @@ file_format: xx.yy TEST(YamlMetrics, empty_readers) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: )"; @@ -63,7 +63,7 @@ file_format: xx.yy TEST(YamlMetrics, many_readers) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -83,7 +83,7 @@ file_format: xx.yy TEST(YamlMetrics, default_periodic_reader) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -110,7 +110,7 @@ file_format: xx.yy TEST(YamlMetrics, periodic_reader) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -139,7 +139,7 @@ file_format: xx.yy TEST(YamlMetrics, pull_reader) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - pull: @@ -163,7 +163,7 @@ file_format: xx.yy TEST(YamlMetrics, default_otlp_http) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -205,7 +205,7 @@ file_format: xx.yy TEST(YamlMetrics, otlp_http) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -264,7 +264,7 @@ file_format: xx.yy TEST(YamlMetrics, default_otlp_grpc) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -306,7 +306,7 @@ file_format: xx.yy TEST(YamlMetrics, otlp_grpc) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -365,7 +365,7 @@ file_format: xx.yy TEST(YamlMetrics, default_otlp_file) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -398,7 +398,7 @@ file_format: xx.yy TEST(YamlMetrics, otlp_file) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -434,7 +434,7 @@ file_format: xx.yy TEST(YamlMetrics, default_console) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -473,7 +473,7 @@ file_format: xx.yy TEST(YamlMetrics, console) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -514,7 +514,7 @@ file_format: xx.yy TEST(YamlMetrics, default_prometheus) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - pull: @@ -545,7 +545,7 @@ file_format: xx.yy TEST(YamlMetrics, prometheus) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - pull: @@ -581,7 +581,7 @@ file_format: xx.yy TEST(YamlMetrics, empty_views) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -599,7 +599,7 @@ file_format: xx.yy TEST(YamlMetrics, default_views) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -635,7 +635,7 @@ file_format: xx.yy TEST(YamlMetrics, selector) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -677,7 +677,7 @@ file_format: xx.yy TEST(YamlMetrics, stream) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -716,7 +716,7 @@ file_format: xx.yy TEST(YamlMetrics, stream_aggregation_default) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -744,7 +744,7 @@ file_format: xx.yy TEST(YamlMetrics, stream_aggregation_drop) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -772,7 +772,7 @@ file_format: xx.yy TEST(YamlMetrics, stream_aggregation_explicit_bucket_histogram) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -814,7 +814,7 @@ file_format: xx.yy TEST(YamlMetrics, stream_aggregation_base2_exponential_bucket_histogram) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -852,7 +852,7 @@ file_format: xx.yy TEST(YamlMetrics, stream_aggregation_last_value) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -880,7 +880,7 @@ file_format: xx.yy TEST(YamlMetrics, stream_aggregation_sum) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: @@ -908,7 +908,7 @@ file_format: xx.yy TEST(YamlMetrics, stream_attribute_keys) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-metrics" meter_provider: readers: - periodic: diff --git a/sdk/test/configuration/yaml_propagator_test.cc b/sdk/test/configuration/yaml_propagator_test.cc index cba8bde4da..78daf6dfae 100644 --- a/sdk/test/configuration/yaml_propagator_test.cc +++ b/sdk/test/configuration/yaml_propagator_test.cc @@ -20,7 +20,7 @@ static std::unique_ptr DoParse TEST(YamlPropagator, empty_propagator) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-propagator" propagator: )"; @@ -34,7 +34,7 @@ file_format: xx.yy TEST(YamlPropagator, empty_composite) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-propagator" propagator: composite: )"; @@ -50,7 +50,7 @@ TEST(YamlPropagator, old_propagator_1) { // This is the old format, must fail std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-propagator" propagator: composite: - foo @@ -65,7 +65,7 @@ TEST(YamlPropagator, old_propagator_2) { // This is the old format, must fail std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-propagator" propagator: composite: [foo, bar] )"; @@ -77,7 +77,7 @@ file_format: xx.yy TEST(YamlPropagator, propagator_array_ok) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-propagator" propagator: composite: - foo: @@ -98,7 +98,7 @@ file_format: xx.yy TEST(YamlPropagator, propagator_array_broken) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-propagator" propagator: composite: - foo: @@ -113,7 +113,7 @@ file_format: xx.yy TEST(YamlPropagator, propagator_composite_list) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-propagator" propagator: composite_list: "foo,bar,baz" )"; @@ -128,7 +128,7 @@ file_format: xx.yy TEST(YamlPropagator, propagator_both) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-propagator" propagator: composite: - aaa: @@ -150,7 +150,7 @@ file_format: xx.yy TEST(YamlPropagator, propagator_duplicates) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-propagator" propagator: composite: - aaa: diff --git a/sdk/test/configuration/yaml_resource_test.cc b/sdk/test/configuration/yaml_resource_test.cc index 69386928e3..87685277af 100644 --- a/sdk/test/configuration/yaml_resource_test.cc +++ b/sdk/test/configuration/yaml_resource_test.cc @@ -26,7 +26,7 @@ static std::unique_ptr DoParse TEST(YamlResource, empty_resource) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: )"; @@ -41,7 +41,7 @@ file_format: xx.yy TEST(YamlResource, empty_attributes) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: attributes: )"; @@ -57,7 +57,7 @@ TEST(YamlResource, some_attributes_0_10) { // This is the old 0.10 format, must fail std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: attributes: foo: "1234" @@ -72,7 +72,7 @@ TEST(YamlResource, some_attributes_0_30) { // This is the new 0.30 format, must pass std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: attributes: - name: foo @@ -111,7 +111,7 @@ file_format: xx.yy TEST(YamlResource, empty_attributes_list) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: attributes_list: )"; @@ -125,7 +125,7 @@ file_format: xx.yy TEST(YamlResource, some_attributes_list) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: attributes_list: "foo=1234,bar=5678" )"; @@ -140,7 +140,7 @@ TEST(YamlResource, both_0_10) { // This is the old 0.10 format, must fail std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: attributes: foo: "1234" @@ -156,7 +156,7 @@ TEST(YamlResource, both_0_30) { // This is the new 0.30 format, must pass std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: attributes: - name: foo @@ -198,7 +198,7 @@ file_format: xx.yy TEST(YamlResource, empty_detectors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: detectors: )"; @@ -214,7 +214,7 @@ file_format: xx.yy TEST(YamlResource, empty_included_detectors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: detectors: included: @@ -232,7 +232,7 @@ file_format: xx.yy TEST(YamlResource, some_included_detectors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: detectors: included: @@ -254,7 +254,7 @@ file_format: xx.yy TEST(YamlResource, some_excluded_detectors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: detectors: excluded: @@ -276,7 +276,7 @@ file_format: xx.yy TEST(YamlResource, some_detectors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-resource" resource: detectors: included: diff --git a/sdk/test/configuration/yaml_test.cc b/sdk/test/configuration/yaml_test.cc index 6a62f65429..9b8f2212f9 100644 --- a/sdk/test/configuration/yaml_test.cc +++ b/sdk/test/configuration/yaml_test.cc @@ -12,6 +12,12 @@ #include "opentelemetry/sdk/configuration/tracer_provider_configuration.h" #include "opentelemetry/sdk/configuration/yaml_configuration_parser.h" +#if defined(_MSC_VER) +# include "opentelemetry/sdk/common/env_variables.h" +using opentelemetry::sdk::common::setenv; +using opentelemetry::sdk::common::unsetenv; +#endif + static std::unique_ptr DoParse( const std::string &yaml) { @@ -37,59 +43,109 @@ TEST(Yaml, no_format) ASSERT_EQ(config, nullptr); } +TEST(Yaml, broken_format) +{ + std::string yaml = R"( +file_format: "xx.yy" +)"; + + auto config = DoParse(yaml); + ASSERT_EQ(config, nullptr); +} + +TEST(Yaml, broken_minor_format) +{ + std::string yaml = R"( +file_format: "1.yy" +)"; + + auto config = DoParse(yaml); + ASSERT_EQ(config, nullptr); +} + +TEST(Yaml, unsupported_old_format) +{ + std::string yaml = R"( +file_format: "0.99" +)"; + + auto config = DoParse(yaml); + ASSERT_EQ(config, nullptr); +} + +TEST(Yaml, unsupported_new_major_format) +{ + std::string yaml = R"( +file_format: "2.0" +)"; + + auto config = DoParse(yaml); + ASSERT_EQ(config, nullptr); +} + +TEST(Yaml, unsupported_new_minor_format) +{ + std::string yaml = R"( +file_format: "1.1" +)"; + + auto config = DoParse(yaml); + ASSERT_EQ(config, nullptr); +} + TEST(Yaml, just_format) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-rc.1" )"; auto config = DoParse(yaml); ASSERT_NE(config, nullptr); - ASSERT_EQ(config->file_format, "xx.yy"); + ASSERT_EQ(config->file_format, "1.0-rc.1"); } TEST(Yaml, disabled) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0" disabled: true )"; auto config = DoParse(yaml); ASSERT_NE(config, nullptr); - ASSERT_EQ(config->file_format, "xx.yy"); + ASSERT_EQ(config->file_format, "1.0"); ASSERT_EQ(config->disabled, true); } TEST(Yaml, enabled) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0" disabled: false )"; auto config = DoParse(yaml); ASSERT_NE(config, nullptr); - ASSERT_EQ(config->file_format, "xx.yy"); + ASSERT_EQ(config->file_format, "1.0"); ASSERT_EQ(config->disabled, false); } TEST(Yaml, enabled_by_default) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0" )"; auto config = DoParse(yaml); ASSERT_NE(config, nullptr); - ASSERT_EQ(config->file_format, "xx.yy"); + ASSERT_EQ(config->file_format, "1.0"); ASSERT_EQ(config->disabled, false); } TEST(Yaml, no_attribute_limits) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0" )"; auto config = DoParse(yaml); @@ -100,13 +156,13 @@ file_format: xx.yy TEST(Yaml, empty_attribute_limits) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0" attribute_limits: )"; auto config = DoParse(yaml); ASSERT_NE(config, nullptr); - ASSERT_EQ(config->file_format, "xx.yy"); + ASSERT_EQ(config->file_format, "1.0"); ASSERT_NE(config->attribute_limits, nullptr); ASSERT_EQ(config->attribute_limits->attribute_value_length_limit, 4096); ASSERT_EQ(config->attribute_limits->attribute_count_limit, 128); @@ -115,7 +171,7 @@ file_format: xx.yy TEST(Yaml, attribute_limits) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0" attribute_limits: attribute_value_length_limit: 1234 attribute_count_limit: 5678 @@ -123,7 +179,7 @@ file_format: xx.yy auto config = DoParse(yaml); ASSERT_NE(config, nullptr); - ASSERT_EQ(config->file_format, "xx.yy"); + ASSERT_EQ(config->file_format, "1.0"); ASSERT_NE(config->attribute_limits, nullptr); ASSERT_EQ(config->attribute_limits->attribute_value_length_limit, 1234); ASSERT_EQ(config->attribute_limits->attribute_count_limit, 5678); @@ -132,7 +188,7 @@ file_format: xx.yy TEST(Yaml, no_optional_boolean) { std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: )"; @@ -144,7 +200,7 @@ file_format: 0.0 TEST(Yaml, illegal_boolean) { std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: illegal )"; @@ -157,7 +213,7 @@ TEST(Yaml, no_boolean_substitution) unsetenv("ENV_NAME"); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${ENV_NAME} )"; @@ -171,7 +227,7 @@ TEST(Yaml, no_boolean_substitution_env) unsetenv("ENV_NAME"); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${env:ENV_NAME} )"; @@ -185,7 +241,7 @@ TEST(Yaml, empty_boolean_substitution) setenv("ENV_NAME", "", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${ENV_NAME} )"; @@ -199,7 +255,7 @@ TEST(Yaml, empty_boolean_substitution_env) setenv("ENV_NAME", "", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${env:ENV_NAME} )"; @@ -213,7 +269,7 @@ TEST(Yaml, true_boolean_substitution) setenv("ENV_NAME", "true", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${ENV_NAME} )"; @@ -227,7 +283,7 @@ TEST(Yaml, false_boolean_substitution) setenv("ENV_NAME", "false", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${ENV_NAME} )"; @@ -241,7 +297,7 @@ TEST(Yaml, illegal_boolean_substitution) setenv("ENV_NAME", "illegal", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${ENV_NAME} )"; @@ -254,7 +310,7 @@ TEST(Yaml, empty_boolean_substitution_fallback) unsetenv("ENV_NAME"); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${ENV_NAME:-} )"; @@ -268,7 +324,7 @@ TEST(Yaml, true_boolean_substitution_fallback) unsetenv("ENV_NAME"); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${ENV_NAME:-true} )"; @@ -282,7 +338,7 @@ TEST(Yaml, false_boolean_substitution_fallback) unsetenv("ENV_NAME"); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${ENV_NAME:-false} )"; @@ -296,7 +352,7 @@ TEST(Yaml, illegal_boolean_substitution_fallback) unsetenv("ENV_NAME"); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${ENV_NAME:-illegal} )"; @@ -309,7 +365,7 @@ TEST(Yaml, torture_boolean_substitution_fallback) setenv("env", "true", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" disabled: ${env:-false} )"; @@ -378,7 +434,7 @@ file_format: ${env:ENV_NAME} TEST(Yaml, with_string_substitution) { - setenv("ENV_NAME", "foo.bar", 1); + setenv("ENV_NAME", "1.0-substitution", 1); std::string yaml = R"( file_format: ${ENV_NAME} @@ -386,12 +442,12 @@ file_format: ${ENV_NAME} auto config = DoParse(yaml); ASSERT_NE(config, nullptr); - ASSERT_EQ(config->file_format, "foo.bar"); + ASSERT_EQ(config->file_format, "1.0-substitution"); } TEST(Yaml, with_string_substitution_env) { - setenv("ENV_NAME", "foo.bar", 1); + setenv("ENV_NAME", "1.0-substitution", 1); std::string yaml = R"( file_format: ${env:ENV_NAME} @@ -399,7 +455,7 @@ file_format: ${env:ENV_NAME} auto config = DoParse(yaml); ASSERT_NE(config, nullptr); - ASSERT_EQ(config->file_format, "foo.bar"); + ASSERT_EQ(config->file_format, "1.0-substitution"); } TEST(Yaml, with_string_substitution_fallback) @@ -407,19 +463,19 @@ TEST(Yaml, with_string_substitution_fallback) unsetenv("ENV_NAME"); std::string yaml = R"( -file_format: ${env:ENV_NAME:-foo.bar} +file_format: ${env:ENV_NAME:-1.0-fallback} )"; auto config = DoParse(yaml); ASSERT_NE(config, nullptr); - ASSERT_EQ(config->file_format, "foo.bar"); + ASSERT_EQ(config->file_format, "1.0-fallback"); } TEST(Yaml, multiple_string_substitution) { - setenv("PREFIX", "foo", 1); + setenv("PREFIX", "1", 1); unsetenv("DOT"); - setenv("SUFFIX", "bar", 1); + setenv("SUFFIX", "0", 1); std::string yaml = R"( file_format: ${env:PREFIX:-failed}${DOT:-.}${SUFFIX:-failed} @@ -427,13 +483,13 @@ file_format: ${env:PREFIX:-failed}${DOT:-.}${SUFFIX:-failed} auto config = DoParse(yaml); ASSERT_NE(config, nullptr); - ASSERT_EQ(config->file_format, "foo.bar"); + ASSERT_EQ(config->file_format, "1.0"); } TEST(Yaml, no_optional_integer) { std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" attribute_limits: attribute_count_limit: )"; @@ -447,7 +503,7 @@ file_format: 0.0 TEST(Yaml, illegal_integer) { std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" attribute_limits: attribute_count_limit: "just enough" )"; @@ -461,7 +517,7 @@ TEST(Yaml, no_integer_substitution) unsetenv("ENV_NAME"); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" attribute_limits: attribute_count_limit: ${ENV_NAME} )"; @@ -477,7 +533,7 @@ TEST(Yaml, empty_integer_substitution) setenv("ENV_NAME", "", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" attribute_limits: attribute_count_limit: ${ENV_NAME} )"; @@ -493,7 +549,7 @@ TEST(Yaml, with_integer_substitution) setenv("ENV_NAME", "7777", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" attribute_limits: attribute_count_limit: ${ENV_NAME} )"; @@ -509,7 +565,7 @@ TEST(Yaml, with_illegal_integer_substitution) setenv("ENV_NAME", "still not enough", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" attribute_limits: attribute_count_limit: ${ENV_NAME} )"; @@ -521,7 +577,7 @@ file_format: 0.0 TEST(Yaml, no_optional_double) { std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" tracer_provider: processors: - simple: @@ -546,7 +602,7 @@ file_format: 0.0 TEST(Yaml, illegal_double) { std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" tracer_provider: processors: - simple: @@ -566,7 +622,7 @@ TEST(Yaml, no_double_substitution) unsetenv("ENV_NAME"); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" tracer_provider: processors: - simple: @@ -593,7 +649,7 @@ TEST(Yaml, empty_double_substitution) setenv("ENV_NAME", "", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" tracer_provider: processors: - simple: @@ -620,7 +676,7 @@ TEST(Yaml, with_double_substitution) setenv("ENV_NAME", "3.14", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" tracer_provider: processors: - simple: @@ -647,7 +703,7 @@ TEST(Yaml, with_illegal_double_substitution) setenv("ENV_NAME", "something else", 1); std::string yaml = R"( -file_format: 0.0 +file_format: "1.0" tracer_provider: processors: - simple: diff --git a/sdk/test/configuration/yaml_trace_test.cc b/sdk/test/configuration/yaml_trace_test.cc index f5f53c7419..3cbc7294a2 100644 --- a/sdk/test/configuration/yaml_trace_test.cc +++ b/sdk/test/configuration/yaml_trace_test.cc @@ -34,7 +34,7 @@ static std::unique_ptr DoParse TEST(YamlTrace, no_processors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: )"; @@ -45,7 +45,7 @@ file_format: xx.yy TEST(YamlTrace, empty_processors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: )"; @@ -57,7 +57,7 @@ file_format: xx.yy TEST(YamlTrace, many_processors) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -77,7 +77,7 @@ file_format: xx.yy TEST(YamlTrace, simple_processor) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -102,7 +102,7 @@ file_format: xx.yy TEST(YamlTrace, default_batch_processor) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - batch: @@ -131,7 +131,7 @@ file_format: xx.yy TEST(YamlTrace, batch_processor) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - batch: @@ -164,7 +164,7 @@ file_format: xx.yy TEST(YamlTrace, default_otlp_http) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -202,7 +202,7 @@ file_format: xx.yy TEST(YamlTrace, otlp_http) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -255,7 +255,7 @@ file_format: xx.yy TEST(YamlTrace, default_otlp_grpc) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -293,7 +293,7 @@ file_format: xx.yy TEST(YamlTrace, otlp_grpc) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -346,7 +346,7 @@ file_format: xx.yy TEST(YamlTrace, default_otlp_file) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -375,7 +375,7 @@ file_format: xx.yy TEST(YamlTrace, otlp_file) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -405,7 +405,7 @@ file_format: xx.yy TEST(YamlTrace, otlp_console) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -430,7 +430,7 @@ file_format: xx.yy TEST(YamlTrace, default_otlp_zipkin) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -461,7 +461,7 @@ file_format: xx.yy TEST(YamlTrace, otlp_zipkin) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -493,7 +493,7 @@ file_format: xx.yy TEST(YamlTrace, no_limits) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -510,7 +510,7 @@ file_format: xx.yy TEST(YamlTrace, default_limits) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -534,7 +534,7 @@ file_format: xx.yy TEST(YamlTrace, limits) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -564,7 +564,7 @@ file_format: xx.yy TEST(YamlTrace, no_sampler) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -581,7 +581,7 @@ file_format: xx.yy TEST(YamlTrace, empty_sampler) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -597,7 +597,7 @@ file_format: xx.yy TEST(YamlTrace, many_sampler) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -615,7 +615,7 @@ file_format: xx.yy TEST(YamlTrace, always_off_sampler) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -634,7 +634,7 @@ file_format: xx.yy TEST(YamlTrace, always_on_sampler) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -653,7 +653,7 @@ file_format: xx.yy TEST(YamlTrace, jaeger_remote_sampler) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -683,7 +683,7 @@ file_format: xx.yy TEST(YamlTrace, default_parent_based_sampler) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -711,7 +711,7 @@ file_format: xx.yy TEST(YamlTrace, parent_based_sampler) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -749,7 +749,7 @@ file_format: xx.yy TEST(YamlTrace, default_trace_id_ratio_based_sampler) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: @@ -773,7 +773,7 @@ file_format: xx.yy TEST(YamlTrace, trace_id_ratio_based_sampler) { std::string yaml = R"( -file_format: xx.yy +file_format: "1.0-trace" tracer_provider: processors: - simple: