From a6b8a5a2a75b89d682ff7e088370138e7ffaf22c Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Tue, 7 Nov 2023 17:45:33 -0600 Subject: [PATCH] WIP, created the functions file --- .../configuration/_internal/configurator.py | 52 +- .../tests/data/schema_paths_functions.py | 800 ++++++++++++++++++ prototypes/python/tests/test_configuration.py | 21 +- 3 files changed, 870 insertions(+), 3 deletions(-) create mode 100644 prototypes/python/tests/data/schema_paths_functions.py diff --git a/prototypes/python/src/opentelemetry/configuration/_internal/configurator.py b/prototypes/python/src/opentelemetry/configuration/_internal/configurator.py index 07ac3d0..b8e69f4 100644 --- a/prototypes/python/src/opentelemetry/configuration/_internal/configurator.py +++ b/prototypes/python/src/opentelemetry/configuration/_internal/configurator.py @@ -15,7 +15,7 @@ from os.path import exists from pathlib import Path from os import getcwd -from json import loads +from json import loads, dumps from jsonschema.validators import Draft202012Validator from referencing import Registry, Resource from opentelemetry.configuration._internal.yaml_parser import YAMLParser @@ -214,6 +214,11 @@ def traverse(schema_dictionary, schema_path, schema_paths): schema_dictionary.items() ): + if schema_dictionary_key == "sampler": + # This is because there are recursive samplers that crash this + # algorithm. + continue + if isinstance(schema_dictionary_value, dict): if schema_dictionary_key in schema_dictionary.keys(): schema_dictionary_key = schema_dictionary_key @@ -243,6 +248,51 @@ def traverse(schema_dictionary, schema_path, schema_paths): schema_path.pop() schema_paths = [] + traverse(schema_dictionary, [], schema_paths) + schema_paths.pop(0) + return schema_paths + + +def write_schema_paths_functions( + schema_paths: list, schema_paths_functions_file_path: str +): + + schema_paths_function_names = {} + + for schema_path in schema_paths: + + schema_paths_function_names[schema_path] = ( + schema_path. + replace("properties/", ""). + replace("items/", ""). + replace("/", "_") + ) + + schema_paths_functions = dumps(schema_paths_function_names, indent=4) + + schema_paths_functions = schema_paths_functions.replace(': "', ": ") + schema_paths_functions = schema_paths_functions.replace('",', ",") + schema_paths_functions = schema_paths_functions.replace('"\n', "\n") + + with open(schema_paths_functions_file_path, "w") as ( + schema_paths_functions_file + ): + schema_paths_functions_file.write("# flake8: noqa: E501\n") + + for function_name in schema_paths_function_names.values(): + schema_paths_functions_file.write("\n") + schema_paths_functions_file.write("\n") + schema_paths_functions_file.write( + f"def {function_name}(*args, **kwargs):\n" + ) + schema_paths_functions_file.write(" pass\n") + + schema_paths_functions_file.write("\n") + schema_paths_functions_file.write("\n") + + schema_paths_functions_file.write( + f"path_function = {schema_paths_functions}" + ) diff --git a/prototypes/python/tests/data/schema_paths_functions.py b/prototypes/python/tests/data/schema_paths_functions.py new file mode 100644 index 0000000..69f2b35 --- /dev/null +++ b/prototypes/python/tests/data/schema_paths_functions.py @@ -0,0 +1,800 @@ +# flake8: noqa: E501 + + +def file_format(*args, **kwargs): + pass + + +def disabled(*args, **kwargs): + pass + + +def attribute_limits(*args, **kwargs): + pass + + +def attribute_limits_attribute_value_length_limit(*args, **kwargs): + pass + + +def attribute_limits_attribute_count_limit(*args, **kwargs): + pass + + +def logger_provider(*args, **kwargs): + pass + + +def logger_provider_processors(*args, **kwargs): + pass + + +def logger_provider_processors_batch(*args, **kwargs): + pass + + +def logger_provider_processors_batch_schedule_delay(*args, **kwargs): + pass + + +def logger_provider_processors_batch_export_timeout(*args, **kwargs): + pass + + +def logger_provider_processors_batch_max_queue_size(*args, **kwargs): + pass + + +def logger_provider_processors_batch_max_export_batch_size(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp_protocol(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp_endpoint(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp_certificate(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp_client_key(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp_client_certificate(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp_headers(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp_headers_patternProperties(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp_headers_patternProperties_.*(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp_compression(*args, **kwargs): + pass + + +def logger_provider_processors_batch_exporter_otlp_timeout(*args, **kwargs): + pass + + +def logger_provider_processors_simple(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp_protocol(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp_endpoint(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp_certificate(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp_client_key(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp_client_certificate(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp_headers(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp_headers_patternProperties(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp_headers_patternProperties_.*(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp_compression(*args, **kwargs): + pass + + +def logger_provider_processors_simple_exporter_otlp_timeout(*args, **kwargs): + pass + + +def logger_provider_limits(*args, **kwargs): + pass + + +def logger_provider_limits_attribute_value_length_limit(*args, **kwargs): + pass + + +def logger_provider_limits_attribute_count_limit(*args, **kwargs): + pass + + +def meter_provider(*args, **kwargs): + pass + + +def meter_provider_readers(*args, **kwargs): + pass + + +def meter_provider_readers_periodic(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_interval(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_timeout(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_protocol(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_endpoint(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_certificate(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_client_key(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_client_certificate(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_headers(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_headers_patternProperties(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_headers_patternProperties_.*(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_compression(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_timeout(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_temporality_preference(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_otlp_default_histogram_aggregation(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_console(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_prometheus(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_prometheus_host(*args, **kwargs): + pass + + +def meter_provider_readers_periodic_exporter_prometheus_port(*args, **kwargs): + pass + + +def meter_provider_readers_pull(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_protocol(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_endpoint(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_certificate(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_client_key(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_client_certificate(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_headers(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_headers_patternProperties(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_headers_patternProperties_.*(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_compression(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_timeout(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_temporality_preference(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_otlp_default_histogram_aggregation(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_console(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_prometheus(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_prometheus_host(*args, **kwargs): + pass + + +def meter_provider_readers_pull_exporter_prometheus_port(*args, **kwargs): + pass + + +def meter_provider_views(*args, **kwargs): + pass + + +def meter_provider_views_selector(*args, **kwargs): + pass + + +def meter_provider_views_selector_instrument_name(*args, **kwargs): + pass + + +def meter_provider_views_selector_instrument_type(*args, **kwargs): + pass + + +def meter_provider_views_selector_unit(*args, **kwargs): + pass + + +def meter_provider_views_selector_meter_name(*args, **kwargs): + pass + + +def meter_provider_views_selector_meter_version(*args, **kwargs): + pass + + +def meter_provider_views_selector_meter_schema_url(*args, **kwargs): + pass + + +def meter_provider_views_stream(*args, **kwargs): + pass + + +def meter_provider_views_stream_name(*args, **kwargs): + pass + + +def meter_provider_views_stream_description(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_default(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_drop(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_explicit_bucket_histogram(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_explicit_bucket_histogram_boundaries(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_explicit_bucket_histogram_record_min_max(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_base2_exponential_bucket_histogram(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_base2_exponential_bucket_histogram_max_scale(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_base2_exponential_bucket_histogram_max_size(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_base2_exponential_bucket_histogram_record_min_max(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_last_value(*args, **kwargs): + pass + + +def meter_provider_views_stream_aggregation_sum(*args, **kwargs): + pass + + +def meter_provider_views_stream_attribute_keys(*args, **kwargs): + pass + + +def propagator(*args, **kwargs): + pass + + +def propagator_composite(*args, **kwargs): + pass + + +def tracer_provider(*args, **kwargs): + pass + + +def tracer_provider_processors(*args, **kwargs): + pass + + +def tracer_provider_processors_batch(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_schedule_delay(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_export_timeout(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_max_queue_size(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_max_export_batch_size(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp_protocol(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp_endpoint(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp_certificate(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp_client_key(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp_client_certificate(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp_headers(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp_headers_patternProperties(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp_headers_patternProperties_.*(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp_compression(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_otlp_timeout(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_console(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_zipkin(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_zipkin_endpoint(*args, **kwargs): + pass + + +def tracer_provider_processors_batch_exporter_zipkin_timeout(*args, **kwargs): + pass + + +def tracer_provider_processors_simple(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp_protocol(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp_endpoint(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp_certificate(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp_client_key(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp_client_certificate(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp_headers(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp_headers_patternProperties(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp_headers_patternProperties_.*(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp_compression(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_otlp_timeout(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_console(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_zipkin(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_zipkin_endpoint(*args, **kwargs): + pass + + +def tracer_provider_processors_simple_exporter_zipkin_timeout(*args, **kwargs): + pass + + +def tracer_provider_limits(*args, **kwargs): + pass + + +def tracer_provider_limits_attribute_value_length_limit(*args, **kwargs): + pass + + +def tracer_provider_limits_attribute_count_limit(*args, **kwargs): + pass + + +def tracer_provider_limits_event_count_limit(*args, **kwargs): + pass + + +def tracer_provider_limits_link_count_limit(*args, **kwargs): + pass + + +def tracer_provider_limits_event_attribute_count_limit(*args, **kwargs): + pass + + +def tracer_provider_limits_link_attribute_count_limit(*args, **kwargs): + pass + + +def resource(*args, **kwargs): + pass + + +def resource_attributes(*args, **kwargs): + pass + + +def resource_attributes_service.name(*args, **kwargs): + pass + + +def resource_schema_url(*args, **kwargs): + pass + + +path_function = { + "properties/file_format": file_format, + "properties/disabled": disabled, + "properties/attribute_limits": attribute_limits, + "properties/attribute_limits/properties/attribute_value_length_limit": attribute_limits_attribute_value_length_limit, + "properties/attribute_limits/properties/attribute_count_limit": attribute_limits_attribute_count_limit, + "properties/logger_provider": logger_provider, + "properties/logger_provider/properties/processors": logger_provider_processors, + "properties/logger_provider/properties/processors/items/properties/batch": logger_provider_processors_batch, + "properties/logger_provider/properties/processors/items/properties/batch/properties/schedule_delay": logger_provider_processors_batch_schedule_delay, + "properties/logger_provider/properties/processors/items/properties/batch/properties/export_timeout": logger_provider_processors_batch_export_timeout, + "properties/logger_provider/properties/processors/items/properties/batch/properties/max_queue_size": logger_provider_processors_batch_max_queue_size, + "properties/logger_provider/properties/processors/items/properties/batch/properties/max_export_batch_size": logger_provider_processors_batch_max_export_batch_size, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter": logger_provider_processors_batch_exporter, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp": logger_provider_processors_batch_exporter_otlp, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/protocol": logger_provider_processors_batch_exporter_otlp_protocol, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/endpoint": logger_provider_processors_batch_exporter_otlp_endpoint, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/certificate": logger_provider_processors_batch_exporter_otlp_certificate, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/client_key": logger_provider_processors_batch_exporter_otlp_client_key, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/client_certificate": logger_provider_processors_batch_exporter_otlp_client_certificate, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/headers": logger_provider_processors_batch_exporter_otlp_headers, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/headers/patternProperties": logger_provider_processors_batch_exporter_otlp_headers_patternProperties, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/headers/patternProperties/.*": logger_provider_processors_batch_exporter_otlp_headers_patternProperties_.*, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/compression": logger_provider_processors_batch_exporter_otlp_compression, + "properties/logger_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/timeout": logger_provider_processors_batch_exporter_otlp_timeout, + "properties/logger_provider/properties/processors/items/properties/simple": logger_provider_processors_simple, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter": logger_provider_processors_simple_exporter, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp": logger_provider_processors_simple_exporter_otlp, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/protocol": logger_provider_processors_simple_exporter_otlp_protocol, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/endpoint": logger_provider_processors_simple_exporter_otlp_endpoint, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/certificate": logger_provider_processors_simple_exporter_otlp_certificate, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/client_key": logger_provider_processors_simple_exporter_otlp_client_key, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/client_certificate": logger_provider_processors_simple_exporter_otlp_client_certificate, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/headers": logger_provider_processors_simple_exporter_otlp_headers, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/headers/patternProperties": logger_provider_processors_simple_exporter_otlp_headers_patternProperties, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/headers/patternProperties/.*": logger_provider_processors_simple_exporter_otlp_headers_patternProperties_.*, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/compression": logger_provider_processors_simple_exporter_otlp_compression, + "properties/logger_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/timeout": logger_provider_processors_simple_exporter_otlp_timeout, + "properties/logger_provider/properties/limits": logger_provider_limits, + "properties/logger_provider/properties/limits/properties/attribute_value_length_limit": logger_provider_limits_attribute_value_length_limit, + "properties/logger_provider/properties/limits/properties/attribute_count_limit": logger_provider_limits_attribute_count_limit, + "properties/meter_provider": meter_provider, + "properties/meter_provider/properties/readers": meter_provider_readers, + "properties/meter_provider/properties/readers/items/properties/periodic": meter_provider_readers_periodic, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/interval": meter_provider_readers_periodic_interval, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/timeout": meter_provider_readers_periodic_timeout, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter": meter_provider_readers_periodic_exporter, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp": meter_provider_readers_periodic_exporter_otlp, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/protocol": meter_provider_readers_periodic_exporter_otlp_protocol, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/endpoint": meter_provider_readers_periodic_exporter_otlp_endpoint, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/certificate": meter_provider_readers_periodic_exporter_otlp_certificate, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/client_key": meter_provider_readers_periodic_exporter_otlp_client_key, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/client_certificate": meter_provider_readers_periodic_exporter_otlp_client_certificate, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/headers": meter_provider_readers_periodic_exporter_otlp_headers, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/headers/patternProperties": meter_provider_readers_periodic_exporter_otlp_headers_patternProperties, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/headers/patternProperties/.*": meter_provider_readers_periodic_exporter_otlp_headers_patternProperties_.*, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/compression": meter_provider_readers_periodic_exporter_otlp_compression, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/timeout": meter_provider_readers_periodic_exporter_otlp_timeout, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/temporality_preference": meter_provider_readers_periodic_exporter_otlp_temporality_preference, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/otlp/properties/default_histogram_aggregation": meter_provider_readers_periodic_exporter_otlp_default_histogram_aggregation, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/console": meter_provider_readers_periodic_exporter_console, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/prometheus": meter_provider_readers_periodic_exporter_prometheus, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/prometheus/properties/host": meter_provider_readers_periodic_exporter_prometheus_host, + "properties/meter_provider/properties/readers/items/properties/periodic/properties/exporter/properties/prometheus/properties/port": meter_provider_readers_periodic_exporter_prometheus_port, + "properties/meter_provider/properties/readers/items/properties/pull": meter_provider_readers_pull, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter": meter_provider_readers_pull_exporter, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp": meter_provider_readers_pull_exporter_otlp, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/protocol": meter_provider_readers_pull_exporter_otlp_protocol, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/endpoint": meter_provider_readers_pull_exporter_otlp_endpoint, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/certificate": meter_provider_readers_pull_exporter_otlp_certificate, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/client_key": meter_provider_readers_pull_exporter_otlp_client_key, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/client_certificate": meter_provider_readers_pull_exporter_otlp_client_certificate, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/headers": meter_provider_readers_pull_exporter_otlp_headers, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/headers/patternProperties": meter_provider_readers_pull_exporter_otlp_headers_patternProperties, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/headers/patternProperties/.*": meter_provider_readers_pull_exporter_otlp_headers_patternProperties_.*, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/compression": meter_provider_readers_pull_exporter_otlp_compression, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/timeout": meter_provider_readers_pull_exporter_otlp_timeout, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/temporality_preference": meter_provider_readers_pull_exporter_otlp_temporality_preference, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/otlp/properties/default_histogram_aggregation": meter_provider_readers_pull_exporter_otlp_default_histogram_aggregation, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/console": meter_provider_readers_pull_exporter_console, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/prometheus": meter_provider_readers_pull_exporter_prometheus, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/prometheus/properties/host": meter_provider_readers_pull_exporter_prometheus_host, + "properties/meter_provider/properties/readers/items/properties/pull/properties/exporter/properties/prometheus/properties/port": meter_provider_readers_pull_exporter_prometheus_port, + "properties/meter_provider/properties/views": meter_provider_views, + "properties/meter_provider/properties/views/items/properties/selector": meter_provider_views_selector, + "properties/meter_provider/properties/views/items/properties/selector/properties/instrument_name": meter_provider_views_selector_instrument_name, + "properties/meter_provider/properties/views/items/properties/selector/properties/instrument_type": meter_provider_views_selector_instrument_type, + "properties/meter_provider/properties/views/items/properties/selector/properties/unit": meter_provider_views_selector_unit, + "properties/meter_provider/properties/views/items/properties/selector/properties/meter_name": meter_provider_views_selector_meter_name, + "properties/meter_provider/properties/views/items/properties/selector/properties/meter_version": meter_provider_views_selector_meter_version, + "properties/meter_provider/properties/views/items/properties/selector/properties/meter_schema_url": meter_provider_views_selector_meter_schema_url, + "properties/meter_provider/properties/views/items/properties/stream": meter_provider_views_stream, + "properties/meter_provider/properties/views/items/properties/stream/properties/name": meter_provider_views_stream_name, + "properties/meter_provider/properties/views/items/properties/stream/properties/description": meter_provider_views_stream_description, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation": meter_provider_views_stream_aggregation, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/default": meter_provider_views_stream_aggregation_default, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/drop": meter_provider_views_stream_aggregation_drop, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/explicit_bucket_histogram": meter_provider_views_stream_aggregation_explicit_bucket_histogram, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/explicit_bucket_histogram/properties/boundaries": meter_provider_views_stream_aggregation_explicit_bucket_histogram_boundaries, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/explicit_bucket_histogram/properties/record_min_max": meter_provider_views_stream_aggregation_explicit_bucket_histogram_record_min_max, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/base2_exponential_bucket_histogram": meter_provider_views_stream_aggregation_base2_exponential_bucket_histogram, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/base2_exponential_bucket_histogram/properties/max_scale": meter_provider_views_stream_aggregation_base2_exponential_bucket_histogram_max_scale, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/base2_exponential_bucket_histogram/properties/max_size": meter_provider_views_stream_aggregation_base2_exponential_bucket_histogram_max_size, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/base2_exponential_bucket_histogram/properties/record_min_max": meter_provider_views_stream_aggregation_base2_exponential_bucket_histogram_record_min_max, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/last_value": meter_provider_views_stream_aggregation_last_value, + "properties/meter_provider/properties/views/items/properties/stream/properties/aggregation/properties/sum": meter_provider_views_stream_aggregation_sum, + "properties/meter_provider/properties/views/items/properties/stream/properties/attribute_keys": meter_provider_views_stream_attribute_keys, + "properties/propagator": propagator, + "properties/propagator/properties/composite": propagator_composite, + "properties/tracer_provider": tracer_provider, + "properties/tracer_provider/properties/processors": tracer_provider_processors, + "properties/tracer_provider/properties/processors/items/properties/batch": tracer_provider_processors_batch, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/schedule_delay": tracer_provider_processors_batch_schedule_delay, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/export_timeout": tracer_provider_processors_batch_export_timeout, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/max_queue_size": tracer_provider_processors_batch_max_queue_size, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/max_export_batch_size": tracer_provider_processors_batch_max_export_batch_size, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter": tracer_provider_processors_batch_exporter, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp": tracer_provider_processors_batch_exporter_otlp, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/protocol": tracer_provider_processors_batch_exporter_otlp_protocol, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/endpoint": tracer_provider_processors_batch_exporter_otlp_endpoint, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/certificate": tracer_provider_processors_batch_exporter_otlp_certificate, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/client_key": tracer_provider_processors_batch_exporter_otlp_client_key, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/client_certificate": tracer_provider_processors_batch_exporter_otlp_client_certificate, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/headers": tracer_provider_processors_batch_exporter_otlp_headers, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/headers/patternProperties": tracer_provider_processors_batch_exporter_otlp_headers_patternProperties, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/headers/patternProperties/.*": tracer_provider_processors_batch_exporter_otlp_headers_patternProperties_.*, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/compression": tracer_provider_processors_batch_exporter_otlp_compression, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/otlp/properties/timeout": tracer_provider_processors_batch_exporter_otlp_timeout, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/console": tracer_provider_processors_batch_exporter_console, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/zipkin": tracer_provider_processors_batch_exporter_zipkin, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/zipkin/properties/endpoint": tracer_provider_processors_batch_exporter_zipkin_endpoint, + "properties/tracer_provider/properties/processors/items/properties/batch/properties/exporter/properties/zipkin/properties/timeout": tracer_provider_processors_batch_exporter_zipkin_timeout, + "properties/tracer_provider/properties/processors/items/properties/simple": tracer_provider_processors_simple, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter": tracer_provider_processors_simple_exporter, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp": tracer_provider_processors_simple_exporter_otlp, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/protocol": tracer_provider_processors_simple_exporter_otlp_protocol, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/endpoint": tracer_provider_processors_simple_exporter_otlp_endpoint, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/certificate": tracer_provider_processors_simple_exporter_otlp_certificate, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/client_key": tracer_provider_processors_simple_exporter_otlp_client_key, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/client_certificate": tracer_provider_processors_simple_exporter_otlp_client_certificate, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/headers": tracer_provider_processors_simple_exporter_otlp_headers, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/headers/patternProperties": tracer_provider_processors_simple_exporter_otlp_headers_patternProperties, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/headers/patternProperties/.*": tracer_provider_processors_simple_exporter_otlp_headers_patternProperties_.*, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/compression": tracer_provider_processors_simple_exporter_otlp_compression, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/otlp/properties/timeout": tracer_provider_processors_simple_exporter_otlp_timeout, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/console": tracer_provider_processors_simple_exporter_console, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/zipkin": tracer_provider_processors_simple_exporter_zipkin, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/zipkin/properties/endpoint": tracer_provider_processors_simple_exporter_zipkin_endpoint, + "properties/tracer_provider/properties/processors/items/properties/simple/properties/exporter/properties/zipkin/properties/timeout": tracer_provider_processors_simple_exporter_zipkin_timeout, + "properties/tracer_provider/properties/limits": tracer_provider_limits, + "properties/tracer_provider/properties/limits/properties/attribute_value_length_limit": tracer_provider_limits_attribute_value_length_limit, + "properties/tracer_provider/properties/limits/properties/attribute_count_limit": tracer_provider_limits_attribute_count_limit, + "properties/tracer_provider/properties/limits/properties/event_count_limit": tracer_provider_limits_event_count_limit, + "properties/tracer_provider/properties/limits/properties/link_count_limit": tracer_provider_limits_link_count_limit, + "properties/tracer_provider/properties/limits/properties/event_attribute_count_limit": tracer_provider_limits_event_attribute_count_limit, + "properties/tracer_provider/properties/limits/properties/link_attribute_count_limit": tracer_provider_limits_link_attribute_count_limit, + "properties/resource": resource, + "properties/resource/properties/attributes": resource_attributes, + "properties/resource/properties/attributes/properties/service.name": resource_attributes_service.name, + "properties/resource/properties/schema_url": resource_schema_url +} \ No newline at end of file diff --git a/prototypes/python/tests/test_configuration.py b/prototypes/python/tests/test_configuration.py index acfeaf9..dd82f12 100644 --- a/prototypes/python/tests/test_configuration.py +++ b/prototypes/python/tests/test_configuration.py @@ -18,7 +18,8 @@ from opentelemetry.configuration._internal.configurator import ( traverse_configuration, get_schema_paths, - Configurator + Configurator, + write_schema_paths_functions ) from opentelemetry.configuration._internal.yaml_parser import YAMLParser from pathlib import Path @@ -39,7 +40,23 @@ def test_schema_paths(): data_path.joinpath("opentelemetry_configuration.json") ) - result = get_schema_paths(result["properties"]["tracer_provider"]) + result = get_schema_paths(result) + + result + + +def test_write_schema_paths_functions(): + + schema = resolve_schema( + data_path.joinpath("opentelemetry_configuration.json") + ) + + schema_paths = get_schema_paths(schema) + + write_schema_paths_functions( + schema_paths, + data_path.joinpath("schema_paths_functions.py") + ) def test_resolve_configuration():