diff --git a/prototypes/python/src/opentelemetry/configuration/_internal/configurator.py b/prototypes/python/src/opentelemetry/configuration/_internal/configurator.py index e16c5bb..97c9787 100644 --- a/prototypes/python/src/opentelemetry/configuration/_internal/configurator.py +++ b/prototypes/python/src/opentelemetry/configuration/_internal/configurator.py @@ -187,16 +187,84 @@ def traverse(schema_dictionary, schema_path, schema_paths): schema_path_joined = "/".join(schema_path) - schema_paths.append(schema_path_joined) - if "properties" in schema_dictionary.keys(): + original_dictionary = schema_dictionary schema_dictionary = schema_dictionary["properties"] elif "items" in schema_dictionary.keys(): schema_dictionary = schema_dictionary["items"] if "properties" in schema_dictionary.keys(): + original_dictionary = schema_dictionary schema_dictionary = schema_dictionary["properties"] + if schema_path: + + attributes = [] + + all_attributes = set(schema_dictionary.keys()) + + positional_attributes = set( + original_dictionary.get("required", []) + ) + + optional_attributes = ( + all_attributes.difference(positional_attributes) + ) + + for positional_attribute in positional_attributes: + + positional_attribute_value = ( + schema_dictionary[positional_attribute] + ) + + if isinstance(positional_attribute_value, dict): + if "type" in positional_attribute_value.keys(): + + type_ = { + "integer": "int", + "boolean": "bool", + "string": "str", + "array": "list", + "object": "object" + }[positional_attribute_value["type"]] + + else: + type_ = "object" + + attributes.append(f"{positional_attribute}: {type_}") + + for optional_attribute in optional_attributes: + + optional_attribute_value = ( + schema_dictionary[optional_attribute] + ) + + if isinstance(optional_attribute_value, dict): + if "type" in optional_attribute_value.keys(): + + type_ = { + "integer": "int", + "boolean": "bool", + "string": "str", + "array": "list", + "object": "object" + }[optional_attribute_value["type"]] + + else: + type_ = "object" + + attributes.append(f"{optional_attribute}: {type_} = None") + + attributes = ",\n ".join(attributes) + + if original_dictionary.get("additionalProperties", False): + attributes = f"{attributes},\n **kwargs" + + schema_paths[schema_path_joined] = { + "function_name": schema_path_joined.replace("/", "_"), + "attributes": f"\n {attributes}\n" + } + for schema_dictionary_key, schema_dictionary_value in ( schema_dictionary.items() ): @@ -216,20 +284,11 @@ def traverse(schema_dictionary, schema_path, schema_paths): elif "properties" not in schema_dictionary_value.keys(): continue - if schema_dictionary_key in schema_dictionary.keys(): - schema_dictionary_key = schema_dictionary_key - if schema_dictionary_key == ".*": - schema_path.append("dot_asterisk") - elif schema_dictionary_key == "service.name": - schema_path.append("service_name") - else: - schema_path.append(schema_dictionary_key.lower()) - else: - 1 / 0 + schema_path.append(schema_dictionary_key.lower()) traverse( schema_dictionary_value, schema_path, - schema_paths + schema_paths, ) schema_path.pop() @@ -241,49 +300,36 @@ def traverse(schema_dictionary, schema_path, schema_paths): else: return - if schema_dictionary_key in schema_dictionary.keys(): - schema_dictionary_key = schema_dictionary_key - if schema_dictionary_key == ".*": - schema_path.append("dot_asterisk") - elif schema_dictionary_key == "service.name": - schema_path.append("service_name") - else: - schema_path.append(schema_dictionary_key.lower()) - else: - 1 / 0 + schema_path.append(schema_dictionary_key.lower()) + for element in schema_dictionary_value: - if "properties" not in schema_dictionary_value.keys(): - return if isinstance(element, dict): traverse( element, schema_path, - schema_paths + schema_paths, ) schema_path.pop() - schema_paths = [] + 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, schema_paths_functions_file_path: str ): + set_trace() + schema_paths_function_names = {} - for schema_path in schema_paths: + for schema_path_key, schema_path_value in schema_paths.items(): - schema_paths_function_names[schema_path] = ( - schema_path. - replace("properties/", ""). - replace("items/", ""). - replace("/", "_") + schema_paths_function_names[schema_path_key] = ( + schema_path_value["function_name"] ) schema_paths_functions = dumps(schema_paths_function_names, indent=4) @@ -297,11 +343,12 @@ def write_schema_paths_functions( ): schema_paths_functions_file.write("# flake8: noqa: E501\n") - for function_name in schema_paths_function_names.values(): + for schema_path_value in schema_paths.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" + f"def {schema_path_value['function_name']}" + f"({schema_path_value['attributes']}):\n" ) schema_paths_functions_file.write(" pass\n") diff --git a/prototypes/python/tests/data/bad_attribute_limits.json b/prototypes/python/tests/data/bad_attribute_limits.json new file mode 100644 index 0000000..96dfa5c --- /dev/null +++ b/prototypes/python/tests/data/bad_attribute_limits.json @@ -0,0 +1,220 @@ +{ + "$id": "https://opentelemetry.io/otelconfig/tracer_provider.json", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "TracerProvider", + "type": "object", + "additionalProperties": false, + "properties": { + "processors": { + "type": "array", + "items": { + "$ref": "#/$defs/SpanProcessor" + } + }, + "limits": { + "$ref": "#/$defs/SpanLimits" + }, + "sampler": { + "$ref": "#/$defs/Sampler" + } + }, + "$defs": { + "BatchSpanProcessor": { + "type": "object", + "additionalProperties": false, + "title": "BatchSpanProcessor", + "properties": { + "schedule_delay": { + "type": "integer", + "minimum": 0 + }, + "export_timeout": { + "type": "integer", + "minimum": 0 + }, + "max_queue_size": { + "type": "integer", + "minimum": 0 + }, + "max_export_batch_size": { + "type": "integer", + "minimum": 0 + }, + "exporter": { + "$ref": "#/$defs/SpanExporter" + } + }, + "required": [ + "exporter" + ] + }, + "Sampler": { + "type": "object", + "additionalProperties": true, + "minProperties": 1, + "maxProperties": 1, + "properties": { + "always_off": { + "type": "object", + "additionalProperties": false + }, + "always_on": { + "type": "object", + "additionalProperties": false + }, + "jaeger_remote": { + "type": "object", + "additionalProperties": false, + "properties": { + "endpoint": { + "type": "string" + }, + "interval": { + "type": "integer", + "minimum": 0 + }, + "initial_sampler": { + "$ref": "#/$defs/Sampler" + } + } + }, + "parent_based": { + "type": "object", + "additionalProperties": false, + "properties": { + "root": { + "$ref": "#/$defs/Sampler" + }, + "remote_parent_sampled": { + "$ref": "#/$defs/Sampler" + }, + "remote_parent_not_sampled": { + "$ref": "#/$defs/Sampler" + }, + "local_parent_sampled": { + "$ref": "#/$defs/Sampler" + }, + "local_parent_not_sampled": { + "$ref": "#/$defs/Sampler" + } + } + }, + "trace_id_ratio_based": { + "type": "object", + "additionalProperties": false, + "properties": { + "ratio": { + "type": "number" + } + } + } + }, + "patternProperties": { + ".*": { + "type": "object" + } + } + }, + "SimpleSpanProcessor": { + "type": "object", + "additionalProperties": false, + "title": "SimpleSpanProcessor", + "properties": { + "exporter": { + "$ref": "#/$defs/SpanExporter" + } + }, + "required": [ + "exporter" + ] + }, + "SpanExporter": { + "type": "object", + "additionalProperties": true, + "minProperties": 1, + "maxProperties": 1, + "properties": { + "otlp": { + "$ref": "common.json#/$defs/Otlp" + }, + "console": { + "$ref": "common.json#/$defs/Console" + }, + "zipkin": { + "$ref": "#/$defs/Zipkin" + } + }, + "patternProperties": { + ".*": { + "type": "object" + } + } + }, + "SpanLimits": { + "type": "object", + "additionalProperties": false, + "properties": { + "attribute_value_length_limit": { + "type": "integer", + "minimum": 0 + }, + "attribute_count_limit": { + "type": "integer", + "minimum": 0 + }, + "event_count_limit": { + "type": "integer", + "minimum": 0 + }, + "link_count_limit": { + "type": "integer", + "minimum": 0 + }, + "event_attribute_count_limit": { + "type": "integer", + "minimum": 0 + }, + "link_attribute_count_limit": { + "type": "integer", + "minimum": 0 + } + } + }, + "SpanProcessor": { + "type": "object", + "additionalProperties": true, + "minProperties": 1, + "maxProperties": 1, + "properties": { + "batch": { + "$ref": "#/$defs/BatchSpanProcessor" + }, + "simple": { + "$ref": "#/$defs/SimpleSpanProcessor" + } + }, + "patternProperties": { + ".*": { + "type": "object" + } + } + }, + "Zipkin": { + "type": "object", + "additionalProperties": false, + "properties": { + "endpoint": { + "type": "string" + }, + "timeout": { + "type": "integer", + "minimum": 0 + } + }, + "required": [ + "endpoint" + ], + "title": "Zipkin" + } + } +} diff --git a/prototypes/python/tests/data/bad_attribute_limits.yaml b/prototypes/python/tests/data/bad_attribute_limits.yaml new file mode 100644 index 0000000..f6ad4be --- /dev/null +++ b/prototypes/python/tests/data/bad_attribute_limits.yaml @@ -0,0 +1,374 @@ +# kitchen-sink.yaml demonstrates all configurable surface area, including explanatory comments. +# +# It DOES NOT represent expected real world configuration, as it makes strange configuration +# choices in an effort to exercise the full surface area. +# +# Configuration values are set to their defaults when default values are defined. + +# The file format version +file_format: "0.1" + +# 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 +# is for the SDK to be enabled. +# +# Environment variable: OTEL_SDK_DISABLED +disabled: false + +# Configure general attribute limits. See also tracer_provider.limits, logger_provider.limits. +attribute_limits: + # Configure max attribute value size. + # + # Environment variable: OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT + attribute_count_limit: 128 + +# Configure logger provider. +logger_provider: + # Configure log record processors. + processors: + # Configure a batch log record processor. + - batch: + # Configure delay interval (in milliseconds) between two consecutive exports. + # + # Environment variable: OTEL_BLRP_SCHEDULE_DELAY + schedule_delay: 5000 + # Configure maximum allowed time (in milliseconds) to export data. + # + # Environment variable: OTEL_BLRP_EXPORT_TIMEOUT + export_timeout: 30000 + # Configure maximum queue size. + # + # Environment variable: OTEL_BLRP_MAX_QUEUE_SIZE + max_queue_size: 2048 + # Configure maximum batch size. + # + # Environment variable: OTEL_BLRP_MAX_EXPORT_BATCH_SIZE + max_export_batch_size: 512 + # Configure exporter. + # + # Environment variable: OTEL_LOGS_EXPORTER + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + # + # Environment variable: OTEL_EXPORTER_OTLP_PROTOCOL, OTEL_EXPORTER_OTLP_LOGS_PROTOCOL + protocol: http/protobuf + # Configure endpoint. + # + # Environment variable: OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_LOGS_ENDPOINT + endpoint: http://localhost:4318 + # Configure certificate. + # + # Environment variable: OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE + certificate: /app/cert.pem + # Configure mTLS private client key. + # + # Environment variable: OTEL_EXPORTER_OTLP_CLIENT_KEY, OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY + client_key: /app/cert.pem + # Configure mTLS client certificate. + # + # Environment variable: OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE, OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE + client_certificate: /app/cert.pem + # Configure headers. + # + # Environment variable: OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_LOGS_HEADERS + headers: + api-key: "1234" + # Configure compression. + # + # Environment variable: OTEL_EXPORTER_OTLP_COMPRESSION, OTEL_EXPORTER_OTLP_LOGS_COMPRESSION + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + # + # Environment variable: OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_EXPORTER_OTLP_LOGS_TIMEOUT + timeout: 10000 + # Configure log record limits. See also attribute_limits. + limits: + # Configure max log record attribute value size. Overrides attribute_limits.attribute_value_length_limit. + # + # Environment variable: OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT + attribute_value_length_limit: 4096 + # Configure max log record attribute count. Overrides attribute_limits.attribute_count_limit. + # + # Environment variable: OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT + attribute_count_limit: 128 + +# Configure meter provider. +meter_provider: + # Configure metric readers. + readers: + # Configure a pull-based metric reader. + - pull: + # Configure exporter. + # + # Environment variable: OTEL_METRICS_EXPORTER + exporter: + # Configure exporter to be prometheus. + prometheus: + # Configure host. + # + # Environment variable: OTEL_EXPORTER_PROMETHEUS_HOST + host: localhost + # Configure port. + # + # Environment variable: OTEL_EXPORTER_PROMETHEUS_PORT + port: 9464 + # Configure a periodic metric reader. + - periodic: + # Configure delay interval (in milliseconds) between start of two consecutive exports. + # + # Environment variable: OTEL_METRIC_EXPORT_INTERVAL + interval: 5000 + # Configure maximum allowed time (in milliseconds) to export data. + # + # Environment variable: OTEL_METRIC_EXPORT_TIMEOUT + timeout: 30000 + # Configure exporter. + # + # Environment variable: OTEL_METRICS_EXPORTER + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + # + # Environment variable: OTEL_EXPORTER_OTLP_PROTOCOL, OTEL_EXPORTER_OTLP_METRICS_PROTOCOL + protocol: http/protobuf + # Configure endpoint. + # + # Environment variable: OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT + endpoint: http://localhost:4318 + # Configure certificate. + # + # Environment variable: OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE + certificate: /app/cert.pem + # Configure mTLS private client key. + # + # Environment variable: OTEL_EXPORTER_OTLP_CLIENT_KEY, OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY + client_key: /app/cert.pem + # Configure mTLS client certificate. + # + # Environment variable: OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE, OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE + client_certificate: /app/cert.pem + # Configure headers. + # + # Environment variable: OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_METRICS_HEADERS + headers: + api-key: !!str 1234 + # Configure compression. + # + # Environment variable: OTEL_EXPORTER_OTLP_COMPRESSION, OTEL_EXPORTER_OTLP_METRICS_COMPRESSION + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + # + # Environment variable: OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_EXPORTER_OTLP_METRICS_TIMEOUT + timeout: 10000 + # Configure temporality preference. + # + # Environment variable: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE + temporality_preference: delta + # Configure default histogram aggregation. + # + # Environment variable: OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION + default_histogram_aggregation: base2_exponential_bucket_histogram + # Configure a periodic metric reader. + - periodic: + # Configure exporter. + exporter: + # Configure exporter to be console. + console: {} + # Configure views. Each view has a selector which determines the instrument(s) it applies to, and a configuration for the resulting stream(s). + views: + # Configure a view. + - selector: + # Configure instrument name selection criteria. + instrument_name: my-instrument + # Configure instrument type selection criteria. + instrument_type: histogram + # Configure the instrument unit selection criteria. + unit: ms + # Configure meter name selection criteria. + meter_name: my-meter + # Configure meter version selection criteria. + meter_version: 1.0.0 + # Configure meter schema url selection criteria. + meter_schema_url: https://opentelemetry.io/schemas/1.16.0 + # Configure stream. + stream: + # Configure metric name of the resulting stream(s). + name: new_instrument_name + # Configure metric description of the resulting stream(s). + description: new_description + # Configure aggregation of the resulting stream(s). Known values include: default, drop, explicit_bucket_histogram, base2_exponential_bucket_histogram, last_value, sum. + aggregation: + # Configure aggregation to be explicit_bucket_histogram. + explicit_bucket_histogram: + # Configure bucket boundaries. + boundaries: [ 0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 750.0, 1000.0, 2500.0, 5000.0, 7500.0, 10000.0 ] + # Configure record min and max. + record_min_max: true + # Configure attribute keys retained in the resulting stream(s). + attribute_keys: + - key1 + - key2 + +# Configure text map context propagators. +# +# Environment variable: OTEL_PROPAGATORS +propagator: + composite: [tracecontext, baggage, b3, b3multi, jaeger, xray, ottrace] + +# Configure tracer provider. +tracer_provider: + # Configure span processors. + processors: + # Configure a batch span processor. + - batch: + # Configure delay interval (in milliseconds) between two consecutive exports. + # + # Environment variable: OTEL_BSP_SCHEDULE_DELAY + schedule_delay: 5000 + # Configure maximum allowed time (in milliseconds) to export data. + # + # Environment variable: OTEL_BSP_EXPORT_TIMEOUT + export_timeout: 30000 + # Configure maximum queue size. + # + # Environment variable: OTEL_BSP_MAX_QUEUE_SIZE + max_queue_size: 2048 + # Configure maximum batch size. + # + # Environment variable: OTEL_BSP_MAX_EXPORT_BATCH_SIZE + max_export_batch_size: 512 + # Configure exporter. + # + # Environment variable: OTEL_TRACES_EXPORTER + exporter: + # Configure exporter to be OTLP. + otlp: + # Configure protocol. + # + # Environment variable: OTEL_EXPORTER_OTLP_PROTOCOL, OTEL_EXPORTER_OTLP_TRACES_PROTOCOL + protocol: http/protobuf + # Configure endpoint. + # + # Environment variable: OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT + endpoint: http://localhost:4318 + # Configure certificate. + # + # Environment variable: OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE + certificate: /app/cert.pem + # Configure mTLS private client key. + # + # Environment variable: OTEL_EXPORTER_OTLP_CLIENT_KEY, OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY + client_key: /app/cert.pem + # Configure mTLS client certificate. + # + # Environment variable: OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE + client_certificate: /app/cert.pem + # Configure headers. + # + # Environment variable: OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS + headers: + api-key: !!str 1234 + # Configure compression. + # + # Environment variable: OTEL_EXPORTER_OTLP_COMPRESSION, OTEL_EXPORTER_OTLP_TRACES_COMPRESSION + compression: gzip + # Configure max time (in milliseconds) to wait for each export. + # + # Environment variable: OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_EXPORTER_OTLP_TRACES_TIMEOUT + timeout: 10000 + # Configure a batch span processor. + - batch: + # Configure exporter. + # + # Environment variable: OTEL_TRACES_EXPORTER + exporter: + # Configure exporter to be zipkin. + zipkin: + # Configure endpoint. + # + # Environment variable: OTEL_EXPORTER_ZIPKIN_ENDPOINT + endpoint: http://localhost:9411/api/v2/spans + # Configure max time (in milliseconds) to wait for each export. + # + # Environment variable: OTEL_EXPORTER_ZIPKIN_TIMEOUT + timeout: 10000 + # Configure a simple span processor. + - simple: + # Configure exporter. + exporter: + # Configure exporter to be console. + console: {} + # Configure span limits. See also attribute_limits. + limits: + # Configure max span attribute value size. Overrides attribute_limits.attribute_value_length_limit. + # + # Environment variable: OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT + attribute_value_length_limit: 4096 + # Configure max span attribute count. Overrides attribute_limits.attribute_count_limit. + # + # Environment variable: OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT + attribute_count_limit: 128 + # Configure max span event count. + # + # Environment variable: OTEL_SPAN_EVENT_COUNT_LIMIT + event_count_limit: 128 + # Configure max span link count. + # + # Environment variable: OTEL_SPAN_LINK_COUNT_LIMIT + link_count_limit: 128 + # Configure max attributes per span event. + # + # Environment variable: OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT + event_attribute_count_limit: 128 + # Configure max attributes per span link. + # + # Environment variable: OTEL_LINK_ATTRIBUTE_COUNT_LIMIT + link_attribute_count_limit: 128 + # Configure the sampler. + sampler: + # Configure sampler to be parent_based. Known values include: always_off, always_on, jaeger_remote, parent_based, trace_id_ratio_based. + # + # Environment variable: OTEL_TRACES_SAMPLER=parentbased_* + parent_based: + # Configure root sampler. + # + # Environment variable: OTEL_TRACES_SAMPLER=parentbased_traceidratio + root: + # Configure sampler to be trace_id_ratio_based. + trace_id_ratio_based: + # Configure trace_id_ratio. + # + # Environment variable: OTEL_TRACES_SAMPLER_ARG=traceidratio=0.0001 + ratio: 0.0001 + # Configure remote_parent_sampled sampler. + remote_parent_sampled: + # Configure sampler to be always_on. + always_on: {} + # Configure remote_parent_not_sampled sampler. + remote_parent_not_sampled: + # Configure sampler to be always_off. + always_off: {} + # Configure local_parent_sampled sampler. + local_parent_sampled: + # Configure sampler to be always_on. + always_on: {} + # Configure local_parent_not_sampled sampler. + local_parent_not_sampled: + # Configure sampler to be always_off. + always_off: {} + +# Configure resource for all signals. +resource: + # Configure resource attributes. + # + # Environment variable: OTEL_RESOURCE_ATTRIBUTES + attributes: + # Configure `service.name` resource attribute + # + # Environment variable: OTEL_SERVICE_NAME + service.name: !!str "unknown_service" + # Configure the resource schema URL. + schema_url: https://opentelemetry.io/schemas/1.16.0 diff --git a/prototypes/python/tests/data/schema_paths_functions.py b/prototypes/python/tests/data/schema_paths_functions.py index 9ca345c..24aaef2 100644 --- a/prototypes/python/tests/data/schema_paths_functions.py +++ b/prototypes/python/tests/data/schema_paths_functions.py @@ -1,163 +1,354 @@ # flake8: noqa: E501 -def attribute_limits(*args, **kwargs): +def attribute_limits( + attribute_value_length_limit: int = None, + attribute_count_limit: int = None, + **kwargs +): pass -def logger_provider(*args, **kwargs): +def logger_provider( + processors: list = None, + limits: object = None +): pass -def logger_provider_processors(*args, **kwargs): +def logger_provider_processors( + simple: object = None, + batch: object = None, + **kwargs +): pass -def logger_provider_processors_batch(*args, **kwargs): +def logger_provider_processors_batch( + exporter: object, + schedule_delay: int = None, + max_queue_size: int = None, + export_timeout: int = None, + max_export_batch_size: int = None +): pass -def logger_provider_processors_batch_exporter(*args, **kwargs): +def logger_provider_processors_batch_exporter( + otlp: object = None, + **kwargs +): pass -def logger_provider_processors_batch_exporter_otlp(*args, **kwargs): +def logger_provider_processors_batch_exporter_otlp( + endpoint: str, + protocol: str, + certificate: str = None, + compression: str = None, + client_key: str = None, + timeout: int = None, + client_certificate: str = None, + headers: object = None +): pass -def logger_provider_processors_simple(*args, **kwargs): +def logger_provider_processors_simple( + exporter: object +): pass -def logger_provider_processors_simple_exporter(*args, **kwargs): +def logger_provider_processors_simple_exporter( + otlp: object = None, + **kwargs +): pass -def logger_provider_processors_simple_exporter_otlp(*args, **kwargs): +def logger_provider_processors_simple_exporter_otlp( + endpoint: str, + protocol: str, + certificate: str = None, + compression: str = None, + client_key: str = None, + timeout: int = None, + client_certificate: str = None, + headers: object = None +): pass -def logger_provider_limits(*args, **kwargs): +def logger_provider_limits( + attribute_value_length_limit: int = None, + attribute_count_limit: int = None +): pass -def meter_provider(*args, **kwargs): +def meter_provider( + readers: list = None, + views: list = None +): pass -def meter_provider_readers(*args, **kwargs): +def meter_provider_readers( + periodic: object = None, + pull: object = None +): pass -def meter_provider_readers_periodic(*args, **kwargs): +def meter_provider_readers_periodic( + exporter: object, + timeout: int = None, + interval: int = None +): pass -def meter_provider_readers_periodic_exporter(*args, **kwargs): +def meter_provider_readers_periodic_exporter( + prometheus: object = None, + console: object = None, + otlp: object = None, + **kwargs +): pass -def meter_provider_readers_periodic_exporter_otlp(*args, **kwargs): +def meter_provider_readers_periodic_exporter_otlp( + endpoint: str, + protocol: str, + certificate: str = None, + compression: str = None, + client_key: str = None, + timeout: int = None, + client_certificate: str = None, + headers: object = None, + default_histogram_aggregation: str = None, + temporality_preference: str = None +): pass -def meter_provider_readers_periodic_exporter_prometheus(*args, **kwargs): +def meter_provider_readers_periodic_exporter_prometheus( + port: int = None, + host: str = None +): pass -def meter_provider_readers_pull(*args, **kwargs): +def meter_provider_readers_pull( + exporter: object +): pass -def meter_provider_readers_pull_exporter(*args, **kwargs): +def meter_provider_readers_pull_exporter( + prometheus: object = None, + console: object = None, + otlp: object = None, + **kwargs +): pass -def meter_provider_readers_pull_exporter_otlp(*args, **kwargs): +def meter_provider_readers_pull_exporter_otlp( + endpoint: str, + protocol: str, + certificate: str = None, + compression: str = None, + client_key: str = None, + timeout: int = None, + client_certificate: str = None, + headers: object = None, + default_histogram_aggregation: str = None, + temporality_preference: str = None +): pass -def meter_provider_readers_pull_exporter_prometheus(*args, **kwargs): +def meter_provider_readers_pull_exporter_prometheus( + port: int = None, + host: str = None +): pass -def meter_provider_views(*args, **kwargs): +def meter_provider_views( + selector: object = None, + stream: object = None +): pass -def meter_provider_views_selector(*args, **kwargs): +def meter_provider_views_selector( + meter_name: str = None, + instrument_name: str = None, + unit: str = None, + instrument_type: str = None, + meter_schema_url: str = None, + meter_version: str = None +): pass -def meter_provider_views_stream(*args, **kwargs): +def meter_provider_views_stream( + aggregation: object = None, + name: str = None, + attribute_keys: list = None, + description: str = None +): pass -def meter_provider_views_stream_aggregation(*args, **kwargs): +def meter_provider_views_stream_aggregation( + drop: object = None, + base2_exponential_bucket_histogram: object = None, + default: object = None, + sum: object = None, + explicit_bucket_histogram: object = None, + last_value: object = None +): pass -def meter_provider_views_stream_aggregation_explicit_bucket_histogram(*args, **kwargs): +def meter_provider_views_stream_aggregation_explicit_bucket_histogram( + boundaries: list = None, + record_min_max: bool = None +): pass -def meter_provider_views_stream_aggregation_base2_exponential_bucket_histogram(*args, **kwargs): +def meter_provider_views_stream_aggregation_base2_exponential_bucket_histogram( + max_scale: int = None, + max_size: int = None, + record_min_max: bool = None +): pass -def propagator(*args, **kwargs): +def propagator( + composite: list = None, + **kwargs +): pass -def tracer_provider(*args, **kwargs): +def tracer_provider( + processors: list = None, + sampler: object = None, + limits: object = None +): pass -def tracer_provider_processors(*args, **kwargs): +def tracer_provider_processors( + simple: object = None, + batch: object = None, + **kwargs +): pass -def tracer_provider_processors_batch(*args, **kwargs): +def tracer_provider_processors_batch( + exporter: object, + schedule_delay: int = None, + max_queue_size: int = None, + export_timeout: int = None, + max_export_batch_size: int = None +): pass -def tracer_provider_processors_batch_exporter(*args, **kwargs): +def tracer_provider_processors_batch_exporter( + zipkin: object = None, + console: object = None, + otlp: object = None, + **kwargs +): pass -def tracer_provider_processors_batch_exporter_otlp(*args, **kwargs): +def tracer_provider_processors_batch_exporter_otlp( + endpoint: str, + protocol: str, + certificate: str = None, + compression: str = None, + client_key: str = None, + timeout: int = None, + client_certificate: str = None, + headers: object = None +): pass -def tracer_provider_processors_batch_exporter_zipkin(*args, **kwargs): +def tracer_provider_processors_batch_exporter_zipkin( + endpoint: str, + timeout: int = None +): pass -def tracer_provider_processors_simple(*args, **kwargs): +def tracer_provider_processors_simple( + exporter: object +): pass -def tracer_provider_processors_simple_exporter(*args, **kwargs): +def tracer_provider_processors_simple_exporter( + zipkin: object = None, + console: object = None, + otlp: object = None, + **kwargs +): pass -def tracer_provider_processors_simple_exporter_otlp(*args, **kwargs): +def tracer_provider_processors_simple_exporter_otlp( + endpoint: str, + protocol: str, + certificate: str = None, + compression: str = None, + client_key: str = None, + timeout: int = None, + client_certificate: str = None, + headers: object = None +): pass -def tracer_provider_processors_simple_exporter_zipkin(*args, **kwargs): +def tracer_provider_processors_simple_exporter_zipkin( + endpoint: str, + timeout: int = None +): pass -def tracer_provider_limits(*args, **kwargs): +def tracer_provider_limits( + link_count_limit: int = None, + link_attribute_count_limit: int = None, + event_attribute_count_limit: int = None, + event_count_limit: int = None, + attribute_value_length_limit: int = None, + attribute_count_limit: int = None +): pass -def resource(*args, **kwargs): +def resource( + attributes: object = None, + schema_url: str = None +): pass -def resource_attributes(*args, **kwargs): +def resource_attributes( + service.name: str = None, + **kwargs +): pass diff --git a/prototypes/python/tests/test_configuration.py b/prototypes/python/tests/test_configuration.py index 2286b1d..b1ff09c 100644 --- a/prototypes/python/tests/test_configuration.py +++ b/prototypes/python/tests/test_configuration.py @@ -135,3 +135,11 @@ def test_create_configuration_objects(): configuration = YAMLParser().parse(data_path.joinpath("kitchen-sink.yaml")) create_configuration_objects(configuration) + + +def test_bad_attribute_limits(): + configurator = Configurator() + + configurator.validate_configuration( + data_path.joinpath("bad_attribute_limits.yaml") + )