From 7549296d6a3152add4f83a904abec59f692281c2 Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Fri, 27 Feb 2026 10:48:37 -0500 Subject: [PATCH 01/15] add opentelemetry-codegen-json package --- codegen/opentelemetry-codegen-json/.gitignore | 1 + codegen/opentelemetry-codegen-json/README.rst | 22 + .../opentelemetry-codegen-json/pyproject.toml | 49 + .../src/opentelemetry/codegen/__init__.py | 0 .../opentelemetry/codegen/json/__init__.py | 0 .../opentelemetry/codegen/json/generator.py | 1153 +++++++++++++++++ .../src/opentelemetry/codegen/json/plugin.py | 71 + .../codegen/json/runtime/__init__.py | 0 .../codegen/json/runtime/otlp_json_utils.py | 227 ++++ .../src/opentelemetry/codegen/json/types.py | 189 +++ .../codegen/json/version/__init__.py | 15 + .../src/opentelemetry/codegen/json/writer.py | 459 +++++++ .../test-requirements.txt | 12 + .../tests/__init__.py | 0 .../tests/conftest.py | 30 + .../otel_test_json/common/v1/common.proto | 22 + .../otel_test_json/test/v1/complex.proto | 70 + .../proto/otel_test_json/test/v1/test.proto | 59 + .../proto/otel_test_json/trace/v1/trace.proto | 24 + .../tests/test_otlp_json_utils.py | 203 +++ .../tests/test_protobuf_compatibility.py | 219 ++++ .../tests/test_serdes.py | 344 +++++ .../tests/test_types.py | 154 +++ .../tests/test_writer.py | 244 ++++ 24 files changed, 3567 insertions(+) create mode 100644 codegen/opentelemetry-codegen-json/.gitignore create mode 100644 codegen/opentelemetry-codegen-json/README.rst create mode 100644 codegen/opentelemetry-codegen-json/pyproject.toml create mode 100644 codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/__init__.py create mode 100644 codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/__init__.py create mode 100644 codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py create mode 100644 codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/plugin.py create mode 100644 codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/__init__.py create mode 100644 codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/otlp_json_utils.py create mode 100644 codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/types.py create mode 100644 codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/version/__init__.py create mode 100644 codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py create mode 100644 codegen/opentelemetry-codegen-json/test-requirements.txt create mode 100644 codegen/opentelemetry-codegen-json/tests/__init__.py create mode 100644 codegen/opentelemetry-codegen-json/tests/conftest.py create mode 100644 codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/common/v1/common.proto create mode 100644 codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/test/v1/complex.proto create mode 100644 codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/test/v1/test.proto create mode 100644 codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/trace/v1/trace.proto create mode 100644 codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py create mode 100644 codegen/opentelemetry-codegen-json/tests/test_protobuf_compatibility.py create mode 100644 codegen/opentelemetry-codegen-json/tests/test_serdes.py create mode 100644 codegen/opentelemetry-codegen-json/tests/test_types.py create mode 100644 codegen/opentelemetry-codegen-json/tests/test_writer.py diff --git a/codegen/opentelemetry-codegen-json/.gitignore b/codegen/opentelemetry-codegen-json/.gitignore new file mode 100644 index 00000000000..b31e04e0001 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/.gitignore @@ -0,0 +1 @@ +tests/generated/otel_test_json \ No newline at end of file diff --git a/codegen/opentelemetry-codegen-json/README.rst b/codegen/opentelemetry-codegen-json/README.rst new file mode 100644 index 00000000000..5d94521452f --- /dev/null +++ b/codegen/opentelemetry-codegen-json/README.rst @@ -0,0 +1,22 @@ +OpenTelemetry JSON Code Generator +================================= + +|pypi| + +.. |pypi| image:: https://badge.fury.io/py/opentelemetry-codegen-json.svg + :target: https://pypi.org/project/opentelemetry-codegen-json/ + +This library is a protocol buffer plugin that generates code for the OpenTelemetry protocol in JSON format. + +Installation +------------ + +:: + + pip install opentelemetry-codegen-json + + +References +---------- + +* `OpenTelemetry `_ diff --git a/codegen/opentelemetry-codegen-json/pyproject.toml b/codegen/opentelemetry-codegen-json/pyproject.toml new file mode 100644 index 00000000000..1f59509ae69 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/pyproject.toml @@ -0,0 +1,49 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "opentelemetry-codegen-json" +dynamic = ["version"] +description = "Protobuf plugin to generate JSON serializers and deserializers for OpenTelemetry protobuf messages" +readme = "README.rst" +license = "Apache-2.0" +requires-python = ">=3.9" +authors = [ + { name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" }, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Framework :: OpenTelemetry", + "Intended Audience :: Developers", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", +] +dependencies = [ + "protobuf>=4.25.3", + "types-protobuf>=4.24", +] + +[project.scripts] +protoc-gen-otlp_json = "opentelemetry.codegen.json.plugin:main" + +[project.urls] +Homepage = "https://github.com/open-telemetry/opentelemetry-python/codegen/opentelemetry-codegen-proto-json" +Repository = "https://github.com/open-telemetry/opentelemetry-python" + +[tool.hatch.version] +path = "src/opentelemetry/codegen/json/version/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/src", +] + +[tool.hatch.build.targets.wheel] +packages = ["src/opentelemetry"] diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/__init__.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/__init__.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py new file mode 100644 index 00000000000..6704e1dab45 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py @@ -0,0 +1,1153 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +import logging +from collections import defaultdict +from collections.abc import Iterable +from pathlib import Path +from typing import Callable, Final, Optional, Set + +from google.protobuf import descriptor_pb2 as descriptor +from google.protobuf.compiler import plugin_pb2 as plugin + +from opentelemetry.codegen.json.types import ( + get_default_value, + get_json_allowed_types, + get_python_type, + is_bytes_type, + is_hex_encoded_field, + is_int64_type, + to_json_field_name, +) +from opentelemetry.codegen.json.version import __version__ as GENERATOR_VERSION +from opentelemetry.codegen.json.writer import CodeWriter + +_logger = logging.getLogger(__name__) + +UTILS_MODULE_NAME: Final[str] = "_otlp_json_utils" + + +class OtlpJsonGenerator: + """ + Generates Python dataclasses and JSON serialization/deserialization code + from protobuf descriptors. + """ + + def __init__( + self, + request: plugin.CodeGeneratorRequest, + package_transform: Callable[[str], str], + version: str, + ) -> None: + """ + Initialize the generator. + + Args: + request: Protobuf compiler plugin request + package_transform: A callable that transforms the proto file path. + version: Version string for the generated code. + """ + self._request = request + self._package_transform = package_transform + self._version = version + self._generated_files: dict[str, str] = {} + self._common_root: str = "" + self._file_to_proto: dict[str, descriptor.FileDescriptorProto] = { + f.name: f for f in request.proto_file + } + self._fqn_to_file: dict[str, str] = {} + self._fqn_to_class_path: dict[str, str] = {} + self._file_dependencies: dict[str, list[str]] = { + f.name: list(f.dependency) for f in request.proto_file + } + + for proto_file in request.proto_file: + self._index_file(proto_file) + + def generate_all(self) -> dict[str, str]: + """ + Generate Python code for all proto files and support modules. + + Returns: + Dictionary mapping output file paths to generated code + """ + files_to_generate = self._request.file_to_generate + file_to_output = { + proto_file: self._transform_proto_path(proto_file) + for proto_file in files_to_generate + } + + if not file_to_output: + return {} + + self._common_root = _find_common_root(file_to_output.values()) + + for proto_file in files_to_generate: + file_desc = self._file_to_proto[proto_file] + code = self._generate_file(file_desc) + output_path = file_to_output[proto_file] + self._generated_files[output_path] = code + + utils_path = f"{self._common_root}/{UTILS_MODULE_NAME}.py" + self._generated_files[utils_path] = _load_utils_source() + + version_init_path = f"{self._common_root}/version/__init__.py" + version_writer = CodeWriter(indent_size=4) + self._generate_header(version_writer) + version_writer.writemany(f'__version__ = "{self._version}"', "") + self._generated_files[version_init_path] = version_writer.to_string() + + self._ensure_init_files() + + return self._generated_files + + def _index_file(self, file_desc: descriptor.FileDescriptorProto) -> None: + """ + Index all messages and enums in the file for usage during generation. + + Args: + file_desc: File descriptor to index + """ + package = file_desc.package + for enum_desc in file_desc.enum_type: + fqn = f"{package}.{enum_desc.name}" if package else enum_desc.name + self._fqn_to_file[fqn] = file_desc.name + self._fqn_to_class_path[fqn] = enum_desc.name + for msg_desc in file_desc.message_type: + self._index_message(msg_desc, package, file_desc.name, None) + + def _index_message( + self, + msg_desc: descriptor.DescriptorProto, + package: str, + file_name: str, + parent_path: Optional[str], + ) -> None: + """ + Recursively index a message and its nested types. + + Args: + msg_desc: Message descriptor to index + package: Protobuf package name for the message + file_name: Proto file where the message is defined + parent_path: Full parent class path for nested messages + """ + current_path = ( + f"{parent_path}.{msg_desc.name}" if parent_path else msg_desc.name + ) + fqn = f"{package}.{current_path}" if package else current_path + self._fqn_to_file[fqn] = file_name + self._fqn_to_class_path[fqn] = current_path + + for enum_desc in msg_desc.enum_type: + enum_fqn = f"{fqn}.{enum_desc.name}" + self._fqn_to_file[enum_fqn] = file_name + self._fqn_to_class_path[enum_fqn] = ( + f"{current_path}.{enum_desc.name}" + ) + + for nested_msg in msg_desc.nested_type: + if not nested_msg.options.map_entry: + self._index_message( + nested_msg, package, file_name, current_path + ) + + def _ensure_init_files(self) -> None: + """ + Ensure that every directory in the output path contains an __init__.py file. + """ + dirs = set() + for path in self._generated_files: + p = Path(path) + for parent in p.parents: + parent_str = str(parent) + # Skip '.', root, and the 'opentelemetry' namespace directory + if parent_str in (".", "/", "opentelemetry"): + continue + dirs.add(parent_str) + + for d in dirs: + init_path = f"{d}/__init__.py" + if init_path not in self._generated_files: + self._generated_files[init_path] = "" + + def _get_utils_module_path(self) -> str: + """ + Get the absolute module path for the utility module. + + Returns: + Absolute module path as a string + """ + return ( + f"{self._common_root.replace('/', '.')}.{UTILS_MODULE_NAME}" + if self._common_root + else UTILS_MODULE_NAME + ) + + def _transform_proto_path(self, proto_path: str) -> str: + """ + Transform proto file path to output Python file path. + + Example: 'opentelemetry/proto/trace/v1/trace.proto' + -> 'opentelemetry/proto_json/trace/v1/trace.py' + + Args: + proto_path: Original .proto file path + + Returns: + Transformed .py file path + """ + transformed = self._package_transform(proto_path) + if transformed.endswith(".proto"): + transformed = transformed[:-6] + ".py" + return transformed + + def _get_module_path(self, proto_file: str) -> str: + """ + Convert a proto file path to its transformed Python module path. + + Example: 'opentelemetry/proto/common/v1/common.proto' + -> 'opentelemetry.proto_json.common.v1.common' + + Args: + proto_file: Original .proto file path + + Returns: + Python module path (dot-separated) + """ + transformed = self._transform_proto_path(proto_file) + if transformed.endswith(".py"): + transformed = transformed[:-3] + return transformed.replace("/", ".") + + def _generate_file(self, file_desc: descriptor.FileDescriptorProto) -> str: + """ + Generate complete Python file for a proto file. + + Args: + file_desc: File descriptor + + Returns: + Generated Python code as string + """ + writer = CodeWriter(indent_size=4) + proto_file = file_desc.name + + self._generate_header(writer, proto_file) + self._generate_imports( + writer, proto_file, self._file_has_enums(file_desc) + ) + self._generate_enums_for_file(writer, file_desc.enum_type) + self._generate_messages_for_file( + writer, proto_file, file_desc.message_type + ) + writer.blank_line() + + return writer.to_string() + + def _file_has_enums( + self, file_desc: descriptor.FileDescriptorProto + ) -> bool: + """ + Check if the file or any of its messages (recursively) contain enums. + + Args: + file_desc: File descriptor to check + Returns: + True if any enums are found, False otherwise + """ + if file_desc.enum_type: + return True + for msg in file_desc.message_type: + if self._msg_has_enums(msg): + return True + return False + + def _msg_has_enums(self, msg_desc: descriptor.DescriptorProto) -> bool: + """ + Recursively check if the message or any of its nested messages contain enums. + + Args: + msg_desc: Message descriptor to check + Returns: + True if any enums are found, False otherwise + """ + if msg_desc.enum_type: + return True + for nested in msg_desc.nested_type: + if self._msg_has_enums(nested): + return True + return False + + def _generate_header( + self, writer: CodeWriter, proto_file: str = "" + ) -> None: + """ + Generate file header with license and metadata. + + Args: + writer: Code writer instance + proto_file: Original proto file path (optional) + """ + writer.comment( + [ + "Copyright The OpenTelemetry Authors", + "", + 'Licensed under the Apache License, Version 2.0 (the "License");', + "you may not use this file except in compliance with the License.", + "You may obtain a copy of the License at", + "", + " http://www.apache.org/licenses/LICENSE-2.0", + "", + "Unless required by applicable law or agreed to in writing, software", + 'distributed under the License is distributed on an "AS IS" BASIS,', + "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.", + "See the License for the specific language governing permissions and", + "limitations under the License.", + ] + ) + writer.blank_line() + if proto_file: + writer.comment(f'AUTO-GENERATED from "{proto_file}"') + writer.comment("DO NOT EDIT MANUALLY") + writer.blank_line() + + def _generate_imports( + self, + writer: CodeWriter, + proto_file: str, + include_enum: bool, + ) -> None: + """ + Generate all necessary import statements. + + Args: + writer: Code writer instance + proto_file: Original proto file path + include_enum: Whether to include the enum module import + """ + writer.import_("__future__", "annotations") + writer.blank_line() + + std_imports = [ + "builtins", + "dataclasses", + "functools", + "json", + "sys", + "typing", + ] + if include_enum: + std_imports.append("enum") + + for module in sorted(std_imports): + writer.import_(module) + + writer.blank_line() + + with writer.if_("sys.version_info >= (3, 10)"): + writer.assignment( + "_dataclass", + "functools.partial(dataclasses.dataclass, slots=True)", + ) + with writer.else_(): + writer.assignment("_dataclass", "dataclasses.dataclass") + writer.blank_line() + + # Collect all imports needed + imports = self._collect_imports(proto_file) + imports.add(f"import {self._get_utils_module_path()}") + + # Generate cross file imports + if imports: + for import_info in sorted(imports): + writer.writeln(import_info) + writer.blank_line() + writer.blank_line() + + def _collect_imports(self, proto_file: str) -> Set[str]: + """ + Collect all import statements needed for cross file references. + + Args: + proto_file: Current proto file path + + Returns: + Set of import statement strings + """ + return set( + "import " + self._get_module_path(dep_file) + for dep_file in self._file_dependencies.get(proto_file, []) + ) + + def _generate_enums_for_file( + self, + writer: CodeWriter, + enum_descs: Iterable[descriptor.EnumDescriptorProto], + ) -> None: + """ + Generate all enums for a file (top level and nested). + + Args: + writer: Code writer instance + enum_descs: List of top level enums + """ + for enum_desc in enum_descs: + self._generate_enum_class(writer, enum_desc) + writer.blank_line() + + def _generate_messages_for_file( + self, + writer: CodeWriter, + proto_file: str, + msg_descs: Iterable[descriptor.DescriptorProto], + ) -> None: + """ + Generate all message classes for a file. + + Args: + writer: Code writer instance + proto_file: Original proto file path + msg_descs: List of top level messages + """ + for i, message in enumerate(msg_descs): + if i: + writer.blank_line(2) + + self._generate_message_class(writer, proto_file, message) + + def _generate_message_class( + self, + writer: CodeWriter, + proto_file: str, + msg_desc: descriptor.DescriptorProto, + parent_path: Optional[str] = None, + ) -> None: + """ + Generate a complete dataclass for a protobuf message. + + Args: + writer: Code writer instance + proto_file: Original proto file path + msg_desc: Message descriptor + parent_path: Full parent class path for nested messages + """ + current_path = ( + f"{parent_path}.{msg_desc.name}" if parent_path else msg_desc.name + ) + with writer.dataclass( + msg_desc.name, + decorators=("typing.final",), + decorator_name="_dataclass", + ): + if msg_desc.field or msg_desc.nested_type or msg_desc.enum_type: + writer.docstring( + [f"Generated from protobuf message {msg_desc.name}"] + ) + writer.blank_line() + + for enum_desc in msg_desc.enum_type: + self._generate_enum_class(writer, enum_desc) + writer.blank_line() + + for nested_desc in msg_desc.nested_type: + if not nested_desc.options.map_entry: + self._generate_message_class( + writer, proto_file, nested_desc, current_path + ) + writer.blank_line() + + if msg_desc.field: + for field_desc in msg_desc.field: + self._generate_field(writer, proto_file, field_desc) + else: + writer.pass_() + + writer.blank_line() + self._generate_to_dict(writer, msg_desc) + writer.blank_line() + self._generate_to_json(writer) + writer.blank_line() + self._generate_from_dict( + writer, proto_file, msg_desc, current_path + ) + writer.blank_line() + self._generate_from_json(writer, current_path) + + def _generate_enum_class( + self, writer: CodeWriter, enum_desc: descriptor.EnumDescriptorProto + ) -> None: + """ + Generate an IntEnum class for a protobuf enum. + + Args: + writer: Code writer instance + enum_desc: Enum descriptor + """ + with writer.enum( + enum_desc.name, + enum_type="enum.IntEnum", + decorators=("typing.final",), + ): + writer.docstring( + [f"Generated from protobuf enum {enum_desc.name}"] + ) + writer.blank_line() + + if enum_desc.value: + for val_desc in enum_desc.value: + writer.enum_member(val_desc.name, val_desc.number) + else: + writer.pass_() + + def _generate_field( + self, + writer: CodeWriter, + proto_file: str, + field_desc: descriptor.FieldDescriptorProto, + ) -> None: + """ + Generate a dataclass field. + + Args: + writer: Code writer instance + proto_file: Original proto file path + field_desc: Field descriptor + """ + type_hint = self._get_field_type_hint(proto_file, field_desc) + writer.field( + field_desc.name, + type_hint, + default=self._get_field_default(field_desc), + ) + + def _generate_to_dict( + self, + writer: CodeWriter, + msg_desc: descriptor.DescriptorProto, + ) -> None: + """ + Generate a to_dict() method that converts the dataclass instance to a dictionary + + Args: + writer: Code writer instance + msg_desc: Message descriptor for the class being generated + """ + with writer.method( + "to_dict", + ["self"], + return_type="builtins.dict[builtins.str, typing.Any]", + ): + writer.docstring( + [ + "Convert this message to a dictionary with lowerCamelCase keys.", + "", + "Returns:", + " Dictionary representation following OTLP JSON encoding", + ] + ) + writer.assignment("_result", "{}") + + # Separate fields into oneof groups and standalone fields + oneof_groups: dict[int, list[descriptor.FieldDescriptorProto]] = ( + defaultdict(list) + ) + standalone_fields: list[descriptor.FieldDescriptorProto] = [] + + for field in msg_desc.field: + if field.HasField("oneof_index") and not field.proto3_optional: + oneof_groups[field.oneof_index].append(field) + else: + standalone_fields.append(field) + + for field in standalone_fields: + with writer.if_( + f"self.{field.name} is not None" + if field.proto3_optional + else f"self.{field.name}" + ): + self._generate_serialization_statements( + writer, field, "_result" + ) + + for group_index in sorted(oneof_groups.keys()): + group_fields = oneof_groups[group_index] + for i, field in enumerate(reversed(group_fields)): + condition = f"self.{field.name} is not None" + context = ( + writer.elif_(condition) if i else writer.if_(condition) + ) + + with context: + self._generate_serialization_statements( + writer, field, "_result" + ) + + writer.return_("_result") + + def _generate_to_json(self, writer: CodeWriter) -> None: + """ + Generate a to_json() method that serializes the message to a JSON string. + + Args: + writer: Code writer instance + """ + with writer.method("to_json", ["self"], return_type="builtins.str"): + writer.docstring( + [ + "Serialize this message to a JSON string.", + "", + "Returns:", + " JSON string", + ] + ) + writer.return_("json.dumps(self.to_dict())") + + def _generate_from_dict( + self, + writer: CodeWriter, + proto_file: str, + msg_desc: descriptor.DescriptorProto, + current_path: str, + ) -> None: + """ + Generate a from_dict() class method that creates an instance from a dictionary. + + Args: + writer: Code writer instance + proto_file: Original proto file path + msg_desc: Message descriptor for the class being generated + current_path: Full class path for type hints and return type + """ + with writer.method( + "from_dict", + ["cls", "data: builtins.dict[builtins.str, typing.Any]"], + decorators=["builtins.classmethod"], + return_type=f'"{current_path}"', + ): + writer.docstring( + [ + "Create from a dictionary with lowerCamelCase keys.", + "", + "Args:", + " data: Dictionary representation following OTLP JSON encoding", + "", + "Returns:", + f" {msg_desc.name} instance", + ] + ) + utils = self._get_utils_module_path() + writer.writeln( + f'{utils}.validate_type(data, builtins.dict, "data")' + ) + writer.assignment("_args", "{}") + writer.blank_line() + + # Separate fields into oneof groups and standalone fields + oneof_groups: dict[int, list[descriptor.FieldDescriptorProto]] = ( + defaultdict(list) + ) + standalone_fields: list[descriptor.FieldDescriptorProto] = [] + + for field in msg_desc.field: + if field.HasField("oneof_index") and not field.proto3_optional: + oneof_groups[field.oneof_index].append(field) + else: + standalone_fields.append(field) + + # Handle standalone fields + for field in standalone_fields: + json_name = ( + field.json_name + if field.json_name + else to_json_field_name(field.name) + ) + with writer.if_( + f'(_value := data.get("{json_name}")) is not None' + ): + self._generate_deserialization_statements( + writer, proto_file, field, "_value", "_args" + ) + + # Handle oneof groups + for group_index in sorted(oneof_groups.keys()): + group_fields = oneof_groups[group_index] + for i, field in enumerate(reversed(group_fields)): + json_name = ( + field.json_name + if field.json_name + else to_json_field_name(field.name) + ) + condition = ( + f'(_value := data.get("{json_name}")) is not None' + ) + context = ( + writer.elif_(condition) if i else writer.if_(condition) + ) + + with context: + self._generate_deserialization_statements( + writer, proto_file, field, "_value", "_args" + ) + + writer.blank_line() + writer.return_("cls(**_args)") + + def _generate_from_json( + self, + writer: CodeWriter, + current_path: str, + ) -> None: + """ + Generate a from_json() class method that creates an instance from a JSON string. + + Args: + writer: Code writer instance + current_path: Full class path for type hints and return type + """ + with writer.method( + "from_json", + ["cls", "data: typing.Union[builtins.str, builtins.bytes]"], + decorators=["builtins.classmethod"], + return_type=f'"{current_path}"', + ): + writer.docstring( + [ + "Deserialize from a JSON string or bytes.", + "", + "Args:", + " data: JSON string or bytes", + "", + "Returns:", + " Instance of the class", + ] + ) + writer.return_("cls.from_dict(json.loads(data))") + + def _generate_serialization_statements( + self, + writer: CodeWriter, + field_desc: descriptor.FieldDescriptorProto, + target_dict: str, + ) -> None: + """ + Generate statements to serialize a field and assign it to the target dictionary. + + Args: + writer: Code writer instance + field_desc: Field descriptor for the field being serialized + target_dict: Name of the dictionary variable to assign the serialized value to + """ + json_name = ( + field_desc.json_name + if field_desc.json_name + else to_json_field_name(field_desc.name) + ) + if field_desc.label == descriptor.FieldDescriptorProto.LABEL_REPEATED: + item_expr = self._get_serialization_expr(field_desc, "_v") + if item_expr == "_v": + writer.assignment( + f'{target_dict}["{json_name}"]', f"self.{field_desc.name}" + ) + else: + utils = self._get_utils_module_path() + writer.assignment( + f'{target_dict}["{json_name}"]', + f"{utils}.encode_repeated(self.{field_desc.name}, lambda _v: {item_expr})", + ) + else: + val_expr = self._get_serialization_expr( + field_desc, f"self.{field_desc.name}" + ) + writer.assignment(f'{target_dict}["{json_name}"]', val_expr) + + def _get_serialization_expr( + self, field_desc: descriptor.FieldDescriptorProto, var_name: str + ) -> str: + """ + Get the Python expression to serialize a value of a given type for JSON output. + + Args: + field_desc: Field descriptor for the value being serialized + var_name: Variable name representing the value to serialize + """ + utils = self._get_utils_module_path() + if field_desc.type == descriptor.FieldDescriptorProto.TYPE_MESSAGE: + return f"{var_name}.to_dict()" + if field_desc.type == descriptor.FieldDescriptorProto.TYPE_ENUM: + return f"builtins.int({var_name})" + if is_hex_encoded_field(field_desc.name): + return f"{utils}.encode_hex({var_name})" + if is_int64_type(field_desc.type): + return f"{utils}.encode_int64({var_name})" + if is_bytes_type(field_desc.type): + return f"{utils}.encode_base64({var_name})" + if field_desc.type in ( + descriptor.FieldDescriptorProto.TYPE_FLOAT, + descriptor.FieldDescriptorProto.TYPE_DOUBLE, + ): + return f"{utils}.encode_float({var_name})" + + return var_name + + def _generate_deserialization_statements( + self, + writer: CodeWriter, + proto_file: str, + field_desc: descriptor.FieldDescriptorProto, + var_name: str, + target_dict: str, + ) -> None: + """ + Generate statements to deserialize a field from a JSON value and assign it to the target dictionary. + + Args: + writer: Code writer instance + proto_file: Original proto file path + field_desc: Field descriptor for the field being deserialized + var_name: Variable name representing the JSON value to deserialize + target_dict: Name of the dictionary variable to assign the deserialized value to + """ + utils = self._get_utils_module_path() + if field_desc.label == descriptor.FieldDescriptorProto.LABEL_REPEATED: + item_expr = self._get_deserialization_expr( + proto_file, field_desc, "_v" + ) + writer.assignment( + f'{target_dict}["{field_desc.name}"]', + f'{utils}.decode_repeated({var_name}, lambda _v: {item_expr}, "{field_desc.name}")', + ) + return + + if field_desc.type == descriptor.FieldDescriptorProto.TYPE_MESSAGE: + msg_type = self._resolve_message_type( + field_desc.type_name, proto_file + ) + writer.assignment( + f'{target_dict}["{field_desc.name}"]', + f"{msg_type}.from_dict({var_name})", + ) + elif field_desc.type == descriptor.FieldDescriptorProto.TYPE_ENUM: + enum_type = self._resolve_enum_type( + field_desc.type_name, proto_file + ) + writer.writeln( + f'{utils}.validate_type({var_name}, builtins.int, "{field_desc.name}")' + ) + writer.assignment( + f'{target_dict}["{field_desc.name}"]', + f"{enum_type}({var_name})", + ) + elif is_hex_encoded_field(field_desc.name): + writer.assignment( + f'{target_dict}["{field_desc.name}"]', + f'{utils}.decode_hex({var_name}, "{field_desc.name}")', + ) + elif is_int64_type(field_desc.type): + writer.assignment( + f'{target_dict}["{field_desc.name}"]', + f'{utils}.decode_int64({var_name}, "{field_desc.name}")', + ) + elif is_bytes_type(field_desc.type): + writer.assignment( + f'{target_dict}["{field_desc.name}"]', + f'{utils}.decode_base64({var_name}, "{field_desc.name}")', + ) + elif field_desc.type in ( + descriptor.FieldDescriptorProto.TYPE_FLOAT, + descriptor.FieldDescriptorProto.TYPE_DOUBLE, + ): + writer.assignment( + f'{target_dict}["{field_desc.name}"]', + f'{utils}.decode_float({var_name}, "{field_desc.name}")', + ) + else: + allowed_types = get_json_allowed_types( + field_desc.type, field_desc.name + ) + writer.writeln( + f'{utils}.validate_type({var_name}, {allowed_types}, "{field_desc.name}")' + ) + writer.assignment(f'{target_dict}["{field_desc.name}"]', var_name) + + def _get_deserialization_expr( + self, + proto_file: str, + field_desc: descriptor.FieldDescriptorProto, + var_name: str, + ) -> str: + """ + Get the Python expression to deserialize a value of a given type for JSON input. + + Args: + proto_file: Original proto file path + field_desc: Field descriptor for the value being deserialized + var_name: Variable name representing the JSON value to deserialize + + Returns: + Python expression string to perform deserialization + """ + utils = self._get_utils_module_path() + if field_desc.type == descriptor.FieldDescriptorProto.TYPE_MESSAGE: + msg_type = self._resolve_message_type( + field_desc.type_name, proto_file + ) + return f"{msg_type}.from_dict({var_name})" + if field_desc.type == descriptor.FieldDescriptorProto.TYPE_ENUM: + enum_type = self._resolve_enum_type( + field_desc.type_name, proto_file + ) + return f"{enum_type}({var_name})" + if is_hex_encoded_field(field_desc.name): + return f'{utils}.decode_hex({var_name}, "{field_desc.name}")' + if is_int64_type(field_desc.type): + return f'{utils}.decode_int64({var_name}, "{field_desc.name}")' + if is_bytes_type(field_desc.type): + return f'{utils}.decode_base64({var_name}, "{field_desc.name}")' + if field_desc.type in ( + descriptor.FieldDescriptorProto.TYPE_FLOAT, + descriptor.FieldDescriptorProto.TYPE_DOUBLE, + ): + return f'{utils}.decode_float({var_name}, "{field_desc.name}")' + + return var_name + + def _get_field_type_hint( + self, proto_file: str, field_desc: descriptor.FieldDescriptorProto + ) -> str: + """ + Get the Python type hint for a field. + + Args: + proto_file: Original proto file path + field_desc: Field descriptor + + Returns: + Python type hint string + """ + if field_desc.type == descriptor.FieldDescriptorProto.TYPE_MESSAGE: + base_type = self._resolve_message_type( + field_desc.type_name, proto_file + ) + elif field_desc.type == descriptor.FieldDescriptorProto.TYPE_ENUM: + base_type = self._resolve_enum_type( + field_desc.type_name, proto_file + ) + else: + base_type = get_python_type(field_desc.type) + + if field_desc.label == descriptor.FieldDescriptorProto.LABEL_REPEATED: + return f"builtins.list[{base_type}]" + if field_desc.type == descriptor.FieldDescriptorProto.TYPE_ENUM: + return f"typing.Union[{base_type}, builtins.int, None]" + return f"typing.Optional[{base_type}]" + + def _resolve_message_type(self, type_name: str, proto_file: str) -> str: + """ + Resolve a message type name to its Python class path. + + Args: + type_name: Fully qualified proto name + proto_file: Current proto file path + + Returns: + Python class reference + """ + fqn = type_name.lstrip(".") + target_file = self._fqn_to_file.get(fqn) + + if not target_file: + _logger.warning("Could not resolve message type: %s", type_name) + return "typing.Any" + + class_path = self._fqn_to_class_path[fqn] + + # If in same file, use relative class path + if target_file == proto_file: + return class_path + # Cross file reference - use fully qualified module + class path + module_path = self._get_module_path(target_file) + return f"{module_path}.{class_path}" + + def _resolve_enum_type(self, type_name: str, proto_file: str) -> str: + """ + Resolve an enum type name to its Python class path. + + Args: + type_name: Fully qualified proto name + proto_file: Current proto file path + + Returns: + Python class reference + """ + fqn = type_name.lstrip(".") + target_file = self._fqn_to_file.get(fqn) + + if not target_file: + _logger.warning("Could not resolve enum type: %s", type_name) + return "builtins.int" + + class_path = self._fqn_to_class_path[fqn] + + # If in same file, use relative class path + if target_file == proto_file: + return class_path + # Cross file reference - use fully qualified module + class path + module_path = self._get_module_path(target_file) + return f"{module_path}.{class_path}" + + def _get_field_default( + self, field_desc: descriptor.FieldDescriptorProto + ) -> Optional[str]: + """ + Get the default value for a field. + + Args: + field_desc: Field descriptor + + Returns: + Default value string or None + """ + # Repeated fields default to empty list + if field_desc.label == descriptor.FieldDescriptorProto.LABEL_REPEATED: + return "dataclasses.field(default_factory=builtins.list)" + + # Optional fields, Message types, and oneof members default to None + if ( + field_desc.type == descriptor.FieldDescriptorProto.TYPE_MESSAGE + or field_desc.HasField("oneof_index") + or field_desc.proto3_optional + ): + return "None" + + # Enum types default to 0 + if field_desc.type == descriptor.FieldDescriptorProto.TYPE_ENUM: + return "0" + + # Primitive types use proto defaults + return get_default_value(field_desc.type) + + +def _load_utils_source() -> str: + """ + Load the source code for the utility module from its source file. + + Returns: + Source code as a string + """ + utils_src_path = Path(__file__).parent / "runtime" / "otlp_json_utils.py" + try: + return utils_src_path.read_text(encoding="utf-8") + except Exception as e: + _logger.error( + "Failed to load utility module source from %s: %s", + utils_src_path, + e, + ) + raise RuntimeError( + f"Failed to load utility module source from {utils_src_path}" + ) from e + + +def _find_common_root(paths: Iterable[str]) -> str: + """ + Find the longest common directory prefix among the given paths. + + Args: + paths: Iterable of file paths to analyze + Returns: + Common directory prefix as a string + """ + if not paths: + return "" + + # Split paths into components + split_paths = [p.split("/")[:-1] for p in paths] + if not split_paths: + return "" + + # Find common prefix among components + common = [] + for parts in zip(*split_paths): + if all(p == parts[0] for p in parts): + common.append(parts[0]) + else: + break + + return "/".join(common) + + +def generate_code( + request: plugin.CodeGeneratorRequest, + package_transform: Callable[[str], str] = lambda p: p.replace( + "opentelemetry/proto/", "opentelemetry/proto_json/" + ), +) -> dict[str, str]: + """ + Main entry point for code generation. + + Args: + request: Protobuf compiler plugin request + package_transform: Package transformation string or callable + + Returns: + Dictionary mapping output file paths to generated code + """ + generator = OtlpJsonGenerator( + request, package_transform, version=GENERATOR_VERSION + ) + return generator.generate_all() + + +def generate_plugin_response( + request: plugin.CodeGeneratorRequest, + package_transform: Callable[[str], str] = lambda p: p.replace( + "opentelemetry/proto/", "opentelemetry/proto_json/" + ), +) -> plugin.CodeGeneratorResponse: + """ + Generate plugin response with all generated files. + + Args: + request: Protobuf compiler plugin request + package_transform: Package transformation string + + Returns: + Plugin response with generated files + """ + response = plugin.CodeGeneratorResponse() + + # Declare support for optional proto3 fields + response.supported_features |= ( + plugin.CodeGeneratorResponse.FEATURE_PROTO3_OPTIONAL + ) + response.supported_features |= ( + plugin.CodeGeneratorResponse.FEATURE_SUPPORTS_EDITIONS + ) + + response.minimum_edition = descriptor.EDITION_LEGACY + response.maximum_edition = descriptor.EDITION_2024 + + # Generate code + generated_files = generate_code(request, package_transform) + + # Create response files + for output_path, code in generated_files.items(): + file_response = response.file.add() + file_response.name = output_path + file_response.content = code + + return response diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/plugin.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/plugin.py new file mode 100644 index 00000000000..0299be6afff --- /dev/null +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/plugin.py @@ -0,0 +1,71 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import logging +import sys +from collections.abc import Iterator +from contextlib import contextmanager +from typing import Tuple + +from google.protobuf.compiler import plugin_pb2 as plugin + +from opentelemetry.codegen.json.generator import generate_plugin_response +from opentelemetry.codegen.json.version import __version__ + +_logger = logging.getLogger(__name__) + + +@contextmanager +def code_generation() -> Iterator[ + Tuple[plugin.CodeGeneratorRequest, plugin.CodeGeneratorResponse], +]: + """ + Context manager for handling the code generation process. + """ + if len(sys.argv) > 1 and sys.argv[1] in ("-V", "--version"): + print("opentelemetry-codegen-json " + __version__) + sys.exit(0) + + data = sys.stdin.buffer.read() + + request = plugin.CodeGeneratorRequest() + request.ParseFromString(data) + + response = plugin.CodeGeneratorResponse() + + yield request, response + + output = response.SerializeToString() + sys.stdout.buffer.write(output) + + +def main() -> None: + """ + Main entry point for the protoc plugin. + """ + with code_generation() as (request, response): + generated_response = generate_plugin_response(request) + + response.supported_features |= generated_response.supported_features + for file in generated_response.file: + response.file.add().CopyFrom(file) + + +if __name__ == "__main__": + logging.basicConfig( + level=logging.DEBUG, + stream=sys.stderr, + format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", + ) + main() diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/__init__.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/otlp_json_utils.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/otlp_json_utils.py new file mode 100644 index 00000000000..baae4901fe7 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/otlp_json_utils.py @@ -0,0 +1,227 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +import base64 +import math +import typing + +T = typing.TypeVar("T") + + +def encode_hex(value: bytes) -> str: + """ + Encode bytes as hex string. + + Args: + value: The bytes to encode. + Returns: + Hex string representation of the input bytes. + """ + return value.hex() if value else "" + + +def encode_base64(value: bytes) -> str: + """ + Encode bytes as base64 string. + Standard Proto3 JSON mapping for bytes. + + Args: + value: The bytes to encode. + Returns: + Base64 string representation of the input bytes. + """ + return base64.b64encode(value).decode("utf-8") if value else "" + + +def encode_int64(value: int) -> str: + """ + Encode 64 bit integers as strings. + Required for int64, uint64, fixed64, sfixed64 and sint64 per Proto3 JSON spec. + + Args: + value: The integer to encode. + Returns: + String representation of the input integer. + """ + return str(value) + + +def encode_float(value: float) -> typing.Union[float, str]: + """ + Encode float/double values. + + Args: + value: The float to encode. + Returns: + The input value, or a string for special float values (NaN, Infinity). + """ + if math.isnan(value): + return "NaN" + if math.isinf(value): + return "Infinity" if value > 0 else "-Infinity" + return value + + +def encode_repeated( + values: typing.Optional[list[typing.Any]], + map_fn: typing.Callable[[typing.Any], typing.Any], +) -> list[typing.Any]: + """ + Helper to serialize repeated fields with a mapping function. + + Args: + values: The list of values to encode. + map_fn: A function that takes a single value and returns its encoded form. + Returns: + A list of encoded values, or an empty list if input is None or empty. + """ + return [map_fn(v) for v in values] if values else [] + + +def decode_hex(value: typing.Optional[str], field_name: str) -> bytes: + """ + Decode hex string to bytes. + + Args: + value: The hex string to decode. + field_name: The name of the field being decoded (for error messages). + Returns: + The decoded bytes, or empty bytes if input is None or empty. + """ + if not value: + return b"" + validate_type(value, str, field_name) + try: + return bytes.fromhex(value) + except ValueError as e: + raise ValueError( + f"Invalid hex string for field '{field_name}': {e}" + ) from None + + +def decode_base64(value: typing.Optional[str], field_name: str) -> bytes: + """ + Decode base64 string to bytes. + + Args: + value: The base64 string to decode. + field_name: The name of the field being decoded (for error messages). + Returns: + The decoded bytes, or empty bytes if input is None or empty. + """ + if not value: + return b"" + validate_type(value, str, field_name) + try: + return base64.b64decode(value) + except Exception as e: + raise ValueError( + f"Invalid base64 string for field '{field_name}': {e}" + ) from None + + +def decode_int64( + value: typing.Optional[typing.Union[int, str]], field_name: str +) -> int: + """ + Parse int64 from number or string. + + Args: + value: The value to decode, which can be an int, a string, or None + field_name: The name of the field being decoded (for error messages). + Returns: + The decoded integer, or 0 if input is None. + """ + if value is None: + return 0 + validate_type(value, (int, str), field_name) + try: + return int(value) + except (ValueError, TypeError): + raise ValueError( + f"Invalid int64 value for field '{field_name}': {value}" + ) from None + + +def decode_float( + value: typing.Optional[typing.Union[float, int, str]], field_name: str +) -> float: + """ + Parse float/double from number or string, handling special values. + + Args: + value: The value to decode, which can be a float, int, string, or None + field_name: The name of the field being decoded (for error messages). + Returns: + The decoded float, or 0.0 if input is None. + """ + if value is None: + return 0.0 + validate_type(value, (float, int, str), field_name) + if value == "NaN": + return math.nan + if value == "Infinity": + return math.inf + if value == "-Infinity": + return -math.inf + try: + return float(value) + except (ValueError, TypeError): + raise ValueError( + f"Invalid float value for field '{field_name}': {value}" + ) from None + + +def decode_repeated( + values: typing.Optional[list[typing.Any]], + item_parser: typing.Callable[[typing.Any], T], + field_name: str, +) -> list[T]: + """ + Parse a list of values using the provided item parser function. + + Args: + values: The list of values to decode, or None. + item_parser: A function that takes a single value and returns the parsed form. + field_name: The name of the field being decoded (for error messages). + Returns: + A list of parsed values, or an empty list if input is None. + """ + if values is None: + return [] + validate_type(values, list, field_name) + return [item_parser(v) for v in values] + + +def validate_type( + value: typing.Any, + expected_types: typing.Union[type, tuple[type, ...]], + field_name: str, +) -> None: + """ + Validate that a value is of the expected type(s). + Raises TypeError if validation fails. + + Args: + value: The value to validate. + expected_types: A type or tuple of types that the value is expected to be. + field_name: The name of the field being validated (for error messages). + """ + if not isinstance(value, expected_types): + raise TypeError( + f"Field '{field_name}' expected {expected_types}, " + f"got {type(value).__name__}" + ) diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/types.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/types.py new file mode 100644 index 00000000000..93d9132f77e --- /dev/null +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/types.py @@ -0,0 +1,189 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Final + +from google.protobuf import descriptor_pb2 as descriptor + +PROTO_TO_PYTHON: Final[dict[int, str]] = { + descriptor.FieldDescriptorProto.TYPE_DOUBLE: "builtins.float", + descriptor.FieldDescriptorProto.TYPE_FLOAT: "builtins.float", + descriptor.FieldDescriptorProto.TYPE_INT64: "builtins.int", + descriptor.FieldDescriptorProto.TYPE_UINT64: "builtins.int", + descriptor.FieldDescriptorProto.TYPE_INT32: "builtins.int", + descriptor.FieldDescriptorProto.TYPE_FIXED64: "builtins.int", + descriptor.FieldDescriptorProto.TYPE_FIXED32: "builtins.int", + descriptor.FieldDescriptorProto.TYPE_BOOL: "builtins.bool", + descriptor.FieldDescriptorProto.TYPE_STRING: "builtins.str", + descriptor.FieldDescriptorProto.TYPE_BYTES: "builtins.bytes", + descriptor.FieldDescriptorProto.TYPE_UINT32: "builtins.int", + descriptor.FieldDescriptorProto.TYPE_SFIXED32: "builtins.int", + descriptor.FieldDescriptorProto.TYPE_SFIXED64: "builtins.int", + descriptor.FieldDescriptorProto.TYPE_SINT32: "builtins.int", + descriptor.FieldDescriptorProto.TYPE_SINT64: "builtins.int", +} + +PROTO_DEFAULTS: Final[dict[int, str]] = { + descriptor.FieldDescriptorProto.TYPE_DOUBLE: "0.0", + descriptor.FieldDescriptorProto.TYPE_FLOAT: "0.0", + descriptor.FieldDescriptorProto.TYPE_INT64: "0", + descriptor.FieldDescriptorProto.TYPE_UINT64: "0", + descriptor.FieldDescriptorProto.TYPE_INT32: "0", + descriptor.FieldDescriptorProto.TYPE_FIXED64: "0", + descriptor.FieldDescriptorProto.TYPE_FIXED32: "0", + descriptor.FieldDescriptorProto.TYPE_BOOL: "False", + descriptor.FieldDescriptorProto.TYPE_STRING: '""', + descriptor.FieldDescriptorProto.TYPE_BYTES: 'b""', + descriptor.FieldDescriptorProto.TYPE_UINT32: "0", + descriptor.FieldDescriptorProto.TYPE_SFIXED32: "0", + descriptor.FieldDescriptorProto.TYPE_SFIXED64: "0", + descriptor.FieldDescriptorProto.TYPE_SINT32: "0", + descriptor.FieldDescriptorProto.TYPE_SINT64: "0", +} + +INT64_TYPES: Final[set[int]] = { + descriptor.FieldDescriptorProto.TYPE_INT64, + descriptor.FieldDescriptorProto.TYPE_UINT64, + descriptor.FieldDescriptorProto.TYPE_FIXED64, + descriptor.FieldDescriptorProto.TYPE_SFIXED64, + descriptor.FieldDescriptorProto.TYPE_SINT64, +} + +HEX_ENCODED_FIELDS: Final[set[str]] = { + "trace_id", + "span_id", + "parent_span_id", +} + + +def get_python_type(proto_type: int) -> str: + """ + Get the Python type corresponding to a protobuf field type. + + Args: + proto_type: The protobuf field type as an integer (from FieldDescriptorProto). + Returns: + A string representing the Python type + """ + return PROTO_TO_PYTHON.get(proto_type, "typing.Any") + + +def get_default_value(proto_type: int) -> str: + """ + Get the default value for a protobuf field type as a string. + + Args: + proto_type: The protobuf field type as an integer (from FieldDescriptorProto). + Returns: + A string representing the default value for that type + """ + return PROTO_DEFAULTS.get(proto_type, "None") + + +def is_int64_type(proto_type: int) -> bool: + """ + Check if type is a 64-bit integer type (int64, uint64, fixed64, sfixed64, sint64) + + Args: + proto_type: The protobuf field type as an integer (from FieldDescriptorProto). + Returns: + True if the type is a 64-bit integer type, False otherwise. + """ + return proto_type in INT64_TYPES + + +def is_bytes_type(proto_type: int) -> bool: + """ + Check if type is bytes. + + Args: + proto_type: The protobuf field type as an integer (from FieldDescriptorProto). + Returns: + True if the type is bytes, False otherwise. + """ + return proto_type == descriptor.FieldDescriptorProto.TYPE_BYTES + + +def is_hex_encoded_field(field_name: str) -> bool: + """ + Check if field is a hex-encoded field (trace_id, span_id, parent_span_id). + + Args: + field_name: The name of the protobuf field. + Returns: + True if the field is a hex-encoded field, False otherwise. + """ + return field_name in HEX_ENCODED_FIELDS + + +def to_json_field_name(snake_name: str) -> str: + """ + Convert snake_case field name to camelCase for JSON representation. + + Args: + snake_name: The field name in snake_case. + Returns: + The field name converted to camelCase.k + """ + components = snake_name.split("_") + return components[0] + "".join(x.title() for x in components[1:]) + + +def is_numeric_type(proto_type: int) -> bool: + """ + Check if the protobuf field type is a numeric type (int32, int64, uint32, uint64, float, double). + + Args: + proto_type: The protobuf field type as an integer (from FieldDescriptorProto). + Returns: + True if the type is a numeric type, False otherwise. + """ + if proto_type in INT64_TYPES: + return True + return proto_type in { + descriptor.FieldDescriptorProto.TYPE_DOUBLE, + descriptor.FieldDescriptorProto.TYPE_FLOAT, + descriptor.FieldDescriptorProto.TYPE_INT32, + descriptor.FieldDescriptorProto.TYPE_FIXED32, + descriptor.FieldDescriptorProto.TYPE_UINT32, + descriptor.FieldDescriptorProto.TYPE_SFIXED32, + descriptor.FieldDescriptorProto.TYPE_SINT32, + } + + +def get_json_allowed_types(proto_type: int, field_name: str = "") -> str: + """ + Get the Python type(s) allowed for the JSON representation of a field. + + Args: + proto_type: The protobuf field type as an integer (from FieldDescriptorProto). + field_name: The name of the protobuf field (used to determine if it's hex-encoded) + + Returns: + A string representing the allowed Python type(s) for the JSON representation of the field. + """ + if is_hex_encoded_field(field_name): + return "builtins.str" + if is_int64_type(proto_type): + return "(builtins.int, builtins.str)" + if is_bytes_type(proto_type): + return "builtins.str" + if proto_type in ( + descriptor.FieldDescriptorProto.TYPE_FLOAT, + descriptor.FieldDescriptorProto.TYPE_DOUBLE, + ): + return "(builtins.float, builtins.int, builtins.str)" + + py_type = get_python_type(proto_type) + return py_type diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/version/__init__.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/version/__init__.py new file mode 100644 index 00000000000..c099e9440e9 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/version/__init__.py @@ -0,0 +1,15 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +__version__ = "0.61b0.dev" diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py new file mode 100644 index 00000000000..337fd0edc52 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py @@ -0,0 +1,459 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +from collections.abc import Iterable +from contextlib import contextmanager +from typing import Any, Generator, Optional, Union + + +class CodeWriter: + def __init__(self, indent_size: int = 4) -> None: + """ + Initializes a new CodeWriter instance. + + Args: + indent_size: Number of spaces for each indentation level (default: 4) + """ + self._lines: list[str] = [] + self._indent_level: int = 0 + self._indent_size: int = indent_size + + @contextmanager + def indent(self) -> Generator[CodeWriter, None, None]: + """ + Context manager to increase indentation level for a block of code. + """ + self._indent_level += 1 + try: + yield self + finally: + self._indent_level -= 1 + + def writeln(self, line: str = "") -> CodeWriter: + """ + Writes a line of code with proper indentation. If the line is empty, it writes a blank line. + + Args: + line: The line of code to write (default: empty string for a blank line) + Returns: + The CodeWriter instance + """ + if not line: + self._lines.append("") + return self + indent = " " * (self._indent_level * self._indent_size) + self._lines.append(f"{indent}{line}") + return self + + def writemany(self, *lines: str) -> CodeWriter: + """ + Writes multiple lines of code with proper indentation. + + Args: + *lines: Variable number of lines to write + Returns: + The CodeWriter instance + """ + for line in lines: + self.writeln(line) + return self + + def comment(self, content: Union[str, Iterable[str]]) -> CodeWriter: + """ + Writes a comment line or block. If content is a string, it writes a single comment line. + + Args: + content: A string for a single comment line or an iterable of strings for multiple comment lines + Returns: + The CodeWriter instance + """ + if isinstance(content, str): + self.writeln(f"# {content}" if content else "#") + return self + for line in content: + self.writeln(f"# {line}" if line else "#") + return self + + def docstring(self, content: Union[str, Iterable[str]]) -> CodeWriter: + """ + Writes a docstring. If content is a string, it writes a single-line docstring. If content is an iterable of strings, it writes a multi-line docstring. + + Args: + content: A string for a single-line docstring or an iterable of strings for a multi line docstring + Returns: + The CodeWriter instance + """ + if isinstance(content, str): + self.writeln(f'"""{content}"""') + return self + self.writeln('"""') + for line in content: + self.writeln(line) + self.writeln('"""') + return self + + def import_(self, module: str, *items: str) -> CodeWriter: + """ + Writes an import statement. If items are provided, it writes a from-import statement. + Otherwise, it writes a regular import statement. + + Args: + module: The module to import + *items: Optional items to import from the module (if empty, imports the whole module) + Returns: + The CodeWriter instance + """ + if items: + self.writeln(f"from {module} import {', '.join(items)}") + else: + self.writeln(f"import {module}") + return self + + @contextmanager + def suite(self, header: str) -> Generator[CodeWriter, None, None]: + """ + Create a generic code block with a header (e.g. if, for, while, try, etc.) + + Args: + header: The header line for the code block + """ + self.writeln(header) + with self.indent(): + yield self + + @contextmanager + def class_( + self, + name: str, + bases: Optional[Iterable[str]] = None, + decorators: Optional[Iterable[str]] = None, + ) -> Generator[CodeWriter, None, None]: + """ + Generate a class definition with optional base classes and decorators. + + Args: + name: The name of the class + bases: Optional iterable of base class names + decorators: Optional iterable of decorator names + """ + if decorators is not None: + for dec in decorators: + self.writeln(f"@{dec}") + + bases_str = f"({', '.join(bases)})" if bases else "" + self.writeln(f"class {name}{bases_str}:") + + with self.indent(): + yield self + + @contextmanager + def dataclass( + self, + name: str, + bases: Optional[Iterable[str]] = None, + decorators: Optional[Iterable[str]] = None, + frozen: bool = False, + slots: bool = False, + decorator_name: str = "dataclasses.dataclass", + ) -> Generator[CodeWriter, None, None]: + """ + Generate a dataclass definition with optional base classes, decorators and dataclass parameters. + + Args: + name: The name of the dataclass + bases: Optional iterable of base class names + decorators: Optional iterable of additional decorator names + frozen: Whether to set frozen=True in the dataclass decorator + slots: Whether to set slots=True in the dataclass decorator + decorator_name: The full name of the dataclass decorator to use + """ + dc_params = [] + if frozen: + dc_params.append("frozen=True") + if slots: + dc_params.append("slots=True") + + dc_decorator = ( + f"{decorator_name}({', '.join(dc_params)})" + if dc_params + else decorator_name + ) + + all_decorators = [] + if decorators is not None: + all_decorators.extend(decorators) + all_decorators.append(dc_decorator) + + for dec in all_decorators: + self.writeln(f"@{dec}") + + bases_str = f"({', '.join(bases)})" if bases else "" + self.writeln(f"class {name}{bases_str}:") + + with self.indent(): + yield self + + @contextmanager + def enum( + self, + name: str, + enum_type: str = "enum.Enum", + bases: Optional[Iterable[str]] = None, + decorators: Optional[Iterable[str]] = None, + ) -> Generator[CodeWriter, None, None]: + """ + Generate an enum definition with optional base classes and decorators. + + Args: + name: The name of the enum + enum_type: The base enum type to inherit from (default: "enum.Enum") + bases: Optional iterable of additional base class names + decorators: Optional iterable of decorator names + """ + if decorators is not None: + for dec in decorators: + self.writeln(f"@{dec}") + + all_bases = [enum_type] + if bases is not None: + all_bases.extend(bases) + + bases_str = ", ".join(all_bases) + self.writeln(f"class {name}({bases_str}):") + + with self.indent(): + yield self + + def field( + self, + name: str, + type_hint: str, + default: Any = None, + default_factory: Optional[str] = None, + ) -> CodeWriter: + """ + Write a dataclass field with optional default value or default factory. + + Args: + name: The name of the field + type_hint: The type hint for the field + default: Optional default value for the field + default_factory: Optional default factory for the field + """ + if default_factory: + self.writeln( + f"{name}: {type_hint} = dataclasses.field(default_factory={default_factory})" + ) + elif default is not None: + self.writeln(f"{name}: {type_hint} = {default}") + else: + self.writeln(f"{name}: {type_hint}") + return self + + def enum_member(self, name: str, value: Any) -> CodeWriter: + """ + Write an enum member with a specific value. + + Args: + name: The name of the enum member + value: The value of the enum member + """ + self.writeln(f"{name} = {value}") + return self + + @contextmanager + def function( + self, + name: str, + params: Union[Iterable[str], str], + decorators: Optional[Iterable[str]] = None, + return_type: Optional[str] = None, + ) -> Generator[CodeWriter, None, None]: + """ + Create a function definition with optional decorators and return type. + + Args: + name: The name of the function + params: An iterable of parameter strings or a single string for the parameter list + decorators: Optional iterable of decorator names + return_type: Optional return type hint for the function + """ + if decorators is not None: + for dec in decorators: + self.writeln(f"@{dec}") + + params_str = params if isinstance(params, str) else ", ".join(params) + return_annotation = f" -> {return_type}" if return_type else "" + self.writeln(f"def {name}({params_str}){return_annotation}:") + + with self.indent(): + yield self + + @contextmanager + def method( + self, + name: str, + params: Union[Iterable[str], str], + decorators: Optional[Iterable[str]] = None, + return_type: Optional[str] = None, + ) -> Generator[CodeWriter, None, None]: + """ + Create a method definition within a class with optional decorators and return type. + + Args: + name: The name of the method + params: An iterable of parameter strings or a single string for the parameter list + decorators: Optional iterable of decorator names + return_type: Optional return type hint for the method + """ + with self.function( + name, params, decorators=decorators, return_type=return_type + ): + yield self + + @contextmanager + def if_(self, condition: str) -> Generator[CodeWriter, None, None]: + """ + Create an if block + + Args: + condition: The condition for the if statement + """ + self.writeln(f"if {condition}:") + with self.indent(): + yield self + + @contextmanager + def elif_(self, condition: str) -> Generator[CodeWriter, None, None]: + """ + Create an elif block + + Args: + condition: The condition for the elif statement + """ + self.writeln(f"elif {condition}:") + with self.indent(): + yield self + + @contextmanager + def else_(self) -> Generator[CodeWriter, None, None]: + """ + Create an else block + """ + self.writeln("else:") + with self.indent(): + yield self + + @contextmanager + def for_( + self, var: str, iterable: str + ) -> Generator[CodeWriter, None, None]: + """ + Create a for loop + + Args: + var: The loop variable + iterable: The iterable to loop over + """ + self.writeln(f"for {var} in {iterable}:") + with self.indent(): + yield self + + @contextmanager + def while_(self, condition: str) -> Generator[CodeWriter, None, None]: + """ + Create a while loop + + Args: + condition: The condition for the while loop + """ + self.writeln(f"while {condition}:") + with self.indent(): + yield self + + def assignment( + self, var: str, value: str, type_hint: Optional[str] = None + ) -> CodeWriter: + """ + Write a variable assignment with optional type hint + + Args: + var: The variable name + value: The value to assign to the variable + type_hint: Optional type hint for the variable + Returns: + The CodeWriter instance + """ + if type_hint: + self.writeln(f"{var}: {type_hint} = {value}") + else: + self.writeln(f"{var} = {value}") + return self + + def return_(self, value: Optional[str] = None) -> CodeWriter: + """ + Write a return statement with an optional return value + + Args: + value: The value to return (if None, writes a bare return statement) + Returns: + The CodeWriter instance + """ + if value: + self.writeln(f"return {value}") + else: + self.writeln("return") + return self + + def pass_(self) -> CodeWriter: + """ + Write a pass statement + + Returns: + The CodeWriter instance + """ + self.writeln("pass") + return self + + def blank_line(self, count: int = 1) -> CodeWriter: + """ + Write one or more blank lines + + Args: + count: The number of blank lines to write + Returns: + The CodeWriter instance + """ + self._lines.extend([""] * count) + return self + + def to_string(self) -> str: + """ + Get the generated code as a single string with newline characters separating lines. + + Returns: + A string containing the entire generated code. + """ + return "\n".join(self._lines) + + def to_lines(self) -> list[str]: + """ + Get the generated code as a list of lines + + Returns: + A list of strings, where each string is a line of generated code. + """ + return self._lines diff --git a/codegen/opentelemetry-codegen-json/test-requirements.txt b/codegen/opentelemetry-codegen-json/test-requirements.txt new file mode 100644 index 00000000000..4353bc55b5f --- /dev/null +++ b/codegen/opentelemetry-codegen-json/test-requirements.txt @@ -0,0 +1,12 @@ +importlib-metadata==6.11.0 +iniconfig==2.0.0 +packaging==24.0 +pluggy==1.5.0 +protobuf==6.31.1 +pytest==7.4.4 +tomli==2.0.1 +typing_extensions==4.12.0 +zipp==3.19.2 +grpcio==1.78.0 +grpcio-tools==1.78.0 +-e codegen/opentelemetry-codegen-json diff --git a/codegen/opentelemetry-codegen-json/tests/__init__.py b/codegen/opentelemetry-codegen-json/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/codegen/opentelemetry-codegen-json/tests/conftest.py b/codegen/opentelemetry-codegen-json/tests/conftest.py new file mode 100644 index 00000000000..4443caff6e6 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/tests/conftest.py @@ -0,0 +1,30 @@ +import subprocess +import sys +from pathlib import Path + +import pytest + +PROTO_PATH = Path(__file__).parent / "proto" +GEN_PATH = Path(__file__).parent / "generated" + + +@pytest.fixture(scope="session", autouse=True) +def generate_code(tmp_path_factory: pytest.TempPathFactory) -> None: + gen_path = tmp_path_factory.mktemp("generated") + + protos = list(PROTO_PATH.glob("**/*.proto")) + proto_files = [str(p.relative_to(PROTO_PATH)) for p in protos] + + subprocess.check_call( + [ + sys.executable, + "-m", + "grpc_tools.protoc", + f"-I{PROTO_PATH}", + f"--otlp_json_out={gen_path}", + f"--python_out={gen_path}", + *proto_files, + ] + ) + + sys.path.insert(0, str(gen_path.absolute())) diff --git a/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/common/v1/common.proto b/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/common/v1/common.proto new file mode 100644 index 00000000000..2799bcbad92 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/common/v1/common.proto @@ -0,0 +1,22 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package otel_test_json.common.v1; + +message InstrumentationScope { + string name = 1; + string version = 2; +} diff --git a/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/test/v1/complex.proto b/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/test/v1/complex.proto new file mode 100644 index 00000000000..7ef705aab66 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/test/v1/complex.proto @@ -0,0 +1,70 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package otel_test_json.test.v1; + +import "otel_test_json/common/v1/common.proto"; + +message NumericTest { + double d_val = 1; + float f_val = 2; + int64 i64_val = 3; + uint64 u64_val = 4; + int32 i32_val = 5; + uint32 u32_val = 6; + sint32 si32_val = 7; + sint64 si64_val = 8; + fixed32 f32_val = 9; + fixed64 f64_val = 10; + sfixed32 sf32_val = 11; + sfixed64 sf64_val = 12; +} + +message OneofSuite { + oneof group1 { + string g1_string = 1; + int32 g1_int = 2; + } + oneof group2 { + otel_test_json.common.v1.InstrumentationScope g2_message = 3; + NestedMessage g2_nested = 4; + } + + message NestedMessage { + string hint = 1; + } +} + +message OptionalScalar { + optional string opt_string = 1; + optional int32 opt_int = 2; + optional bool opt_bool = 3; +} + +message NestedEnumSuite { + enum NestedEnum { + NESTED_UNSPECIFIED = 0; + NESTED_FOO = 1; + NESTED_BAR = 2; + } + NestedEnum nested = 1; + repeated NestedEnum repeated_nested = 2; +} + +message DeeplyNested { + string value = 1; + DeeplyNested next = 2; +} diff --git a/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/test/v1/test.proto b/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/test/v1/test.proto new file mode 100644 index 00000000000..34968a7ae3b --- /dev/null +++ b/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/test/v1/test.proto @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package otel_test_json.test.v1; + +message TestMessage { + enum TestEnum { + UNSPECIFIED = 0; + SUCCESS = 1; + FAILURE = 2; + } + + // Scalar types + string name = 1; + int32 int_value = 2; + bool bool_value = 3; + double double_value = 4; + + // Special OTLP types + int64 int64_value = 5; + uint64 uint64_value = 6; + bytes bytes_value = 7; + + // Hex encoded fields (per OTLP spec) + bytes trace_id = 8; + bytes span_id = 9; + + // Repeated fields + repeated string list_strings = 10; + repeated int32 list_ints = 11; + + // Nested message and enum + TestEnum enum_value = 12; + SubMessage sub_message = 13; + repeated SubMessage list_messages = 14; + + // Oneof group + oneof test_oneof { + string oneof_string = 15; + int32 oneof_int = 16; + } +} + +message SubMessage { + string content = 1; +} diff --git a/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/trace/v1/trace.proto b/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/trace/v1/trace.proto new file mode 100644 index 00000000000..ce98ecb7761 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/tests/proto/otel_test_json/trace/v1/trace.proto @@ -0,0 +1,24 @@ +// Copyright The OpenTelemetry Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package otel_test_json.trace.v1; + +import "otel_test_json/common/v1/common.proto"; + +message Span { + string name = 1; + otel_test_json.common.v1.InstrumentationScope scope = 2; +} diff --git a/codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py b/codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py new file mode 100644 index 00000000000..51c1aee6d8f --- /dev/null +++ b/codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py @@ -0,0 +1,203 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import math +from typing import Optional, Union + +import pytest + +from opentelemetry.codegen.json.runtime.otlp_json_utils import ( + decode_base64, + decode_float, + decode_hex, + decode_int64, + decode_repeated, + encode_base64, + encode_float, + encode_hex, + encode_int64, + encode_repeated, + validate_type, +) + + +@pytest.mark.parametrize( + "value, expected", + [ + (b"\x01\x02\x03", "010203"), + (b"", ""), + (None, ""), + ], +) +def test_encode_hex(value: Optional[bytes], expected: str) -> None: + assert encode_hex(value) == expected + + +@pytest.mark.parametrize( + "value, expected", + [ + ("010203", b"\x01\x02\x03"), + ("", b""), + (None, b""), + ], +) +def test_decode_hex(value: Optional[str], expected: bytes) -> None: + assert decode_hex(value, "field") == expected + + +def test_decode_hex_errors() -> None: + with pytest.raises(TypeError): + decode_hex(123, "field") # type: ignore + with pytest.raises(ValueError, match="Invalid hex string"): + decode_hex("not hex", "field") + + +@pytest.mark.parametrize( + "value, expected", + [ + (b"hello", "aGVsbG8="), + (b"", ""), + (None, ""), + ], +) +def test_encode_base64(value: Optional[bytes], expected: str) -> None: + assert encode_base64(value) == expected + + +@pytest.mark.parametrize( + "value, expected", + [ + ("aGVsbG8=", b"hello"), + ("", b""), + (None, b""), + ], +) +def test_decode_base64(value: Optional[str], expected: bytes) -> None: + assert decode_base64(value, "field") == expected + + +def test_decode_base64_errors() -> None: + with pytest.raises(TypeError): + decode_base64(123, "field") # type: ignore + + +@pytest.mark.parametrize( + "value, expected", + [ + (123, "123"), + (0, "0"), + (-1, "-1"), + ], +) +def test_encode_int64(value: int, expected: str) -> None: + assert encode_int64(value) == expected + + +@pytest.mark.parametrize( + "value, expected", + [ + ("123", 123), + (123, 123), + (None, 0), + ], +) +def test_decode_int64(value: Optional[Union[int, str]], expected: int) -> None: + assert decode_int64(value, "field") == expected + + +def test_decode_int64_errors() -> None: + with pytest.raises(TypeError): + decode_int64([], "field") # type: ignore + with pytest.raises(ValueError, match="Invalid int64 value"): + decode_int64("abc", "field") + + +@pytest.mark.parametrize( + "value, expected", + [ + (1.5, 1.5), + (float("nan"), "NaN"), + (float("inf"), "Infinity"), + (float("-inf"), "-Infinity"), + ], +) +def test_encode_float(value: float, expected: Union[float, str]) -> None: + result = encode_float(value) + if isinstance(expected, float) and math.isnan(expected): + assert math.isnan(result) # type: ignore + else: + assert result == expected + + +@pytest.mark.parametrize( + "value, expected", + [ + (1.5, 1.5), + ("1.5", 1.5), + (1, 1.0), + ("NaN", math.nan), + ("Infinity", math.inf), + ("-Infinity", -math.inf), + (None, 0.0), + ], +) +def test_decode_float( + value: Optional[Union[float, int, str]], expected: float +) -> None: + result = decode_float(value, "field") + if math.isnan(expected): + assert math.isnan(result) + else: + assert result == expected + + +def test_decode_float_errors() -> None: + with pytest.raises(TypeError): + decode_float([], "field") # type: ignore + with pytest.raises(ValueError, match="Invalid float value"): + decode_float("abc", "field") + + +def test_repeated_fields() -> None: + values = [1, 2, 3] + assert encode_repeated(values, str) == ["1", "2", "3"] + assert encode_repeated([], str) == [] + assert encode_repeated(None, str) == [] # type: ignore + + assert decode_repeated(["1", "2"], int, "field") == [1, 2] + assert decode_repeated([], int, "field") == [] + assert decode_repeated(None, int, "field") == [] + + +def test_decode_repeated_errors() -> None: + with pytest.raises(TypeError): + decode_repeated("not a list", lambda x: x, "field") # type: ignore + + +def test_validate_type() -> None: + validate_type("s", str, "field") + validate_type(1, int, "field") + validate_type(1, (int, str), "field") + validate_type("s", (int, str), "field") + + with pytest.raises( + TypeError, match="Field 'field' expected , got str" + ): + validate_type("s", int, "field") + + with pytest.raises( + TypeError, + match=r"Field 'field' expected \(, \), got str", + ): + validate_type("s", (int, float), "field") diff --git a/codegen/opentelemetry-codegen-json/tests/test_protobuf_compatibility.py b/codegen/opentelemetry-codegen-json/tests/test_protobuf_compatibility.py new file mode 100644 index 00000000000..66224116018 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/tests/test_protobuf_compatibility.py @@ -0,0 +1,219 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ruff: noqa: PLC0415 + +import base64 +from typing import Any, Type + +import pytest +from google.protobuf import json_format + + +def normalize_otlp_json(data: Any) -> Any: + if isinstance(data, list): + return [normalize_otlp_json(item) for item in data] + if isinstance(data, dict): + return { + key: ( + base64.b64decode(value).hex() + if key in {"traceId", "spanId", "parentSpanId"} + and isinstance(value, str) + else normalize_otlp_json(value) + ) + for key, value in data.items() + } + return data + + +@pytest.fixture +def test_msg_classes() -> tuple[Type[Any], Type[Any], Type[Any]]: + from otel_test_json.test.v1.test import SubMessage as JSONSubMessage + from otel_test_json.test.v1.test import TestMessage as JSONTestMessage + from otel_test_json.test.v1.test_pb2 import TestMessage as ProtoTestMessage + + return JSONTestMessage, JSONSubMessage, ProtoTestMessage + + +@pytest.fixture +def numeric_msg_classes() -> tuple[Type[Any], Type[Any]]: + from otel_test_json.test.v1.complex import NumericTest as JSONNumericTest + from otel_test_json.test.v1.complex_pb2 import ( + NumericTest as ProtoNumericTest, + ) + + return JSONNumericTest, ProtoNumericTest + + +@pytest.fixture +def oneof_msg_classes() -> tuple[Type[Any], Type[Any], Type[Any]]: + from otel_test_json.common.v1.common import ( + InstrumentationScope as JSONScope, + ) + from otel_test_json.test.v1.complex import OneofSuite as JSONOneofSuite + from otel_test_json.test.v1.complex_pb2 import ( + OneofSuite as ProtoOneofSuite, + ) + + return JSONOneofSuite, ProtoOneofSuite, JSONScope + + +@pytest.fixture +def optional_msg_classes() -> tuple[Type[Any], Type[Any]]: + from otel_test_json.test.v1.complex import ( + OptionalScalar as JSONOptionalScalar, + ) + from otel_test_json.test.v1.complex_pb2 import ( + OptionalScalar as ProtoOptionalScalar, + ) + + return JSONOptionalScalar, ProtoOptionalScalar + + +def test_parity_test_message( + test_msg_classes: tuple[Type[Any], Type[Any], Type[Any]], +) -> None: + JSONTestMessage, JSONSubMessage, ProtoTestMessage = test_msg_classes + + kwargs: dict[str, Any] = { + "name": "test", + "int_value": 123, + "bool_value": True, + "double_value": 1.5, + "int64_value": 9223372036854775807, + "uint64_value": 18446744073709551615, + "bytes_value": b"hello", + "trace_id": b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\x0d\x0e\x0f", + "span_id": b"\x00\x01\x02\x03\x04\x05\x06\x07", + "list_strings": ["a", "b"], + "list_ints": [1, 2], + "enum_value": JSONTestMessage.TestEnum.SUCCESS, + "oneof_string": "oneof", + "sub_message": JSONSubMessage(content="sub"), + } + + json_msg = JSONTestMessage(**kwargs) + json_dict = json_msg.to_dict() + + proto_kwargs = kwargs.copy() + sub_msg_data = proto_kwargs.pop("sub_message") + proto_msg = ProtoTestMessage(**proto_kwargs) + proto_msg.sub_message.content = sub_msg_data.content + + proto_dict = json_format.MessageToDict( + proto_msg, + preserving_proto_field_name=False, + use_integers_for_enums=True, + ) + + assert json_dict == normalize_otlp_json(proto_dict) + + +@pytest.mark.parametrize( + "values", + [ + {"d_val": float("nan")}, + {"f_val": float("inf")}, + {"f_val": float("-inf")}, + {"i64_val": 9223372036854775807}, + {"i64_val": -9223372036854775808}, + {"u64_val": 18446744073709551615}, + {"i32_val": -2147483648}, + {"i32_val": 2147483647}, + {"si64_val": -9223372036854775808}, + {"f64_val": 9223372036854775807}, + ], +) +def test_parity_numeric_test( + numeric_msg_classes: tuple[Type[Any], Type[Any]], values: dict[str, Any] +) -> None: + JSONNumericTest, ProtoNumericTest = numeric_msg_classes + + json_msg = JSONNumericTest(**values) + proto_msg = ProtoNumericTest(**values) + + json_dict = json_msg.to_dict() + proto_dict = json_format.MessageToDict( + proto_msg, + use_integers_for_enums=True, + ) + + assert json_dict == normalize_otlp_json(proto_dict) + + +@pytest.mark.parametrize( + "branch_data", + [ + {"g1_string": "hello", "g2_nested": {"hint": "test"}}, + {"g1_int": 42, "g2_message": {"name": "scope"}}, + ], +) +def test_parity_oneof_suite( + oneof_msg_classes: tuple[Type[Any], Type[Any], Type[Any]], + branch_data: dict[str, Any], +) -> None: + JSONOneofSuite, ProtoOneofSuite, JSONScope = oneof_msg_classes + + json_kwargs = {} + for k, v in branch_data.items(): + if k == "g2_nested": + json_kwargs[k] = JSONOneofSuite.NestedMessage(**v) + elif k == "g2_message": + json_kwargs[k] = JSONScope(**v) + else: + json_kwargs[k] = v + + json_msg = JSONOneofSuite(**json_kwargs) + + proto_msg = ProtoOneofSuite() + for k, v in branch_data.items(): + if k == "g1_string": + proto_msg.g1_string = v + elif k == "g1_int": + proto_msg.g1_int = v + elif k == "g2_nested": + proto_msg.g2_nested.hint = v["hint"] + elif k == "g2_message": + proto_msg.g2_message.name = v["name"] + + assert json_msg.to_dict() == normalize_otlp_json( + json_format.MessageToDict( + proto_msg, + use_integers_for_enums=True, + ) + ) + + +@pytest.mark.parametrize( + "kwargs", + [ + {"opt_string": "foo", "opt_int": 42, "opt_bool": True}, + {}, + {"opt_string": "", "opt_int": 0, "opt_bool": False}, + ], +) +def test_parity_optional_scalars( + optional_msg_classes: tuple[Type[Any], Type[Any]], kwargs: dict[str, Any] +) -> None: + JSONOptionalScalar, ProtoOptionalScalar = optional_msg_classes + + json_msg = JSONOptionalScalar(**kwargs) + proto_msg = ProtoOptionalScalar(**kwargs) + + assert json_msg.to_dict() == normalize_otlp_json( + json_format.MessageToDict( + proto_msg, + use_integers_for_enums=True, + ) + ) diff --git a/codegen/opentelemetry-codegen-json/tests/test_serdes.py b/codegen/opentelemetry-codegen-json/tests/test_serdes.py new file mode 100644 index 00000000000..49da1617389 --- /dev/null +++ b/codegen/opentelemetry-codegen-json/tests/test_serdes.py @@ -0,0 +1,344 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# ruff: noqa: PLC0415 + +import json +import math +from typing import Any, Type + +import pytest + + +@pytest.fixture +def test_v1_types() -> tuple[Type[Any], Type[Any]]: + from otel_test_json.test.v1.test import SubMessage, TestMessage + + return TestMessage, SubMessage + + +@pytest.fixture +def common_v1_types() -> Type[Any]: + from otel_test_json.common.v1.common import InstrumentationScope + + return InstrumentationScope + + +@pytest.fixture +def trace_v1_types() -> Type[Any]: + from otel_test_json.trace.v1.trace import Span + + return Span + + +@pytest.fixture +def complex_v1_types() -> tuple[ + Type[Any], Type[Any], Type[Any], Type[Any], Type[Any] +]: + from otel_test_json.test.v1.complex import ( + DeeplyNested, + NestedEnumSuite, + NumericTest, + OneofSuite, + OptionalScalar, + ) + + return ( + NumericTest, + OneofSuite, + OptionalScalar, + NestedEnumSuite, + DeeplyNested, + ) + + +def test_generated_message_roundtrip( + test_v1_types: tuple[Type[Any], Type[Any]], +) -> None: + TestMessage, SubMessage = test_v1_types + + msg = TestMessage( + name="test", + int_value=123, + bool_value=True, + double_value=1.5, + int64_value=9223372036854775807, + uint64_value=18446744073709551615, + bytes_value=b"hello", + trace_id=b"\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\x0d\x0e\x0f", + span_id=b"\x00\x01\x02\x03\x04\x05\x06", + list_strings=["a", "b"], + list_ints=[1, 2], + enum_value=TestMessage.TestEnum.SUCCESS, + sub_message=SubMessage(content="sub"), + list_messages=[SubMessage(content="m1"), SubMessage(content="m2")], + oneof_string="oneof", + ) + + json_str = msg.to_json() + data = json.loads(json_str) + + assert data["name"] == "test" + assert data["intValue"] == 123 + assert data["boolValue"] is True + assert data["doubleValue"] == 1.5 + assert data["int64Value"] == "9223372036854775807" + assert data["uint64Value"] == "18446744073709551615" + assert data["bytesValue"] == "aGVsbG8=" + assert data["traceId"] == "000102030405060708090a0b0c0d0e0f" + assert data["spanId"] == "00010203040506" + assert data["listStrings"] == ["a", "b"] + assert data["listInts"] == [1, 2] + assert data["enumValue"] == 1 + assert data["subMessage"]["content"] == "sub" + assert len(data["listMessages"]) == 2 + assert data["oneofString"] == "oneof" + assert "oneofInt" not in data + + new_msg = TestMessage.from_json(json_str) + assert new_msg == msg + + +def test_cross_reference( + common_v1_types: Type[Any], trace_v1_types: Type[Any] +) -> None: + InstrumentationScope = common_v1_types + Span = trace_v1_types + + span = Span( + name="my-span", + scope=InstrumentationScope(name="my-scope", version="1.0.0"), + ) + + json_str = span.to_json() + data = json.loads(json_str) + + assert data["name"] == "my-span" + assert data["scope"]["name"] == "my-scope" + assert data["scope"]["version"] == "1.0.0" + + new_span = Span.from_json(json_str) + assert new_span == span + + +@pytest.mark.parametrize( + "field, value, expected_json_val", + [ + ("d_val", float("nan"), "NaN"), + ("d_val", float("inf"), "Infinity"), + ("d_val", float("-inf"), "-Infinity"), + ("d_val", 0.0, None), # Default values are omitted + ("d_val", -0.0, None), + ("i64_val", 9223372036854775807, "9223372036854775807"), + ("i64_val", -9223372036854775808, "-9223372036854775808"), + ("u64_val", 18446744073709551615, "18446744073709551615"), + ("i32_val", 2147483647, 2147483647), + ("i32_val", -2147483648, -2147483648), + ("u32_val", 4294967295, 4294967295), + ("si32_val", -123, -123), + ("si64_val", -456, "-456"), + ("f32_val", 789, 789), + ("f64_val", 101112, "101112"), + ("sf32_val", -131415, -131415), + ("sf64_val", -161718, "-161718"), + ], +) +def test_numeric_types( + complex_v1_types: tuple[Type[Any], ...], + field: str, + value: Any, + expected_json_val: Any, +) -> None: + NumericTest = complex_v1_types[0] + + msg = NumericTest(**{field: value}) + data = msg.to_dict() + + # Convert snake_case to lowerCamelCase for lookup + components = field.split("_") + json_field = components[0] + "".join(x.title() for x in components[1:]) + + if expected_json_val is None: + assert json_field not in data + else: + assert data[json_field] == expected_json_val + + new_msg = NumericTest.from_dict(data) + if isinstance(value, float) and math.isnan(value): + assert math.isnan(getattr(new_msg, field)) + else: + assert getattr(new_msg, field) == value + + +@pytest.mark.parametrize( + "kwargs, expected_data", + [ + ({"g1_string": "hello"}, {"g1String": "hello"}), + ({"g1_int": 42}, {"g1Int": 42}), + ({"g2_message": {"name": "scope"}}, {"g2Message": {"name": "scope"}}), + ({"g2_nested": {"hint": "test"}}, {"g2Nested": {"hint": "test"}}), + ], +) +def test_oneof_suite_variants( + common_v1_types: Type[Any], + complex_v1_types: tuple[Type[Any], ...], + kwargs: dict[str, Any], + expected_data: dict[str, Any], +) -> None: + InstrumentationScope = common_v1_types + OneofSuite = complex_v1_types[1] + + processed_kwargs = {} + for k, v in kwargs.items(): + if k == "g2_message": + processed_kwargs[k] = InstrumentationScope(**v) + elif k == "g2_nested": + processed_kwargs[k] = OneofSuite.NestedMessage(**v) + else: + processed_kwargs[k] = v + + msg = OneofSuite(**processed_kwargs) + data = msg.to_dict() + assert data == expected_data + + new_msg = OneofSuite.from_dict(data) + for k, v in processed_kwargs.items(): + assert getattr(new_msg, k) == v + + +@pytest.mark.parametrize( + "kwargs, expected_dict", + [ + ({}, {}), + ({"opt_string": ""}, {"optString": ""}), + ({"opt_string": "foo"}, {"optString": "foo"}), + ({"opt_int": 0}, {"optInt": 0}), + ({"opt_int": 42}, {"optInt": 42}), + ({"opt_bool": False}, {"optBool": False}), + ({"opt_bool": True}, {"optBool": True}), + ], +) +def test_optional_scalars( + complex_v1_types: tuple[Type[Any], ...], + kwargs: dict[str, Any], + expected_dict: dict[str, Any], +) -> None: + OptionalScalar = complex_v1_types[2] + + msg = OptionalScalar(**kwargs) + assert msg.to_dict() == expected_dict + assert OptionalScalar.from_dict(expected_dict) == msg + + +def test_nested_enum_suite(complex_v1_types: tuple[Type[Any], ...]) -> None: + NestedEnumSuite = complex_v1_types[3] + + msg = NestedEnumSuite( + nested=NestedEnumSuite.NestedEnum.NESTED_FOO, + repeated_nested=[ + NestedEnumSuite.NestedEnum.NESTED_FOO, + NestedEnumSuite.NestedEnum.NESTED_BAR, + ], + ) + + data = msg.to_dict() + assert data["nested"] == 1 + assert data["repeatedNested"] == [1, 2] + + new_msg = NestedEnumSuite.from_dict(data) + assert new_msg.nested == NestedEnumSuite.NestedEnum.NESTED_FOO + assert new_msg.repeated_nested == msg.repeated_nested + + +def test_deeply_nested(complex_v1_types: tuple[Type[Any], ...]) -> None: + DeeplyNested = complex_v1_types[4] + + msg = DeeplyNested( + value="1", + next=DeeplyNested(value="2", next=DeeplyNested(value="3")), + ) + + data = msg.to_dict() + assert data["value"] == "1" + assert data["next"]["value"] == "2" + assert data["next"]["next"]["value"] == "3" + + new_msg = DeeplyNested.from_dict(data) + assert new_msg.value == "1" + assert new_msg.next.value == "2" + assert new_msg.next.next.value == "3" + + +@pytest.mark.parametrize( + "data, expected_name, expected_int", + [ + ({"name": None, "intValue": None}, "", 0), + ({"name": "test"}, "test", 0), + ({"intValue": 42}, "", 42), + ], +) +def test_defaults_and_none( + test_v1_types: tuple[Type[Any], Type[Any]], + data: dict[str, Any], + expected_name: str, + expected_int: int, +) -> None: + TestMessage, _ = test_v1_types + + msg = TestMessage.from_dict(data) + assert msg.name == expected_name + assert msg.int_value == expected_int + + +@pytest.mark.parametrize( + "data, expected_error, match", + [ + ({"intValue": "not an int"}, TypeError, "expected "), + ({"traceId": "invalid hex"}, ValueError, "Invalid hex string"), + ({"listStrings": "not a list"}, TypeError, "expected "), + ({"name": 123}, TypeError, "expected "), + ({"subMessage": "not a dict"}, TypeError, "expected "), + ({"enumValue": "SUCCESS"}, TypeError, "expected "), + ({"listMessages": [None]}, TypeError, "expected "), + ], +) +def test_validation_errors( + test_v1_types: tuple[Type[Any], Type[Any]], + data: dict[str, Any], + expected_error: type, + match: str, +) -> None: + TestMessage, _ = test_v1_types + + with pytest.raises( + expected_error, + match=match if isinstance(expected_error, TypeError) else None, + ): + TestMessage.from_dict(data) + + +def test_unknown_fields_ignored( + test_v1_types: tuple[Type[Any], Type[Any]], +) -> None: + TestMessage, _ = test_v1_types + + # Unknown fields should be ignored for forward compatibility + data = { + "name": "test", + "unknownField": "should be ignored", + "intValue": 10, + } + msg = TestMessage.from_dict(data) + assert msg.name == "test" + assert msg.int_value == 10 diff --git a/codegen/opentelemetry-codegen-json/tests/test_types.py b/codegen/opentelemetry-codegen-json/tests/test_types.py new file mode 100644 index 00000000000..bed82b0f59a --- /dev/null +++ b/codegen/opentelemetry-codegen-json/tests/test_types.py @@ -0,0 +1,154 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pytest +from google.protobuf import descriptor_pb2 as descriptor + +from opentelemetry.codegen.json.types import ( + get_default_value, + get_json_allowed_types, + get_python_type, + is_bytes_type, + is_hex_encoded_field, + is_int64_type, + is_numeric_type, + to_json_field_name, +) + + +@pytest.mark.parametrize( + "proto_type, expected", + [ + (descriptor.FieldDescriptorProto.TYPE_DOUBLE, "builtins.float"), + (descriptor.FieldDescriptorProto.TYPE_INT64, "builtins.int"), + (descriptor.FieldDescriptorProto.TYPE_BOOL, "builtins.bool"), + (descriptor.FieldDescriptorProto.TYPE_STRING, "builtins.str"), + (descriptor.FieldDescriptorProto.TYPE_BYTES, "builtins.bytes"), + (999, "typing.Any"), + ], +) +def test_get_python_type(proto_type: int, expected: str) -> None: + assert get_python_type(proto_type) == expected + + +@pytest.mark.parametrize( + "proto_type, expected", + [ + (descriptor.FieldDescriptorProto.TYPE_DOUBLE, "0.0"), + (descriptor.FieldDescriptorProto.TYPE_INT64, "0"), + (descriptor.FieldDescriptorProto.TYPE_BOOL, "False"), + (descriptor.FieldDescriptorProto.TYPE_STRING, '""'), + (descriptor.FieldDescriptorProto.TYPE_BYTES, 'b""'), + (999, "None"), + ], +) +def test_get_default_value(proto_type: int, expected: str) -> None: + assert get_default_value(proto_type) == expected + + +@pytest.mark.parametrize( + "proto_type, expected", + [ + (descriptor.FieldDescriptorProto.TYPE_INT64, True), + (descriptor.FieldDescriptorProto.TYPE_UINT64, True), + (descriptor.FieldDescriptorProto.TYPE_FIXED64, True), + (descriptor.FieldDescriptorProto.TYPE_SFIXED64, True), + (descriptor.FieldDescriptorProto.TYPE_SINT64, True), + (descriptor.FieldDescriptorProto.TYPE_INT32, False), + (descriptor.FieldDescriptorProto.TYPE_STRING, False), + ], +) +def test_is_int64_type(proto_type: int, expected: bool) -> None: + assert is_int64_type(proto_type) == expected + + +@pytest.mark.parametrize( + "proto_type, expected", + [ + (descriptor.FieldDescriptorProto.TYPE_BYTES, True), + (descriptor.FieldDescriptorProto.TYPE_STRING, False), + ], +) +def test_is_bytes_type(proto_type: int, expected: bool) -> None: + assert is_bytes_type(proto_type) == expected + + +@pytest.mark.parametrize( + "field_name, expected", + [ + ("trace_id", True), + ("span_id", True), + ("parent_span_id", True), + ("name", False), + ("time_unix_nano", False), + ], +) +def test_is_hex_encoded_field(field_name: str, expected: bool) -> None: + assert is_hex_encoded_field(field_name) == expected + + +@pytest.mark.parametrize( + "snake_name, expected", + [ + ("name", "name"), + ("start_time_unix_nano", "startTimeUnixNano"), + ("trace_id", "traceId"), + ("multiple___underscores", "multipleUnderscores"), + ], +) +def test_to_json_field_name(snake_name: str, expected: str) -> None: + assert to_json_field_name(snake_name) == expected + + +@pytest.mark.parametrize( + "proto_type, expected", + [ + (descriptor.FieldDescriptorProto.TYPE_DOUBLE, True), + (descriptor.FieldDescriptorProto.TYPE_INT64, True), + (descriptor.FieldDescriptorProto.TYPE_INT32, True), + (descriptor.FieldDescriptorProto.TYPE_BOOL, False), + (descriptor.FieldDescriptorProto.TYPE_STRING, False), + ], +) +def test_is_numeric_type(proto_type: int, expected: bool) -> None: + assert is_numeric_type(proto_type) == expected + + +@pytest.mark.parametrize( + "proto_type, field_name, expected", + [ + (descriptor.FieldDescriptorProto.TYPE_BYTES, "data", "builtins.str"), + ( + descriptor.FieldDescriptorProto.TYPE_STRING, + "trace_id", + "builtins.str", + ), + ( + descriptor.FieldDescriptorProto.TYPE_INT64, + "count", + "(builtins.int, builtins.str)", + ), + ( + descriptor.FieldDescriptorProto.TYPE_DOUBLE, + "value", + "(builtins.float, builtins.int, builtins.str)", + ), + (descriptor.FieldDescriptorProto.TYPE_BOOL, "flag", "builtins.bool"), + (descriptor.FieldDescriptorProto.TYPE_INT32, "id", "builtins.int"), + ], +) +def test_get_json_allowed_types( + proto_type: int, field_name: str, expected: str +) -> None: + assert get_json_allowed_types(proto_type, field_name) == expected diff --git a/codegen/opentelemetry-codegen-json/tests/test_writer.py b/codegen/opentelemetry-codegen-json/tests/test_writer.py new file mode 100644 index 00000000000..647b6efce8e --- /dev/null +++ b/codegen/opentelemetry-codegen-json/tests/test_writer.py @@ -0,0 +1,244 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from typing import Any, Optional + +import pytest + +from opentelemetry.codegen.json.writer import CodeWriter + + +def test_initialization() -> None: + writer = CodeWriter(indent_size=2) + assert writer._indent_size == 2 + assert writer.to_lines() == [] + assert writer.to_string() == "" + + +def test_writeln_indentation() -> None: + writer = CodeWriter(indent_size=4) + writer.writeln("line1") + with writer.indent(): + writer.writeln("line2") + with writer.indent(): + writer.writeln("line3") + writer.writeln("line4") + + expected = ["line1", " line2", " line3", "line4"] + assert writer.to_lines() == expected + + +def test_writemany() -> None: + writer = CodeWriter() + writer.writemany("a", "b", "c") + assert writer.to_lines() == ["a", "b", "c"] + + +@pytest.mark.parametrize( + "content, expected", + [ + ("single line", ["# single line"]), + (["line1", "line2"], ["# line1", "# line2"]), + ], +) +def test_comment(content: str, expected: list[str]) -> None: + writer = CodeWriter() + writer.comment(content) + assert writer.to_lines() == expected + + +@pytest.mark.parametrize( + "content, expected", + [ + ("single line", ['"""single line"""']), + (["line1", "line2"], ['"""', "line1", "line2", '"""']), + ], +) +def test_docstring(content: str, expected: list[str]) -> None: + writer = CodeWriter() + writer.docstring(content) + assert writer.to_lines() == expected + + +@pytest.mark.parametrize( + "module, items, expected", + [ + ("os", [], ["import os"]), + ("typing", ["Any", "Optional"], ["from typing import Any, Optional"]), + ], +) +def test_import(module: str, items: list[str], expected: list[str]) -> None: + writer = CodeWriter() + writer.import_(module, *items) + assert writer.to_lines() == expected + + +def test_suite() -> None: + writer = CodeWriter() + with writer.suite("def foo():"): + writer.writeln("pass") + assert writer.to_lines() == ["def foo():", " pass"] + + +@pytest.mark.parametrize( + "name, bases, decorators, expected", + [ + ("MyClass", None, None, ["class MyClass:"]), + ("MyClass", ["Base"], ["deco"], ["@deco", "class MyClass(Base):"]), + ( + "MyClass", + ["B1", "B2"], + ["d1", "d2"], + ["@d1", "@d2", "class MyClass(B1, B2):"], + ), + ], +) +def test_class( + name: str, + bases: Optional[str], + decorators: Optional[list[str]], + expected: list[str], +) -> None: + writer = CodeWriter() + with writer.class_(name, bases=bases, decorators=decorators): + pass + assert writer.to_lines() == expected + + +@pytest.mark.parametrize( + "kwargs, expected", + [ + ({"name": "DC"}, ["@dataclasses.dataclass", "class DC:"]), + ( + {"name": "DC", "frozen": True}, + ["@dataclasses.dataclass(frozen=True)", "class DC:"], + ), + ( + {"name": "DC", "slots": True}, + ["@dataclasses.dataclass(slots=True)", "class DC:"], + ), + ( + {"name": "DC", "frozen": True, "slots": True}, + ["@dataclasses.dataclass(frozen=True, slots=True)", "class DC:"], + ), + ( + {"name": "DC", "decorator_name": "custom.dc"}, + ["@custom.dc", "class DC:"], + ), + ], +) +def test_dataclass(kwargs: dict[str, Any], expected: list[str]) -> None: + writer = CodeWriter() + with writer.dataclass(**kwargs): + pass + assert writer.to_lines() == expected + + +def test_enum() -> None: + writer = CodeWriter() + with writer.enum("MyEnum", bases=["IntEnum"]): + writer.enum_member("A", 1) + writer.enum_member("B", 2) + expected = [ + "class MyEnum(enum.Enum, IntEnum):", + " A = 1", + " B = 2", + ] + assert writer.to_lines() == expected + + +@pytest.mark.parametrize( + "name, type_hint, default, default_factory, expected", + [ + ("x", "int", None, None, ["x: int"]), + ("x", "int", 10, None, ["x: int = 10"]), + ( + "x", + "list", + None, + "list", + ["x: list = dataclasses.field(default_factory=list)"], + ), + ], +) +def test_field( + name: str, + type_hint: str, + default: Optional[Any], + default_factory: Optional[Any], + expected: list[str], +) -> None: + writer = CodeWriter() + writer.field( + name, type_hint, default=default, default_factory=default_factory + ) + assert writer.to_lines() == expected + + +def test_function() -> None: + writer = CodeWriter() + with writer.function("foo", ["a: int", "b: str"], return_type="bool"): + writer.return_("True") + expected = ["def foo(a: int, b: str) -> bool:", " return True"] + assert writer.to_lines() == expected + + +def test_control_flow() -> None: + writer = CodeWriter() + with writer.if_("a > b"): + writer.pass_() + with writer.elif_("a == b"): + writer.pass_() + with writer.else_(): + writer.pass_() + + expected = [ + "if a > b:", + " pass", + "elif a == b:", + " pass", + "else:", + " pass", + ] + assert writer.to_lines() == expected + + +def test_loops() -> None: + writer = CodeWriter() + with writer.for_("i", "range(10)"): + writer.writeln("print(i)") + with writer.while_("True"): + writer.writeln("break") + + expected = [ + "for i in range(10):", + " print(i)", + "while True:", + " break", + ] + assert writer.to_lines() == expected + + +def test_assignment_and_assertions() -> None: + writer = CodeWriter() + writer.assignment("x", "1", type_hint="int") + + expected = ["x: int = 1"] + assert writer.to_lines() == expected + + +def test_method_alias(): + writer = CodeWriter() + with writer.method("m", "self"): + writer.pass_() + assert "def m(self):" in writer.to_string() From 611fee7366875c20083f1d43d578a14da0f00fa6 Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Fri, 27 Feb 2026 10:48:57 -0500 Subject: [PATCH 02/15] add opentelemetry-proto-json package --- opentelemetry-proto-json/LICENSE | 201 +++ opentelemetry-proto-json/README.rst | 39 + opentelemetry-proto-json/pyproject.toml | 44 + .../src/opentelemetry/proto_json/__init__.py | 0 .../proto_json/_otlp_json_utils.py | 227 +++ .../proto_json/collector/__init__.py | 0 .../proto_json/collector/logs/__init__.py | 0 .../proto_json/collector/logs/v1/__init__.py | 0 .../collector/logs/v1/logs_service.py | 228 +++ .../proto_json/collector/metrics/__init__.py | 0 .../collector/metrics/v1/__init__.py | 0 .../collector/metrics/v1/metrics_service.py | 228 +++ .../proto_json/collector/profiles/__init__.py | 0 .../profiles/v1development/__init__.py | 0 .../v1development/profiles_service.py | 233 +++ .../proto_json/collector/trace/__init__.py | 0 .../proto_json/collector/trace/v1/__init__.py | 0 .../collector/trace/v1/trace_service.py | 228 +++ .../proto_json/common/__init__.py | 0 .../proto_json/common/v1/__init__.py | 0 .../proto_json/common/v1/common.py | 483 ++++++ .../opentelemetry/proto_json/logs/__init__.py | 0 .../proto_json/logs/v1/__init__.py | 0 .../opentelemetry/proto_json/logs/v1/logs.py | 405 +++++ .../proto_json/metrics/__init__.py | 0 .../proto_json/metrics/v1/__init__.py | 0 .../proto_json/metrics/v1/metrics.py | 1365 +++++++++++++++++ .../proto_json/profiles/__init__.py | 0 .../profiles/v1development/__init__.py | 0 .../profiles/v1development/profiles.py | 1137 ++++++++++++++ .../src/opentelemetry/proto_json/py.typed | 0 .../proto_json/resource/__init__.py | 0 .../proto_json/resource/v1/__init__.py | 0 .../proto_json/resource/v1/resource.py | 107 ++ .../proto_json/trace/__init__.py | 0 .../proto_json/trace/v1/__init__.py | 0 .../proto_json/trace/v1/trace.py | 664 ++++++++ .../proto_json/version/__init__.py | 15 + opentelemetry-proto-json/test-requirements.in | 6 + .../test-requirements.latest.txt | 28 + .../test-requirements.oldest.txt | 28 + opentelemetry-proto-json/tests/__init__.py | 0 opentelemetry-proto-json/tests/test_proto.py | 23 + 43 files changed, 5689 insertions(+) create mode 100644 opentelemetry-proto-json/LICENSE create mode 100644 opentelemetry-proto-json/README.rst create mode 100644 opentelemetry-proto-json/pyproject.toml create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/_otlp_json_utils.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/common/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/logs/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/py.typed create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/resource/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/trace/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/__init__.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py create mode 100644 opentelemetry-proto-json/src/opentelemetry/proto_json/version/__init__.py create mode 100644 opentelemetry-proto-json/test-requirements.in create mode 100644 opentelemetry-proto-json/test-requirements.latest.txt create mode 100644 opentelemetry-proto-json/test-requirements.oldest.txt create mode 100644 opentelemetry-proto-json/tests/__init__.py create mode 100644 opentelemetry-proto-json/tests/test_proto.py diff --git a/opentelemetry-proto-json/LICENSE b/opentelemetry-proto-json/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/opentelemetry-proto-json/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/opentelemetry-proto-json/README.rst b/opentelemetry-proto-json/README.rst new file mode 100644 index 00000000000..748fed3bc5b --- /dev/null +++ b/opentelemetry-proto-json/README.rst @@ -0,0 +1,39 @@ +OpenTelemetry Python Proto JSON +================================ + +|pypi| + +.. |pypi| image:: https://badge.fury.io/py/opentelemetry-proto-json.svg + :target: https://pypi.org/project/opentelemetry-proto-json/ + +This library contains the generated code for OpenTelemetry protobuf data model with JSON encoding support. The code in the current package was generated using the v1.9.0 release_ of opentelemetry-proto and includes definitions for the OpenTelemetry JSON Protobuf encoding specification. + +.. _release: https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v1.9.0 + +Installation +------------ + +:: + + pip install opentelemetry-proto-json + +Code Generation +--------------- + +These files were generated automatically using the custom protoc plugin opentelemetry-codegen-json_ from code in opentelemetry-proto_. +To regenerate the code, run ``../scripts/proto_codegen_json.sh``. + +To build against a new release or specific commit of opentelemetry-proto_, +update the ``PROTO_REPO_BRANCH_OR_COMMIT`` variable in +``../scripts/proto_codegen_json.sh``. Then run the script and commit the changes +as well as any fixes needed in the OTLP exporter. + +.. _opentelemetry-codegen-json: https://github.com/open-telemetry/codegen/opentelemetry-codegen-json +.. _opentelemetry-proto: https://github.com/open-telemetry/opentelemetry-proto + +References +---------- + +* `OpenTelemetry Project `_ +* `OpenTelemetry Proto `_ +* `OTLP JSON Encoding Specification `_ diff --git a/opentelemetry-proto-json/pyproject.toml b/opentelemetry-proto-json/pyproject.toml new file mode 100644 index 00000000000..b161fc45e73 --- /dev/null +++ b/opentelemetry-proto-json/pyproject.toml @@ -0,0 +1,44 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "opentelemetry-proto-json" +dynamic = ["version"] +description = "OpenTelemetry Python Json Proto" +readme = "README.rst" +license = "Apache-2.0" +requires-python = ">=3.9" +authors = [ + { name = "OpenTelemetry Authors", email = "cncf-opentelemetry-contributors@lists.cncf.io" }, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Framework :: OpenTelemetry", + "Intended Audience :: Developers", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", +] +dependencies = [] + +[project.urls] +Homepage = "https://github.com/open-telemetry/opentelemetry-python/tree/main/opentelemetry-proto-json" +Repository = "https://github.com/open-telemetry/opentelemetry-python" + +[tool.hatch.version] +path = "src/opentelemetry/proto_json/version/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/src", + "/tests", +] + +[tool.hatch.build.targets.wheel] +packages = ["src/opentelemetry"] diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/_otlp_json_utils.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/_otlp_json_utils.py new file mode 100644 index 00000000000..baae4901fe7 --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/_otlp_json_utils.py @@ -0,0 +1,227 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import annotations + +import base64 +import math +import typing + +T = typing.TypeVar("T") + + +def encode_hex(value: bytes) -> str: + """ + Encode bytes as hex string. + + Args: + value: The bytes to encode. + Returns: + Hex string representation of the input bytes. + """ + return value.hex() if value else "" + + +def encode_base64(value: bytes) -> str: + """ + Encode bytes as base64 string. + Standard Proto3 JSON mapping for bytes. + + Args: + value: The bytes to encode. + Returns: + Base64 string representation of the input bytes. + """ + return base64.b64encode(value).decode("utf-8") if value else "" + + +def encode_int64(value: int) -> str: + """ + Encode 64 bit integers as strings. + Required for int64, uint64, fixed64, sfixed64 and sint64 per Proto3 JSON spec. + + Args: + value: The integer to encode. + Returns: + String representation of the input integer. + """ + return str(value) + + +def encode_float(value: float) -> typing.Union[float, str]: + """ + Encode float/double values. + + Args: + value: The float to encode. + Returns: + The input value, or a string for special float values (NaN, Infinity). + """ + if math.isnan(value): + return "NaN" + if math.isinf(value): + return "Infinity" if value > 0 else "-Infinity" + return value + + +def encode_repeated( + values: typing.Optional[list[typing.Any]], + map_fn: typing.Callable[[typing.Any], typing.Any], +) -> list[typing.Any]: + """ + Helper to serialize repeated fields with a mapping function. + + Args: + values: The list of values to encode. + map_fn: A function that takes a single value and returns its encoded form. + Returns: + A list of encoded values, or an empty list if input is None or empty. + """ + return [map_fn(v) for v in values] if values else [] + + +def decode_hex(value: typing.Optional[str], field_name: str) -> bytes: + """ + Decode hex string to bytes. + + Args: + value: The hex string to decode. + field_name: The name of the field being decoded (for error messages). + Returns: + The decoded bytes, or empty bytes if input is None or empty. + """ + if not value: + return b"" + validate_type(value, str, field_name) + try: + return bytes.fromhex(value) + except ValueError as e: + raise ValueError( + f"Invalid hex string for field '{field_name}': {e}" + ) from None + + +def decode_base64(value: typing.Optional[str], field_name: str) -> bytes: + """ + Decode base64 string to bytes. + + Args: + value: The base64 string to decode. + field_name: The name of the field being decoded (for error messages). + Returns: + The decoded bytes, or empty bytes if input is None or empty. + """ + if not value: + return b"" + validate_type(value, str, field_name) + try: + return base64.b64decode(value) + except Exception as e: + raise ValueError( + f"Invalid base64 string for field '{field_name}': {e}" + ) from None + + +def decode_int64( + value: typing.Optional[typing.Union[int, str]], field_name: str +) -> int: + """ + Parse int64 from number or string. + + Args: + value: The value to decode, which can be an int, a string, or None + field_name: The name of the field being decoded (for error messages). + Returns: + The decoded integer, or 0 if input is None. + """ + if value is None: + return 0 + validate_type(value, (int, str), field_name) + try: + return int(value) + except (ValueError, TypeError): + raise ValueError( + f"Invalid int64 value for field '{field_name}': {value}" + ) from None + + +def decode_float( + value: typing.Optional[typing.Union[float, int, str]], field_name: str +) -> float: + """ + Parse float/double from number or string, handling special values. + + Args: + value: The value to decode, which can be a float, int, string, or None + field_name: The name of the field being decoded (for error messages). + Returns: + The decoded float, or 0.0 if input is None. + """ + if value is None: + return 0.0 + validate_type(value, (float, int, str), field_name) + if value == "NaN": + return math.nan + if value == "Infinity": + return math.inf + if value == "-Infinity": + return -math.inf + try: + return float(value) + except (ValueError, TypeError): + raise ValueError( + f"Invalid float value for field '{field_name}': {value}" + ) from None + + +def decode_repeated( + values: typing.Optional[list[typing.Any]], + item_parser: typing.Callable[[typing.Any], T], + field_name: str, +) -> list[T]: + """ + Parse a list of values using the provided item parser function. + + Args: + values: The list of values to decode, or None. + item_parser: A function that takes a single value and returns the parsed form. + field_name: The name of the field being decoded (for error messages). + Returns: + A list of parsed values, or an empty list if input is None. + """ + if values is None: + return [] + validate_type(values, list, field_name) + return [item_parser(v) for v in values] + + +def validate_type( + value: typing.Any, + expected_types: typing.Union[type, tuple[type, ...]], + field_name: str, +) -> None: + """ + Validate that a value is of the expected type(s). + Raises TypeError if validation fails. + + Args: + value: The value to validate. + expected_types: A type or tuple of types that the value is expected to be. + field_name: The name of the field being validated (for error messages). + """ + if not isinstance(value, expected_types): + raise TypeError( + f"Field '{field_name}' expected {expected_types}, " + f"got {type(value).__name__}" + ) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py new file mode 100644 index 00000000000..8002a77ba58 --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py @@ -0,0 +1,228 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# AUTO-GENERATED from "opentelemetry/proto/collector/logs/v1/logs_service.proto" +# DO NOT EDIT MANUALLY + +from __future__ import annotations + +import builtins +import dataclasses +import functools +import json +import sys +import typing + +if sys.version_info >= (3, 10): + _dataclass = functools.partial(dataclasses.dataclass, slots=True) +else: + _dataclass = dataclasses.dataclass + +import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json.logs.v1.logs + + +@typing.final +@_dataclass +class ExportLogsServiceRequest: + """ + Generated from protobuf message ExportLogsServiceRequest + """ + + resource_logs: builtins.list[opentelemetry.proto_json.logs.v1.logs.ResourceLogs] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource_logs: + _result["resourceLogs"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_logs, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogsServiceRequest": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportLogsServiceRequest instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resourceLogs")) is not None: + _args["resource_logs"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.logs.v1.logs.ResourceLogs.from_dict(_v), "resource_logs") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportLogsServiceRequest": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ExportLogsServiceResponse: + """ + Generated from protobuf message ExportLogsServiceResponse + """ + + partial_success: typing.Optional[ExportLogsPartialSuccess] = None + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.partial_success: + _result["partialSuccess"] = self.partial_success.to_dict() + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogsServiceResponse": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportLogsServiceResponse instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("partialSuccess")) is not None: + _args["partial_success"] = ExportLogsPartialSuccess.from_dict(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportLogsServiceResponse": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ExportLogsPartialSuccess: + """ + Generated from protobuf message ExportLogsPartialSuccess + """ + + rejected_log_records: typing.Optional[builtins.int] = 0 + error_message: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.rejected_log_records: + _result["rejectedLogRecords"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.rejected_log_records) + if self.error_message: + _result["errorMessage"] = self.error_message + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogsPartialSuccess": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportLogsPartialSuccess instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("rejectedLogRecords")) is not None: + _args["rejected_log_records"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "rejected_log_records") + if (_value := data.get("errorMessage")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "error_message") + _args["error_message"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportLogsPartialSuccess": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py new file mode 100644 index 00000000000..150d28b8d39 --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py @@ -0,0 +1,228 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# AUTO-GENERATED from "opentelemetry/proto/collector/metrics/v1/metrics_service.proto" +# DO NOT EDIT MANUALLY + +from __future__ import annotations + +import builtins +import dataclasses +import functools +import json +import sys +import typing + +if sys.version_info >= (3, 10): + _dataclass = functools.partial(dataclasses.dataclass, slots=True) +else: + _dataclass = dataclasses.dataclass + +import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json.metrics.v1.metrics + + +@typing.final +@_dataclass +class ExportMetricsServiceRequest: + """ + Generated from protobuf message ExportMetricsServiceRequest + """ + + resource_metrics: builtins.list[opentelemetry.proto_json.metrics.v1.metrics.ResourceMetrics] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource_metrics: + _result["resourceMetrics"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_metrics, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetricsServiceRequest": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportMetricsServiceRequest instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resourceMetrics")) is not None: + _args["resource_metrics"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.metrics.v1.metrics.ResourceMetrics.from_dict(_v), "resource_metrics") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportMetricsServiceRequest": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ExportMetricsServiceResponse: + """ + Generated from protobuf message ExportMetricsServiceResponse + """ + + partial_success: typing.Optional[ExportMetricsPartialSuccess] = None + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.partial_success: + _result["partialSuccess"] = self.partial_success.to_dict() + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetricsServiceResponse": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportMetricsServiceResponse instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("partialSuccess")) is not None: + _args["partial_success"] = ExportMetricsPartialSuccess.from_dict(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportMetricsServiceResponse": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ExportMetricsPartialSuccess: + """ + Generated from protobuf message ExportMetricsPartialSuccess + """ + + rejected_data_points: typing.Optional[builtins.int] = 0 + error_message: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.rejected_data_points: + _result["rejectedDataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.rejected_data_points) + if self.error_message: + _result["errorMessage"] = self.error_message + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetricsPartialSuccess": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportMetricsPartialSuccess instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("rejectedDataPoints")) is not None: + _args["rejected_data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "rejected_data_points") + if (_value := data.get("errorMessage")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "error_message") + _args["error_message"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportMetricsPartialSuccess": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py new file mode 100644 index 00000000000..4c6cf119246 --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py @@ -0,0 +1,233 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# AUTO-GENERATED from "opentelemetry/proto/collector/profiles/v1development/profiles_service.proto" +# DO NOT EDIT MANUALLY + +from __future__ import annotations + +import builtins +import dataclasses +import functools +import json +import sys +import typing + +if sys.version_info >= (3, 10): + _dataclass = functools.partial(dataclasses.dataclass, slots=True) +else: + _dataclass = dataclasses.dataclass + +import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json.profiles.v1development.profiles + + +@typing.final +@_dataclass +class ExportProfilesServiceRequest: + """ + Generated from protobuf message ExportProfilesServiceRequest + """ + + resource_profiles: builtins.list[opentelemetry.proto_json.profiles.v1development.profiles.ResourceProfiles] = dataclasses.field(default_factory=builtins.list) + dictionary: typing.Optional[opentelemetry.proto_json.profiles.v1development.profiles.ProfilesDictionary] = None + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource_profiles: + _result["resourceProfiles"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_profiles, lambda _v: _v.to_dict()) + if self.dictionary: + _result["dictionary"] = self.dictionary.to_dict() + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProfilesServiceRequest": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportProfilesServiceRequest instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resourceProfiles")) is not None: + _args["resource_profiles"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.profiles.v1development.profiles.ResourceProfiles.from_dict(_v), "resource_profiles") + if (_value := data.get("dictionary")) is not None: + _args["dictionary"] = opentelemetry.proto_json.profiles.v1development.profiles.ProfilesDictionary.from_dict(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportProfilesServiceRequest": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ExportProfilesServiceResponse: + """ + Generated from protobuf message ExportProfilesServiceResponse + """ + + partial_success: typing.Optional[ExportProfilesPartialSuccess] = None + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.partial_success: + _result["partialSuccess"] = self.partial_success.to_dict() + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProfilesServiceResponse": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportProfilesServiceResponse instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("partialSuccess")) is not None: + _args["partial_success"] = ExportProfilesPartialSuccess.from_dict(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportProfilesServiceResponse": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ExportProfilesPartialSuccess: + """ + Generated from protobuf message ExportProfilesPartialSuccess + """ + + rejected_profiles: typing.Optional[builtins.int] = 0 + error_message: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.rejected_profiles: + _result["rejectedProfiles"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.rejected_profiles) + if self.error_message: + _result["errorMessage"] = self.error_message + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProfilesPartialSuccess": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportProfilesPartialSuccess instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("rejectedProfiles")) is not None: + _args["rejected_profiles"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "rejected_profiles") + if (_value := data.get("errorMessage")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "error_message") + _args["error_message"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportProfilesPartialSuccess": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py new file mode 100644 index 00000000000..75b2b83f25d --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py @@ -0,0 +1,228 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# AUTO-GENERATED from "opentelemetry/proto/collector/trace/v1/trace_service.proto" +# DO NOT EDIT MANUALLY + +from __future__ import annotations + +import builtins +import dataclasses +import functools +import json +import sys +import typing + +if sys.version_info >= (3, 10): + _dataclass = functools.partial(dataclasses.dataclass, slots=True) +else: + _dataclass = dataclasses.dataclass + +import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json.trace.v1.trace + + +@typing.final +@_dataclass +class ExportTraceServiceRequest: + """ + Generated from protobuf message ExportTraceServiceRequest + """ + + resource_spans: builtins.list[opentelemetry.proto_json.trace.v1.trace.ResourceSpans] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource_spans: + _result["resourceSpans"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_spans, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTraceServiceRequest": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportTraceServiceRequest instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resourceSpans")) is not None: + _args["resource_spans"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.trace.v1.trace.ResourceSpans.from_dict(_v), "resource_spans") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportTraceServiceRequest": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ExportTraceServiceResponse: + """ + Generated from protobuf message ExportTraceServiceResponse + """ + + partial_success: typing.Optional[ExportTracePartialSuccess] = None + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.partial_success: + _result["partialSuccess"] = self.partial_success.to_dict() + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTraceServiceResponse": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportTraceServiceResponse instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("partialSuccess")) is not None: + _args["partial_success"] = ExportTracePartialSuccess.from_dict(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportTraceServiceResponse": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ExportTracePartialSuccess: + """ + Generated from protobuf message ExportTracePartialSuccess + """ + + rejected_spans: typing.Optional[builtins.int] = 0 + error_message: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.rejected_spans: + _result["rejectedSpans"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.rejected_spans) + if self.error_message: + _result["errorMessage"] = self.error_message + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTracePartialSuccess": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExportTracePartialSuccess instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("rejectedSpans")) is not None: + _args["rejected_spans"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "rejected_spans") + if (_value := data.get("errorMessage")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "error_message") + _args["error_message"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportTracePartialSuccess": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/common/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/common/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py new file mode 100644 index 00000000000..f0c482f407d --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py @@ -0,0 +1,483 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# AUTO-GENERATED from "opentelemetry/proto/common/v1/common.proto" +# DO NOT EDIT MANUALLY + +from __future__ import annotations + +import builtins +import dataclasses +import functools +import json +import sys +import typing + +if sys.version_info >= (3, 10): + _dataclass = functools.partial(dataclasses.dataclass, slots=True) +else: + _dataclass = dataclasses.dataclass + +import opentelemetry.proto_json._otlp_json_utils + + +@typing.final +@_dataclass +class AnyValue: + """ + Generated from protobuf message AnyValue + """ + + string_value: typing.Optional[builtins.str] = None + bool_value: typing.Optional[builtins.bool] = None + int_value: typing.Optional[builtins.int] = None + double_value: typing.Optional[builtins.float] = None + array_value: typing.Optional[ArrayValue] = None + kvlist_value: typing.Optional[KeyValueList] = None + bytes_value: typing.Optional[builtins.bytes] = None + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.bytes_value is not None: + _result["bytesValue"] = opentelemetry.proto_json._otlp_json_utils.encode_base64(self.bytes_value) + elif self.kvlist_value is not None: + _result["kvlistValue"] = self.kvlist_value.to_dict() + elif self.array_value is not None: + _result["arrayValue"] = self.array_value.to_dict() + elif self.double_value is not None: + _result["doubleValue"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.double_value) + elif self.int_value is not None: + _result["intValue"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.int_value) + elif self.bool_value is not None: + _result["boolValue"] = self.bool_value + elif self.string_value is not None: + _result["stringValue"] = self.string_value + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "AnyValue": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + AnyValue instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("bytesValue")) is not None: + _args["bytes_value"] = opentelemetry.proto_json._otlp_json_utils.decode_base64(_value, "bytes_value") + elif (_value := data.get("kvlistValue")) is not None: + _args["kvlist_value"] = KeyValueList.from_dict(_value) + elif (_value := data.get("arrayValue")) is not None: + _args["array_value"] = ArrayValue.from_dict(_value) + elif (_value := data.get("doubleValue")) is not None: + _args["double_value"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "double_value") + elif (_value := data.get("intValue")) is not None: + _args["int_value"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "int_value") + elif (_value := data.get("boolValue")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.bool, "bool_value") + _args["bool_value"] = _value + elif (_value := data.get("stringValue")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "string_value") + _args["string_value"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "AnyValue": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ArrayValue: + """ + Generated from protobuf message ArrayValue + """ + + values: builtins.list[AnyValue] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.values: + _result["values"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.values, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ArrayValue": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ArrayValue instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("values")) is not None: + _args["values"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: AnyValue.from_dict(_v), "values") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ArrayValue": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class KeyValueList: + """ + Generated from protobuf message KeyValueList + """ + + values: builtins.list[KeyValue] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.values: + _result["values"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.values, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValueList": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + KeyValueList instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("values")) is not None: + _args["values"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: KeyValue.from_dict(_v), "values") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "KeyValueList": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class KeyValue: + """ + Generated from protobuf message KeyValue + """ + + key: typing.Optional[builtins.str] = "" + value: typing.Optional[AnyValue] = None + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.key: + _result["key"] = self.key + if self.value: + _result["value"] = self.value.to_dict() + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValue": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + KeyValue instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("key")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "key") + _args["key"] = _value + if (_value := data.get("value")) is not None: + _args["value"] = AnyValue.from_dict(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "KeyValue": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class InstrumentationScope: + """ + Generated from protobuf message InstrumentationScope + """ + + name: typing.Optional[builtins.str] = "" + version: typing.Optional[builtins.str] = "" + attributes: builtins.list[KeyValue] = dataclasses.field(default_factory=builtins.list) + dropped_attributes_count: typing.Optional[builtins.int] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.name: + _result["name"] = self.name + if self.version: + _result["version"] = self.version + if self.attributes: + _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + if self.dropped_attributes_count: + _result["droppedAttributesCount"] = self.dropped_attributes_count + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "InstrumentationScope": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + InstrumentationScope instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("name")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "name") + _args["name"] = _value + if (_value := data.get("version")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "version") + _args["version"] = _value + if (_value := data.get("attributes")) is not None: + _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: KeyValue.from_dict(_v), "attributes") + if (_value := data.get("droppedAttributesCount")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + _args["dropped_attributes_count"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "InstrumentationScope": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class EntityRef: + """ + Generated from protobuf message EntityRef + """ + + schema_url: typing.Optional[builtins.str] = "" + type: typing.Optional[builtins.str] = "" + id_keys: builtins.list[builtins.str] = dataclasses.field(default_factory=builtins.list) + description_keys: builtins.list[builtins.str] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.schema_url: + _result["schemaUrl"] = self.schema_url + if self.type: + _result["type"] = self.type + if self.id_keys: + _result["idKeys"] = self.id_keys + if self.description_keys: + _result["descriptionKeys"] = self.description_keys + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "EntityRef": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + EntityRef instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("schemaUrl")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + _args["schema_url"] = _value + if (_value := data.get("type")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "type") + _args["type"] = _value + if (_value := data.get("idKeys")) is not None: + _args["id_keys"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "id_keys") + if (_value := data.get("descriptionKeys")) is not None: + _args["description_keys"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "description_keys") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "EntityRef": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py new file mode 100644 index 00000000000..855c280328b --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py @@ -0,0 +1,405 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# AUTO-GENERATED from "opentelemetry/proto/logs/v1/logs.proto" +# DO NOT EDIT MANUALLY + +from __future__ import annotations + +import builtins +import dataclasses +import enum +import functools +import json +import sys +import typing + +if sys.version_info >= (3, 10): + _dataclass = functools.partial(dataclasses.dataclass, slots=True) +else: + _dataclass = dataclasses.dataclass + +import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json.common.v1.common +import opentelemetry.proto_json.resource.v1.resource + + +@typing.final +class SeverityNumber(enum.IntEnum): + """ + Generated from protobuf enum SeverityNumber + """ + + SEVERITY_NUMBER_UNSPECIFIED = 0 + SEVERITY_NUMBER_TRACE = 1 + SEVERITY_NUMBER_TRACE2 = 2 + SEVERITY_NUMBER_TRACE3 = 3 + SEVERITY_NUMBER_TRACE4 = 4 + SEVERITY_NUMBER_DEBUG = 5 + SEVERITY_NUMBER_DEBUG2 = 6 + SEVERITY_NUMBER_DEBUG3 = 7 + SEVERITY_NUMBER_DEBUG4 = 8 + SEVERITY_NUMBER_INFO = 9 + SEVERITY_NUMBER_INFO2 = 10 + SEVERITY_NUMBER_INFO3 = 11 + SEVERITY_NUMBER_INFO4 = 12 + SEVERITY_NUMBER_WARN = 13 + SEVERITY_NUMBER_WARN2 = 14 + SEVERITY_NUMBER_WARN3 = 15 + SEVERITY_NUMBER_WARN4 = 16 + SEVERITY_NUMBER_ERROR = 17 + SEVERITY_NUMBER_ERROR2 = 18 + SEVERITY_NUMBER_ERROR3 = 19 + SEVERITY_NUMBER_ERROR4 = 20 + SEVERITY_NUMBER_FATAL = 21 + SEVERITY_NUMBER_FATAL2 = 22 + SEVERITY_NUMBER_FATAL3 = 23 + SEVERITY_NUMBER_FATAL4 = 24 + +@typing.final +class LogRecordFlags(enum.IntEnum): + """ + Generated from protobuf enum LogRecordFlags + """ + + LOG_RECORD_FLAGS_DO_NOT_USE = 0 + LOG_RECORD_FLAGS_TRACE_FLAGS_MASK = 255 + +@typing.final +@_dataclass +class LogsData: + """ + Generated from protobuf message LogsData + """ + + resource_logs: builtins.list[ResourceLogs] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource_logs: + _result["resourceLogs"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_logs, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "LogsData": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + LogsData instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resourceLogs")) is not None: + _args["resource_logs"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ResourceLogs.from_dict(_v), "resource_logs") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "LogsData": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ResourceLogs: + """ + Generated from protobuf message ResourceLogs + """ + + resource: typing.Optional[opentelemetry.proto_json.resource.v1.resource.Resource] = None + scope_logs: builtins.list[ScopeLogs] = dataclasses.field(default_factory=builtins.list) + schema_url: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource: + _result["resource"] = self.resource.to_dict() + if self.scope_logs: + _result["scopeLogs"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.scope_logs, lambda _v: _v.to_dict()) + if self.schema_url: + _result["schemaUrl"] = self.schema_url + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceLogs": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ResourceLogs instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resource")) is not None: + _args["resource"] = opentelemetry.proto_json.resource.v1.resource.Resource.from_dict(_value) + if (_value := data.get("scopeLogs")) is not None: + _args["scope_logs"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ScopeLogs.from_dict(_v), "scope_logs") + if (_value := data.get("schemaUrl")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + _args["schema_url"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ResourceLogs": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ScopeLogs: + """ + Generated from protobuf message ScopeLogs + """ + + scope: typing.Optional[opentelemetry.proto_json.common.v1.common.InstrumentationScope] = None + log_records: builtins.list[LogRecord] = dataclasses.field(default_factory=builtins.list) + schema_url: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.scope: + _result["scope"] = self.scope.to_dict() + if self.log_records: + _result["logRecords"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.log_records, lambda _v: _v.to_dict()) + if self.schema_url: + _result["schemaUrl"] = self.schema_url + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeLogs": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ScopeLogs instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("scope")) is not None: + _args["scope"] = opentelemetry.proto_json.common.v1.common.InstrumentationScope.from_dict(_value) + if (_value := data.get("logRecords")) is not None: + _args["log_records"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: LogRecord.from_dict(_v), "log_records") + if (_value := data.get("schemaUrl")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + _args["schema_url"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ScopeLogs": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class LogRecord: + """ + Generated from protobuf message LogRecord + """ + + time_unix_nano: typing.Optional[builtins.int] = 0 + observed_time_unix_nano: typing.Optional[builtins.int] = 0 + severity_number: typing.Union[SeverityNumber, builtins.int, None] = 0 + severity_text: typing.Optional[builtins.str] = "" + body: typing.Optional[opentelemetry.proto_json.common.v1.common.AnyValue] = None + attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + dropped_attributes_count: typing.Optional[builtins.int] = 0 + flags: typing.Optional[builtins.int] = 0 + trace_id: typing.Optional[builtins.bytes] = b"" + span_id: typing.Optional[builtins.bytes] = b"" + event_name: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.time_unix_nano: + _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + if self.observed_time_unix_nano: + _result["observedTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.observed_time_unix_nano) + if self.severity_number: + _result["severityNumber"] = builtins.int(self.severity_number) + if self.severity_text: + _result["severityText"] = self.severity_text + if self.body: + _result["body"] = self.body.to_dict() + if self.attributes: + _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + if self.dropped_attributes_count: + _result["droppedAttributesCount"] = self.dropped_attributes_count + if self.flags: + _result["flags"] = self.flags + if self.trace_id: + _result["traceId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.trace_id) + if self.span_id: + _result["spanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.span_id) + if self.event_name: + _result["eventName"] = self.event_name + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "LogRecord": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + LogRecord instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("timeUnixNano")) is not None: + _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + if (_value := data.get("observedTimeUnixNano")) is not None: + _args["observed_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "observed_time_unix_nano") + if (_value := data.get("severityNumber")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "severity_number") + _args["severity_number"] = SeverityNumber(_value) + if (_value := data.get("severityText")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "severity_text") + _args["severity_text"] = _value + if (_value := data.get("body")) is not None: + _args["body"] = opentelemetry.proto_json.common.v1.common.AnyValue.from_dict(_value) + if (_value := data.get("attributes")) is not None: + _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + if (_value := data.get("droppedAttributesCount")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + _args["dropped_attributes_count"] = _value + if (_value := data.get("flags")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + _args["flags"] = _value + if (_value := data.get("traceId")) is not None: + _args["trace_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "trace_id") + if (_value := data.get("spanId")) is not None: + _args["span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "span_id") + if (_value := data.get("eventName")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "event_name") + _args["event_name"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "LogRecord": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py new file mode 100644 index 00000000000..81f8489907d --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py @@ -0,0 +1,1365 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# AUTO-GENERATED from "opentelemetry/proto/metrics/v1/metrics.proto" +# DO NOT EDIT MANUALLY + +from __future__ import annotations + +import builtins +import dataclasses +import enum +import functools +import json +import sys +import typing + +if sys.version_info >= (3, 10): + _dataclass = functools.partial(dataclasses.dataclass, slots=True) +else: + _dataclass = dataclasses.dataclass + +import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json.common.v1.common +import opentelemetry.proto_json.resource.v1.resource + + +@typing.final +class AggregationTemporality(enum.IntEnum): + """ + Generated from protobuf enum AggregationTemporality + """ + + AGGREGATION_TEMPORALITY_UNSPECIFIED = 0 + AGGREGATION_TEMPORALITY_DELTA = 1 + AGGREGATION_TEMPORALITY_CUMULATIVE = 2 + +@typing.final +class DataPointFlags(enum.IntEnum): + """ + Generated from protobuf enum DataPointFlags + """ + + DATA_POINT_FLAGS_DO_NOT_USE = 0 + DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK = 1 + +@typing.final +@_dataclass +class MetricsData: + """ + Generated from protobuf message MetricsData + """ + + resource_metrics: builtins.list[ResourceMetrics] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource_metrics: + _result["resourceMetrics"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_metrics, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "MetricsData": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + MetricsData instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resourceMetrics")) is not None: + _args["resource_metrics"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ResourceMetrics.from_dict(_v), "resource_metrics") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "MetricsData": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ResourceMetrics: + """ + Generated from protobuf message ResourceMetrics + """ + + resource: typing.Optional[opentelemetry.proto_json.resource.v1.resource.Resource] = None + scope_metrics: builtins.list[ScopeMetrics] = dataclasses.field(default_factory=builtins.list) + schema_url: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource: + _result["resource"] = self.resource.to_dict() + if self.scope_metrics: + _result["scopeMetrics"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.scope_metrics, lambda _v: _v.to_dict()) + if self.schema_url: + _result["schemaUrl"] = self.schema_url + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceMetrics": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ResourceMetrics instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resource")) is not None: + _args["resource"] = opentelemetry.proto_json.resource.v1.resource.Resource.from_dict(_value) + if (_value := data.get("scopeMetrics")) is not None: + _args["scope_metrics"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ScopeMetrics.from_dict(_v), "scope_metrics") + if (_value := data.get("schemaUrl")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + _args["schema_url"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ResourceMetrics": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ScopeMetrics: + """ + Generated from protobuf message ScopeMetrics + """ + + scope: typing.Optional[opentelemetry.proto_json.common.v1.common.InstrumentationScope] = None + metrics: builtins.list[Metric] = dataclasses.field(default_factory=builtins.list) + schema_url: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.scope: + _result["scope"] = self.scope.to_dict() + if self.metrics: + _result["metrics"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.metrics, lambda _v: _v.to_dict()) + if self.schema_url: + _result["schemaUrl"] = self.schema_url + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeMetrics": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ScopeMetrics instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("scope")) is not None: + _args["scope"] = opentelemetry.proto_json.common.v1.common.InstrumentationScope.from_dict(_value) + if (_value := data.get("metrics")) is not None: + _args["metrics"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Metric.from_dict(_v), "metrics") + if (_value := data.get("schemaUrl")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + _args["schema_url"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ScopeMetrics": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Metric: + """ + Generated from protobuf message Metric + """ + + name: typing.Optional[builtins.str] = "" + description: typing.Optional[builtins.str] = "" + unit: typing.Optional[builtins.str] = "" + gauge: typing.Optional[Gauge] = None + sum: typing.Optional[Sum] = None + histogram: typing.Optional[Histogram] = None + exponential_histogram: typing.Optional[ExponentialHistogram] = None + summary: typing.Optional[Summary] = None + metadata: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.name: + _result["name"] = self.name + if self.description: + _result["description"] = self.description + if self.unit: + _result["unit"] = self.unit + if self.metadata: + _result["metadata"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.metadata, lambda _v: _v.to_dict()) + if self.summary is not None: + _result["summary"] = self.summary.to_dict() + elif self.exponential_histogram is not None: + _result["exponentialHistogram"] = self.exponential_histogram.to_dict() + elif self.histogram is not None: + _result["histogram"] = self.histogram.to_dict() + elif self.sum is not None: + _result["sum"] = self.sum.to_dict() + elif self.gauge is not None: + _result["gauge"] = self.gauge.to_dict() + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Metric": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Metric instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("name")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "name") + _args["name"] = _value + if (_value := data.get("description")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "description") + _args["description"] = _value + if (_value := data.get("unit")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "unit") + _args["unit"] = _value + if (_value := data.get("metadata")) is not None: + _args["metadata"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "metadata") + if (_value := data.get("summary")) is not None: + _args["summary"] = Summary.from_dict(_value) + elif (_value := data.get("exponentialHistogram")) is not None: + _args["exponential_histogram"] = ExponentialHistogram.from_dict(_value) + elif (_value := data.get("histogram")) is not None: + _args["histogram"] = Histogram.from_dict(_value) + elif (_value := data.get("sum")) is not None: + _args["sum"] = Sum.from_dict(_value) + elif (_value := data.get("gauge")) is not None: + _args["gauge"] = Gauge.from_dict(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Metric": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Gauge: + """ + Generated from protobuf message Gauge + """ + + data_points: builtins.list[NumberDataPoint] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.data_points: + _result["dataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.data_points, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Gauge": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Gauge instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("dataPoints")) is not None: + _args["data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: NumberDataPoint.from_dict(_v), "data_points") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Gauge": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Sum: + """ + Generated from protobuf message Sum + """ + + data_points: builtins.list[NumberDataPoint] = dataclasses.field(default_factory=builtins.list) + aggregation_temporality: typing.Union[AggregationTemporality, builtins.int, None] = 0 + is_monotonic: typing.Optional[builtins.bool] = False + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.data_points: + _result["dataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.data_points, lambda _v: _v.to_dict()) + if self.aggregation_temporality: + _result["aggregationTemporality"] = builtins.int(self.aggregation_temporality) + if self.is_monotonic: + _result["isMonotonic"] = self.is_monotonic + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Sum": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Sum instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("dataPoints")) is not None: + _args["data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: NumberDataPoint.from_dict(_v), "data_points") + if (_value := data.get("aggregationTemporality")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "aggregation_temporality") + _args["aggregation_temporality"] = AggregationTemporality(_value) + if (_value := data.get("isMonotonic")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.bool, "is_monotonic") + _args["is_monotonic"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Sum": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Histogram: + """ + Generated from protobuf message Histogram + """ + + data_points: builtins.list[HistogramDataPoint] = dataclasses.field(default_factory=builtins.list) + aggregation_temporality: typing.Union[AggregationTemporality, builtins.int, None] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.data_points: + _result["dataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.data_points, lambda _v: _v.to_dict()) + if self.aggregation_temporality: + _result["aggregationTemporality"] = builtins.int(self.aggregation_temporality) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Histogram": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Histogram instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("dataPoints")) is not None: + _args["data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: HistogramDataPoint.from_dict(_v), "data_points") + if (_value := data.get("aggregationTemporality")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "aggregation_temporality") + _args["aggregation_temporality"] = AggregationTemporality(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Histogram": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ExponentialHistogram: + """ + Generated from protobuf message ExponentialHistogram + """ + + data_points: builtins.list[ExponentialHistogramDataPoint] = dataclasses.field(default_factory=builtins.list) + aggregation_temporality: typing.Union[AggregationTemporality, builtins.int, None] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.data_points: + _result["dataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.data_points, lambda _v: _v.to_dict()) + if self.aggregation_temporality: + _result["aggregationTemporality"] = builtins.int(self.aggregation_temporality) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExponentialHistogram": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExponentialHistogram instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("dataPoints")) is not None: + _args["data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ExponentialHistogramDataPoint.from_dict(_v), "data_points") + if (_value := data.get("aggregationTemporality")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "aggregation_temporality") + _args["aggregation_temporality"] = AggregationTemporality(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExponentialHistogram": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Summary: + """ + Generated from protobuf message Summary + """ + + data_points: builtins.list[SummaryDataPoint] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.data_points: + _result["dataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.data_points, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Summary": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Summary instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("dataPoints")) is not None: + _args["data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: SummaryDataPoint.from_dict(_v), "data_points") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Summary": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class NumberDataPoint: + """ + Generated from protobuf message NumberDataPoint + """ + + attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + start_time_unix_nano: typing.Optional[builtins.int] = 0 + time_unix_nano: typing.Optional[builtins.int] = 0 + as_double: typing.Optional[builtins.float] = None + as_int: typing.Optional[builtins.int] = None + exemplars: builtins.list[Exemplar] = dataclasses.field(default_factory=builtins.list) + flags: typing.Optional[builtins.int] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.attributes: + _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + if self.start_time_unix_nano: + _result["startTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_time_unix_nano) + if self.time_unix_nano: + _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + if self.exemplars: + _result["exemplars"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.exemplars, lambda _v: _v.to_dict()) + if self.flags: + _result["flags"] = self.flags + if self.as_int is not None: + _result["asInt"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.as_int) + elif self.as_double is not None: + _result["asDouble"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.as_double) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "NumberDataPoint": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + NumberDataPoint instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("attributes")) is not None: + _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + if (_value := data.get("startTimeUnixNano")) is not None: + _args["start_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_time_unix_nano") + if (_value := data.get("timeUnixNano")) is not None: + _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + if (_value := data.get("exemplars")) is not None: + _args["exemplars"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Exemplar.from_dict(_v), "exemplars") + if (_value := data.get("flags")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + _args["flags"] = _value + if (_value := data.get("asInt")) is not None: + _args["as_int"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "as_int") + elif (_value := data.get("asDouble")) is not None: + _args["as_double"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "as_double") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "NumberDataPoint": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class HistogramDataPoint: + """ + Generated from protobuf message HistogramDataPoint + """ + + attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + start_time_unix_nano: typing.Optional[builtins.int] = 0 + time_unix_nano: typing.Optional[builtins.int] = 0 + count: typing.Optional[builtins.int] = 0 + sum: typing.Optional[builtins.float] = 0.0 + bucket_counts: builtins.list[builtins.int] = dataclasses.field(default_factory=builtins.list) + explicit_bounds: builtins.list[builtins.float] = dataclasses.field(default_factory=builtins.list) + exemplars: builtins.list[Exemplar] = dataclasses.field(default_factory=builtins.list) + flags: typing.Optional[builtins.int] = 0 + min: typing.Optional[builtins.float] = 0.0 + max: typing.Optional[builtins.float] = 0.0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.attributes: + _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + if self.start_time_unix_nano: + _result["startTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_time_unix_nano) + if self.time_unix_nano: + _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + if self.count: + _result["count"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.count) + if self.sum: + _result["sum"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.sum) + if self.bucket_counts: + _result["bucketCounts"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.bucket_counts, lambda _v: opentelemetry.proto_json._otlp_json_utils.encode_int64(_v)) + if self.explicit_bounds: + _result["explicitBounds"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.explicit_bounds, lambda _v: opentelemetry.proto_json._otlp_json_utils.encode_float(_v)) + if self.exemplars: + _result["exemplars"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.exemplars, lambda _v: _v.to_dict()) + if self.flags: + _result["flags"] = self.flags + if self.min: + _result["min"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.min) + if self.max: + _result["max"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.max) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "HistogramDataPoint": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + HistogramDataPoint instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("attributes")) is not None: + _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + if (_value := data.get("startTimeUnixNano")) is not None: + _args["start_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_time_unix_nano") + if (_value := data.get("timeUnixNano")) is not None: + _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + if (_value := data.get("count")) is not None: + _args["count"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "count") + if (_value := data.get("sum")) is not None: + _args["sum"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "sum") + if (_value := data.get("bucketCounts")) is not None: + _args["bucket_counts"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json._otlp_json_utils.decode_int64(_v, "bucket_counts"), "bucket_counts") + if (_value := data.get("explicitBounds")) is not None: + _args["explicit_bounds"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json._otlp_json_utils.decode_float(_v, "explicit_bounds"), "explicit_bounds") + if (_value := data.get("exemplars")) is not None: + _args["exemplars"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Exemplar.from_dict(_v), "exemplars") + if (_value := data.get("flags")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + _args["flags"] = _value + if (_value := data.get("min")) is not None: + _args["min"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "min") + if (_value := data.get("max")) is not None: + _args["max"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "max") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "HistogramDataPoint": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ExponentialHistogramDataPoint: + """ + Generated from protobuf message ExponentialHistogramDataPoint + """ + + @typing.final + @_dataclass + class Buckets: + """ + Generated from protobuf message Buckets + """ + + offset: typing.Optional[builtins.int] = 0 + bucket_counts: builtins.list[builtins.int] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.offset: + _result["offset"] = self.offset + if self.bucket_counts: + _result["bucketCounts"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.bucket_counts, lambda _v: opentelemetry.proto_json._otlp_json_utils.encode_int64(_v)) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExponentialHistogramDataPoint.Buckets": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Buckets instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("offset")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "offset") + _args["offset"] = _value + if (_value := data.get("bucketCounts")) is not None: + _args["bucket_counts"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json._otlp_json_utils.decode_int64(_v, "bucket_counts"), "bucket_counts") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExponentialHistogramDataPoint.Buckets": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + start_time_unix_nano: typing.Optional[builtins.int] = 0 + time_unix_nano: typing.Optional[builtins.int] = 0 + count: typing.Optional[builtins.int] = 0 + sum: typing.Optional[builtins.float] = 0.0 + scale: typing.Optional[builtins.int] = 0 + zero_count: typing.Optional[builtins.int] = 0 + positive: typing.Optional[ExponentialHistogramDataPoint.Buckets] = None + negative: typing.Optional[ExponentialHistogramDataPoint.Buckets] = None + flags: typing.Optional[builtins.int] = 0 + exemplars: builtins.list[Exemplar] = dataclasses.field(default_factory=builtins.list) + min: typing.Optional[builtins.float] = 0.0 + max: typing.Optional[builtins.float] = 0.0 + zero_threshold: typing.Optional[builtins.float] = 0.0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.attributes: + _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + if self.start_time_unix_nano: + _result["startTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_time_unix_nano) + if self.time_unix_nano: + _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + if self.count: + _result["count"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.count) + if self.sum: + _result["sum"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.sum) + if self.scale: + _result["scale"] = self.scale + if self.zero_count: + _result["zeroCount"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.zero_count) + if self.positive: + _result["positive"] = self.positive.to_dict() + if self.negative: + _result["negative"] = self.negative.to_dict() + if self.flags: + _result["flags"] = self.flags + if self.exemplars: + _result["exemplars"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.exemplars, lambda _v: _v.to_dict()) + if self.min: + _result["min"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.min) + if self.max: + _result["max"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.max) + if self.zero_threshold: + _result["zeroThreshold"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.zero_threshold) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExponentialHistogramDataPoint": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ExponentialHistogramDataPoint instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("attributes")) is not None: + _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + if (_value := data.get("startTimeUnixNano")) is not None: + _args["start_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_time_unix_nano") + if (_value := data.get("timeUnixNano")) is not None: + _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + if (_value := data.get("count")) is not None: + _args["count"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "count") + if (_value := data.get("sum")) is not None: + _args["sum"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "sum") + if (_value := data.get("scale")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "scale") + _args["scale"] = _value + if (_value := data.get("zeroCount")) is not None: + _args["zero_count"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "zero_count") + if (_value := data.get("positive")) is not None: + _args["positive"] = ExponentialHistogramDataPoint.Buckets.from_dict(_value) + if (_value := data.get("negative")) is not None: + _args["negative"] = ExponentialHistogramDataPoint.Buckets.from_dict(_value) + if (_value := data.get("flags")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + _args["flags"] = _value + if (_value := data.get("exemplars")) is not None: + _args["exemplars"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Exemplar.from_dict(_v), "exemplars") + if (_value := data.get("min")) is not None: + _args["min"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "min") + if (_value := data.get("max")) is not None: + _args["max"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "max") + if (_value := data.get("zeroThreshold")) is not None: + _args["zero_threshold"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "zero_threshold") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExponentialHistogramDataPoint": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class SummaryDataPoint: + """ + Generated from protobuf message SummaryDataPoint + """ + + @typing.final + @_dataclass + class ValueAtQuantile: + """ + Generated from protobuf message ValueAtQuantile + """ + + quantile: typing.Optional[builtins.float] = 0.0 + value: typing.Optional[builtins.float] = 0.0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.quantile: + _result["quantile"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.quantile) + if self.value: + _result["value"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.value) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "SummaryDataPoint.ValueAtQuantile": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ValueAtQuantile instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("quantile")) is not None: + _args["quantile"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "quantile") + if (_value := data.get("value")) is not None: + _args["value"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "value") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "SummaryDataPoint.ValueAtQuantile": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + start_time_unix_nano: typing.Optional[builtins.int] = 0 + time_unix_nano: typing.Optional[builtins.int] = 0 + count: typing.Optional[builtins.int] = 0 + sum: typing.Optional[builtins.float] = 0.0 + quantile_values: builtins.list[SummaryDataPoint.ValueAtQuantile] = dataclasses.field(default_factory=builtins.list) + flags: typing.Optional[builtins.int] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.attributes: + _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + if self.start_time_unix_nano: + _result["startTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_time_unix_nano) + if self.time_unix_nano: + _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + if self.count: + _result["count"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.count) + if self.sum: + _result["sum"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.sum) + if self.quantile_values: + _result["quantileValues"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.quantile_values, lambda _v: _v.to_dict()) + if self.flags: + _result["flags"] = self.flags + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "SummaryDataPoint": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + SummaryDataPoint instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("attributes")) is not None: + _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + if (_value := data.get("startTimeUnixNano")) is not None: + _args["start_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_time_unix_nano") + if (_value := data.get("timeUnixNano")) is not None: + _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + if (_value := data.get("count")) is not None: + _args["count"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "count") + if (_value := data.get("sum")) is not None: + _args["sum"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "sum") + if (_value := data.get("quantileValues")) is not None: + _args["quantile_values"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: SummaryDataPoint.ValueAtQuantile.from_dict(_v), "quantile_values") + if (_value := data.get("flags")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + _args["flags"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "SummaryDataPoint": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Exemplar: + """ + Generated from protobuf message Exemplar + """ + + filtered_attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + time_unix_nano: typing.Optional[builtins.int] = 0 + as_double: typing.Optional[builtins.float] = None + as_int: typing.Optional[builtins.int] = None + span_id: typing.Optional[builtins.bytes] = b"" + trace_id: typing.Optional[builtins.bytes] = b"" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.filtered_attributes: + _result["filteredAttributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.filtered_attributes, lambda _v: _v.to_dict()) + if self.time_unix_nano: + _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + if self.span_id: + _result["spanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.span_id) + if self.trace_id: + _result["traceId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.trace_id) + if self.as_int is not None: + _result["asInt"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.as_int) + elif self.as_double is not None: + _result["asDouble"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.as_double) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Exemplar": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Exemplar instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("filteredAttributes")) is not None: + _args["filtered_attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "filtered_attributes") + if (_value := data.get("timeUnixNano")) is not None: + _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + if (_value := data.get("spanId")) is not None: + _args["span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "span_id") + if (_value := data.get("traceId")) is not None: + _args["trace_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "trace_id") + if (_value := data.get("asInt")) is not None: + _args["as_int"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "as_int") + elif (_value := data.get("asDouble")) is not None: + _args["as_double"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "as_double") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Exemplar": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py new file mode 100644 index 00000000000..02d8efa1d8f --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py @@ -0,0 +1,1137 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# AUTO-GENERATED from "opentelemetry/proto/profiles/v1development/profiles.proto" +# DO NOT EDIT MANUALLY + +from __future__ import annotations + +import builtins +import dataclasses +import functools +import json +import sys +import typing + +if sys.version_info >= (3, 10): + _dataclass = functools.partial(dataclasses.dataclass, slots=True) +else: + _dataclass = dataclasses.dataclass + +import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json.common.v1.common +import opentelemetry.proto_json.resource.v1.resource + + +@typing.final +@_dataclass +class ProfilesDictionary: + """ + Generated from protobuf message ProfilesDictionary + """ + + mapping_table: builtins.list[Mapping] = dataclasses.field(default_factory=builtins.list) + location_table: builtins.list[Location] = dataclasses.field(default_factory=builtins.list) + function_table: builtins.list[Function] = dataclasses.field(default_factory=builtins.list) + link_table: builtins.list[Link] = dataclasses.field(default_factory=builtins.list) + string_table: builtins.list[builtins.str] = dataclasses.field(default_factory=builtins.list) + attribute_table: builtins.list[KeyValueAndUnit] = dataclasses.field(default_factory=builtins.list) + stack_table: builtins.list[Stack] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.mapping_table: + _result["mappingTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.mapping_table, lambda _v: _v.to_dict()) + if self.location_table: + _result["locationTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.location_table, lambda _v: _v.to_dict()) + if self.function_table: + _result["functionTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.function_table, lambda _v: _v.to_dict()) + if self.link_table: + _result["linkTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.link_table, lambda _v: _v.to_dict()) + if self.string_table: + _result["stringTable"] = self.string_table + if self.attribute_table: + _result["attributeTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attribute_table, lambda _v: _v.to_dict()) + if self.stack_table: + _result["stackTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.stack_table, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ProfilesDictionary": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ProfilesDictionary instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("mappingTable")) is not None: + _args["mapping_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Mapping.from_dict(_v), "mapping_table") + if (_value := data.get("locationTable")) is not None: + _args["location_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Location.from_dict(_v), "location_table") + if (_value := data.get("functionTable")) is not None: + _args["function_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Function.from_dict(_v), "function_table") + if (_value := data.get("linkTable")) is not None: + _args["link_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Link.from_dict(_v), "link_table") + if (_value := data.get("stringTable")) is not None: + _args["string_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "string_table") + if (_value := data.get("attributeTable")) is not None: + _args["attribute_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: KeyValueAndUnit.from_dict(_v), "attribute_table") + if (_value := data.get("stackTable")) is not None: + _args["stack_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Stack.from_dict(_v), "stack_table") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ProfilesDictionary": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ProfilesData: + """ + Generated from protobuf message ProfilesData + """ + + resource_profiles: builtins.list[ResourceProfiles] = dataclasses.field(default_factory=builtins.list) + dictionary: typing.Optional[ProfilesDictionary] = None + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource_profiles: + _result["resourceProfiles"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_profiles, lambda _v: _v.to_dict()) + if self.dictionary: + _result["dictionary"] = self.dictionary.to_dict() + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ProfilesData": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ProfilesData instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resourceProfiles")) is not None: + _args["resource_profiles"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ResourceProfiles.from_dict(_v), "resource_profiles") + if (_value := data.get("dictionary")) is not None: + _args["dictionary"] = ProfilesDictionary.from_dict(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ProfilesData": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ResourceProfiles: + """ + Generated from protobuf message ResourceProfiles + """ + + resource: typing.Optional[opentelemetry.proto_json.resource.v1.resource.Resource] = None + scope_profiles: builtins.list[ScopeProfiles] = dataclasses.field(default_factory=builtins.list) + schema_url: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource: + _result["resource"] = self.resource.to_dict() + if self.scope_profiles: + _result["scopeProfiles"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.scope_profiles, lambda _v: _v.to_dict()) + if self.schema_url: + _result["schemaUrl"] = self.schema_url + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceProfiles": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ResourceProfiles instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resource")) is not None: + _args["resource"] = opentelemetry.proto_json.resource.v1.resource.Resource.from_dict(_value) + if (_value := data.get("scopeProfiles")) is not None: + _args["scope_profiles"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ScopeProfiles.from_dict(_v), "scope_profiles") + if (_value := data.get("schemaUrl")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + _args["schema_url"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ResourceProfiles": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ScopeProfiles: + """ + Generated from protobuf message ScopeProfiles + """ + + scope: typing.Optional[opentelemetry.proto_json.common.v1.common.InstrumentationScope] = None + profiles: builtins.list[Profile] = dataclasses.field(default_factory=builtins.list) + schema_url: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.scope: + _result["scope"] = self.scope.to_dict() + if self.profiles: + _result["profiles"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.profiles, lambda _v: _v.to_dict()) + if self.schema_url: + _result["schemaUrl"] = self.schema_url + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeProfiles": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ScopeProfiles instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("scope")) is not None: + _args["scope"] = opentelemetry.proto_json.common.v1.common.InstrumentationScope.from_dict(_value) + if (_value := data.get("profiles")) is not None: + _args["profiles"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Profile.from_dict(_v), "profiles") + if (_value := data.get("schemaUrl")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + _args["schema_url"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ScopeProfiles": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Profile: + """ + Generated from protobuf message Profile + """ + + sample_type: typing.Optional[ValueType] = None + samples: builtins.list[Sample] = dataclasses.field(default_factory=builtins.list) + time_unix_nano: typing.Optional[builtins.int] = 0 + duration_nano: typing.Optional[builtins.int] = 0 + period_type: typing.Optional[ValueType] = None + period: typing.Optional[builtins.int] = 0 + profile_id: typing.Optional[builtins.bytes] = b"" + dropped_attributes_count: typing.Optional[builtins.int] = 0 + original_payload_format: typing.Optional[builtins.str] = "" + original_payload: typing.Optional[builtins.bytes] = b"" + attribute_indices: builtins.list[builtins.int] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.sample_type: + _result["sampleType"] = self.sample_type.to_dict() + if self.samples: + _result["samples"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.samples, lambda _v: _v.to_dict()) + if self.time_unix_nano: + _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + if self.duration_nano: + _result["durationNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.duration_nano) + if self.period_type: + _result["periodType"] = self.period_type.to_dict() + if self.period: + _result["period"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.period) + if self.profile_id: + _result["profileId"] = opentelemetry.proto_json._otlp_json_utils.encode_base64(self.profile_id) + if self.dropped_attributes_count: + _result["droppedAttributesCount"] = self.dropped_attributes_count + if self.original_payload_format: + _result["originalPayloadFormat"] = self.original_payload_format + if self.original_payload: + _result["originalPayload"] = opentelemetry.proto_json._otlp_json_utils.encode_base64(self.original_payload) + if self.attribute_indices: + _result["attributeIndices"] = self.attribute_indices + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Profile": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Profile instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("sampleType")) is not None: + _args["sample_type"] = ValueType.from_dict(_value) + if (_value := data.get("samples")) is not None: + _args["samples"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Sample.from_dict(_v), "samples") + if (_value := data.get("timeUnixNano")) is not None: + _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + if (_value := data.get("durationNano")) is not None: + _args["duration_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "duration_nano") + if (_value := data.get("periodType")) is not None: + _args["period_type"] = ValueType.from_dict(_value) + if (_value := data.get("period")) is not None: + _args["period"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "period") + if (_value := data.get("profileId")) is not None: + _args["profile_id"] = opentelemetry.proto_json._otlp_json_utils.decode_base64(_value, "profile_id") + if (_value := data.get("droppedAttributesCount")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + _args["dropped_attributes_count"] = _value + if (_value := data.get("originalPayloadFormat")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "original_payload_format") + _args["original_payload_format"] = _value + if (_value := data.get("originalPayload")) is not None: + _args["original_payload"] = opentelemetry.proto_json._otlp_json_utils.decode_base64(_value, "original_payload") + if (_value := data.get("attributeIndices")) is not None: + _args["attribute_indices"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "attribute_indices") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Profile": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Link: + """ + Generated from protobuf message Link + """ + + trace_id: typing.Optional[builtins.bytes] = b"" + span_id: typing.Optional[builtins.bytes] = b"" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.trace_id: + _result["traceId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.trace_id) + if self.span_id: + _result["spanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.span_id) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Link": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Link instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("traceId")) is not None: + _args["trace_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "trace_id") + if (_value := data.get("spanId")) is not None: + _args["span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "span_id") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Link": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ValueType: + """ + Generated from protobuf message ValueType + """ + + type_strindex: typing.Optional[builtins.int] = 0 + unit_strindex: typing.Optional[builtins.int] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.type_strindex: + _result["typeStrindex"] = self.type_strindex + if self.unit_strindex: + _result["unitStrindex"] = self.unit_strindex + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ValueType": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ValueType instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("typeStrindex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "type_strindex") + _args["type_strindex"] = _value + if (_value := data.get("unitStrindex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "unit_strindex") + _args["unit_strindex"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ValueType": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Sample: + """ + Generated from protobuf message Sample + """ + + stack_index: typing.Optional[builtins.int] = 0 + values: builtins.list[builtins.int] = dataclasses.field(default_factory=builtins.list) + attribute_indices: builtins.list[builtins.int] = dataclasses.field(default_factory=builtins.list) + link_index: typing.Optional[builtins.int] = 0 + timestamps_unix_nano: builtins.list[builtins.int] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.stack_index: + _result["stackIndex"] = self.stack_index + if self.values: + _result["values"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.values, lambda _v: opentelemetry.proto_json._otlp_json_utils.encode_int64(_v)) + if self.attribute_indices: + _result["attributeIndices"] = self.attribute_indices + if self.link_index: + _result["linkIndex"] = self.link_index + if self.timestamps_unix_nano: + _result["timestampsUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.timestamps_unix_nano, lambda _v: opentelemetry.proto_json._otlp_json_utils.encode_int64(_v)) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Sample": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Sample instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("stackIndex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "stack_index") + _args["stack_index"] = _value + if (_value := data.get("values")) is not None: + _args["values"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json._otlp_json_utils.decode_int64(_v, "values"), "values") + if (_value := data.get("attributeIndices")) is not None: + _args["attribute_indices"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "attribute_indices") + if (_value := data.get("linkIndex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "link_index") + _args["link_index"] = _value + if (_value := data.get("timestampsUnixNano")) is not None: + _args["timestamps_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json._otlp_json_utils.decode_int64(_v, "timestamps_unix_nano"), "timestamps_unix_nano") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Sample": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Mapping: + """ + Generated from protobuf message Mapping + """ + + memory_start: typing.Optional[builtins.int] = 0 + memory_limit: typing.Optional[builtins.int] = 0 + file_offset: typing.Optional[builtins.int] = 0 + filename_strindex: typing.Optional[builtins.int] = 0 + attribute_indices: builtins.list[builtins.int] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.memory_start: + _result["memoryStart"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.memory_start) + if self.memory_limit: + _result["memoryLimit"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.memory_limit) + if self.file_offset: + _result["fileOffset"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.file_offset) + if self.filename_strindex: + _result["filenameStrindex"] = self.filename_strindex + if self.attribute_indices: + _result["attributeIndices"] = self.attribute_indices + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Mapping": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Mapping instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("memoryStart")) is not None: + _args["memory_start"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "memory_start") + if (_value := data.get("memoryLimit")) is not None: + _args["memory_limit"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "memory_limit") + if (_value := data.get("fileOffset")) is not None: + _args["file_offset"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "file_offset") + if (_value := data.get("filenameStrindex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "filename_strindex") + _args["filename_strindex"] = _value + if (_value := data.get("attributeIndices")) is not None: + _args["attribute_indices"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "attribute_indices") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Mapping": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Stack: + """ + Generated from protobuf message Stack + """ + + location_indices: builtins.list[builtins.int] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.location_indices: + _result["locationIndices"] = self.location_indices + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Stack": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Stack instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("locationIndices")) is not None: + _args["location_indices"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "location_indices") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Stack": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Location: + """ + Generated from protobuf message Location + """ + + mapping_index: typing.Optional[builtins.int] = 0 + address: typing.Optional[builtins.int] = 0 + lines: builtins.list[Line] = dataclasses.field(default_factory=builtins.list) + attribute_indices: builtins.list[builtins.int] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.mapping_index: + _result["mappingIndex"] = self.mapping_index + if self.address: + _result["address"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.address) + if self.lines: + _result["lines"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.lines, lambda _v: _v.to_dict()) + if self.attribute_indices: + _result["attributeIndices"] = self.attribute_indices + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Location": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Location instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("mappingIndex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "mapping_index") + _args["mapping_index"] = _value + if (_value := data.get("address")) is not None: + _args["address"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "address") + if (_value := data.get("lines")) is not None: + _args["lines"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Line.from_dict(_v), "lines") + if (_value := data.get("attributeIndices")) is not None: + _args["attribute_indices"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "attribute_indices") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Location": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Line: + """ + Generated from protobuf message Line + """ + + function_index: typing.Optional[builtins.int] = 0 + line: typing.Optional[builtins.int] = 0 + column: typing.Optional[builtins.int] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.function_index: + _result["functionIndex"] = self.function_index + if self.line: + _result["line"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.line) + if self.column: + _result["column"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.column) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Line": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Line instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("functionIndex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "function_index") + _args["function_index"] = _value + if (_value := data.get("line")) is not None: + _args["line"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "line") + if (_value := data.get("column")) is not None: + _args["column"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "column") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Line": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Function: + """ + Generated from protobuf message Function + """ + + name_strindex: typing.Optional[builtins.int] = 0 + system_name_strindex: typing.Optional[builtins.int] = 0 + filename_strindex: typing.Optional[builtins.int] = 0 + start_line: typing.Optional[builtins.int] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.name_strindex: + _result["nameStrindex"] = self.name_strindex + if self.system_name_strindex: + _result["systemNameStrindex"] = self.system_name_strindex + if self.filename_strindex: + _result["filenameStrindex"] = self.filename_strindex + if self.start_line: + _result["startLine"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_line) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Function": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Function instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("nameStrindex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "name_strindex") + _args["name_strindex"] = _value + if (_value := data.get("systemNameStrindex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "system_name_strindex") + _args["system_name_strindex"] = _value + if (_value := data.get("filenameStrindex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "filename_strindex") + _args["filename_strindex"] = _value + if (_value := data.get("startLine")) is not None: + _args["start_line"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_line") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Function": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class KeyValueAndUnit: + """ + Generated from protobuf message KeyValueAndUnit + """ + + key_strindex: typing.Optional[builtins.int] = 0 + value: typing.Optional[opentelemetry.proto_json.common.v1.common.AnyValue] = None + unit_strindex: typing.Optional[builtins.int] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.key_strindex: + _result["keyStrindex"] = self.key_strindex + if self.value: + _result["value"] = self.value.to_dict() + if self.unit_strindex: + _result["unitStrindex"] = self.unit_strindex + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValueAndUnit": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + KeyValueAndUnit instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("keyStrindex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "key_strindex") + _args["key_strindex"] = _value + if (_value := data.get("value")) is not None: + _args["value"] = opentelemetry.proto_json.common.v1.common.AnyValue.from_dict(_value) + if (_value := data.get("unitStrindex")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "unit_strindex") + _args["unit_strindex"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "KeyValueAndUnit": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/py.typed b/opentelemetry-proto-json/src/opentelemetry/proto_json/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py new file mode 100644 index 00000000000..bc80bf49aa4 --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py @@ -0,0 +1,107 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# AUTO-GENERATED from "opentelemetry/proto/resource/v1/resource.proto" +# DO NOT EDIT MANUALLY + +from __future__ import annotations + +import builtins +import dataclasses +import functools +import json +import sys +import typing + +if sys.version_info >= (3, 10): + _dataclass = functools.partial(dataclasses.dataclass, slots=True) +else: + _dataclass = dataclasses.dataclass + +import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json.common.v1.common + + +@typing.final +@_dataclass +class Resource: + """ + Generated from protobuf message Resource + """ + + attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + dropped_attributes_count: typing.Optional[builtins.int] = 0 + entity_refs: builtins.list[opentelemetry.proto_json.common.v1.common.EntityRef] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.attributes: + _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + if self.dropped_attributes_count: + _result["droppedAttributesCount"] = self.dropped_attributes_count + if self.entity_refs: + _result["entityRefs"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.entity_refs, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Resource": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Resource instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("attributes")) is not None: + _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + if (_value := data.get("droppedAttributesCount")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + _args["dropped_attributes_count"] = _value + if (_value := data.get("entityRefs")) is not None: + _args["entity_refs"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.EntityRef.from_dict(_v), "entity_refs") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Resource": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py new file mode 100644 index 00000000000..a1fa28f18e3 --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py @@ -0,0 +1,664 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# AUTO-GENERATED from "opentelemetry/proto/trace/v1/trace.proto" +# DO NOT EDIT MANUALLY + +from __future__ import annotations + +import builtins +import dataclasses +import enum +import functools +import json +import sys +import typing + +if sys.version_info >= (3, 10): + _dataclass = functools.partial(dataclasses.dataclass, slots=True) +else: + _dataclass = dataclasses.dataclass + +import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json.common.v1.common +import opentelemetry.proto_json.resource.v1.resource + + +@typing.final +class SpanFlags(enum.IntEnum): + """ + Generated from protobuf enum SpanFlags + """ + + SPAN_FLAGS_DO_NOT_USE = 0 + SPAN_FLAGS_TRACE_FLAGS_MASK = 255 + SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 256 + SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 512 + +@typing.final +@_dataclass +class TracesData: + """ + Generated from protobuf message TracesData + """ + + resource_spans: builtins.list[ResourceSpans] = dataclasses.field(default_factory=builtins.list) + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource_spans: + _result["resourceSpans"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_spans, lambda _v: _v.to_dict()) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "TracesData": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + TracesData instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resourceSpans")) is not None: + _args["resource_spans"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ResourceSpans.from_dict(_v), "resource_spans") + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "TracesData": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ResourceSpans: + """ + Generated from protobuf message ResourceSpans + """ + + resource: typing.Optional[opentelemetry.proto_json.resource.v1.resource.Resource] = None + scope_spans: builtins.list[ScopeSpans] = dataclasses.field(default_factory=builtins.list) + schema_url: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.resource: + _result["resource"] = self.resource.to_dict() + if self.scope_spans: + _result["scopeSpans"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.scope_spans, lambda _v: _v.to_dict()) + if self.schema_url: + _result["schemaUrl"] = self.schema_url + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceSpans": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ResourceSpans instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("resource")) is not None: + _args["resource"] = opentelemetry.proto_json.resource.v1.resource.Resource.from_dict(_value) + if (_value := data.get("scopeSpans")) is not None: + _args["scope_spans"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ScopeSpans.from_dict(_v), "scope_spans") + if (_value := data.get("schemaUrl")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + _args["schema_url"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ResourceSpans": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class ScopeSpans: + """ + Generated from protobuf message ScopeSpans + """ + + scope: typing.Optional[opentelemetry.proto_json.common.v1.common.InstrumentationScope] = None + spans: builtins.list[Span] = dataclasses.field(default_factory=builtins.list) + schema_url: typing.Optional[builtins.str] = "" + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.scope: + _result["scope"] = self.scope.to_dict() + if self.spans: + _result["spans"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.spans, lambda _v: _v.to_dict()) + if self.schema_url: + _result["schemaUrl"] = self.schema_url + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeSpans": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + ScopeSpans instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("scope")) is not None: + _args["scope"] = opentelemetry.proto_json.common.v1.common.InstrumentationScope.from_dict(_value) + if (_value := data.get("spans")) is not None: + _args["spans"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Span.from_dict(_v), "spans") + if (_value := data.get("schemaUrl")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + _args["schema_url"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ScopeSpans": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Span: + """ + Generated from protobuf message Span + """ + + @typing.final + class SpanKind(enum.IntEnum): + """ + Generated from protobuf enum SpanKind + """ + + SPAN_KIND_UNSPECIFIED = 0 + SPAN_KIND_INTERNAL = 1 + SPAN_KIND_SERVER = 2 + SPAN_KIND_CLIENT = 3 + SPAN_KIND_PRODUCER = 4 + SPAN_KIND_CONSUMER = 5 + + @typing.final + @_dataclass + class Event: + """ + Generated from protobuf message Event + """ + + time_unix_nano: typing.Optional[builtins.int] = 0 + name: typing.Optional[builtins.str] = "" + attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + dropped_attributes_count: typing.Optional[builtins.int] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.time_unix_nano: + _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + if self.name: + _result["name"] = self.name + if self.attributes: + _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + if self.dropped_attributes_count: + _result["droppedAttributesCount"] = self.dropped_attributes_count + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span.Event": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Event instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("timeUnixNano")) is not None: + _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + if (_value := data.get("name")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "name") + _args["name"] = _value + if (_value := data.get("attributes")) is not None: + _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + if (_value := data.get("droppedAttributesCount")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + _args["dropped_attributes_count"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Span.Event": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + @typing.final + @_dataclass + class Link: + """ + Generated from protobuf message Link + """ + + trace_id: typing.Optional[builtins.bytes] = b"" + span_id: typing.Optional[builtins.bytes] = b"" + trace_state: typing.Optional[builtins.str] = "" + attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + dropped_attributes_count: typing.Optional[builtins.int] = 0 + flags: typing.Optional[builtins.int] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.trace_id: + _result["traceId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.trace_id) + if self.span_id: + _result["spanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.span_id) + if self.trace_state: + _result["traceState"] = self.trace_state + if self.attributes: + _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + if self.dropped_attributes_count: + _result["droppedAttributesCount"] = self.dropped_attributes_count + if self.flags: + _result["flags"] = self.flags + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span.Link": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Link instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("traceId")) is not None: + _args["trace_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "trace_id") + if (_value := data.get("spanId")) is not None: + _args["span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "span_id") + if (_value := data.get("traceState")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "trace_state") + _args["trace_state"] = _value + if (_value := data.get("attributes")) is not None: + _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + if (_value := data.get("droppedAttributesCount")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + _args["dropped_attributes_count"] = _value + if (_value := data.get("flags")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + _args["flags"] = _value + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Span.Link": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + trace_id: typing.Optional[builtins.bytes] = b"" + span_id: typing.Optional[builtins.bytes] = b"" + trace_state: typing.Optional[builtins.str] = "" + parent_span_id: typing.Optional[builtins.bytes] = b"" + flags: typing.Optional[builtins.int] = 0 + name: typing.Optional[builtins.str] = "" + kind: typing.Union[Span.SpanKind, builtins.int, None] = 0 + start_time_unix_nano: typing.Optional[builtins.int] = 0 + end_time_unix_nano: typing.Optional[builtins.int] = 0 + attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) + dropped_attributes_count: typing.Optional[builtins.int] = 0 + events: builtins.list[Span.Event] = dataclasses.field(default_factory=builtins.list) + dropped_events_count: typing.Optional[builtins.int] = 0 + links: builtins.list[Span.Link] = dataclasses.field(default_factory=builtins.list) + dropped_links_count: typing.Optional[builtins.int] = 0 + status: typing.Optional[Status] = None + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.trace_id: + _result["traceId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.trace_id) + if self.span_id: + _result["spanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.span_id) + if self.trace_state: + _result["traceState"] = self.trace_state + if self.parent_span_id: + _result["parentSpanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.parent_span_id) + if self.flags: + _result["flags"] = self.flags + if self.name: + _result["name"] = self.name + if self.kind: + _result["kind"] = builtins.int(self.kind) + if self.start_time_unix_nano: + _result["startTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_time_unix_nano) + if self.end_time_unix_nano: + _result["endTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.end_time_unix_nano) + if self.attributes: + _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + if self.dropped_attributes_count: + _result["droppedAttributesCount"] = self.dropped_attributes_count + if self.events: + _result["events"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.events, lambda _v: _v.to_dict()) + if self.dropped_events_count: + _result["droppedEventsCount"] = self.dropped_events_count + if self.links: + _result["links"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.links, lambda _v: _v.to_dict()) + if self.dropped_links_count: + _result["droppedLinksCount"] = self.dropped_links_count + if self.status: + _result["status"] = self.status.to_dict() + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Span instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("traceId")) is not None: + _args["trace_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "trace_id") + if (_value := data.get("spanId")) is not None: + _args["span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "span_id") + if (_value := data.get("traceState")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "trace_state") + _args["trace_state"] = _value + if (_value := data.get("parentSpanId")) is not None: + _args["parent_span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "parent_span_id") + if (_value := data.get("flags")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + _args["flags"] = _value + if (_value := data.get("name")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "name") + _args["name"] = _value + if (_value := data.get("kind")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "kind") + _args["kind"] = Span.SpanKind(_value) + if (_value := data.get("startTimeUnixNano")) is not None: + _args["start_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_time_unix_nano") + if (_value := data.get("endTimeUnixNano")) is not None: + _args["end_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "end_time_unix_nano") + if (_value := data.get("attributes")) is not None: + _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + if (_value := data.get("droppedAttributesCount")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + _args["dropped_attributes_count"] = _value + if (_value := data.get("events")) is not None: + _args["events"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Span.Event.from_dict(_v), "events") + if (_value := data.get("droppedEventsCount")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_events_count") + _args["dropped_events_count"] = _value + if (_value := data.get("links")) is not None: + _args["links"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Span.Link.from_dict(_v), "links") + if (_value := data.get("droppedLinksCount")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_links_count") + _args["dropped_links_count"] = _value + if (_value := data.get("status")) is not None: + _args["status"] = Status.from_dict(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Span": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) + + +@typing.final +@_dataclass +class Status: + """ + Generated from protobuf message Status + """ + + @typing.final + class StatusCode(enum.IntEnum): + """ + Generated from protobuf enum StatusCode + """ + + STATUS_CODE_UNSET = 0 + STATUS_CODE_OK = 1 + STATUS_CODE_ERROR = 2 + + message: typing.Optional[builtins.str] = "" + code: typing.Union[Status.StatusCode, builtins.int, None] = 0 + + def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: + """ + Convert this message to a dictionary with lowerCamelCase keys. + + Returns: + Dictionary representation following OTLP JSON encoding + """ + _result = {} + if self.message: + _result["message"] = self.message + if self.code: + _result["code"] = builtins.int(self.code) + return _result + + def to_json(self) -> builtins.str: + """ + Serialize this message to a JSON string. + + Returns: + JSON string + """ + return json.dumps(self.to_dict()) + + @builtins.classmethod + def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Status": + """ + Create from a dictionary with lowerCamelCase keys. + + Args: + data: Dictionary representation following OTLP JSON encoding + + Returns: + Status instance + """ + opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + _args = {} + + if (_value := data.get("message")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "message") + _args["message"] = _value + if (_value := data.get("code")) is not None: + opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "code") + _args["code"] = Status.StatusCode(_value) + + return cls(**_args) + + @builtins.classmethod + def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Status": + """ + Deserialize from a JSON string or bytes. + + Args: + data: JSON string or bytes + + Returns: + Instance of the class + """ + return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/version/__init__.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/version/__init__.py new file mode 100644 index 00000000000..c099e9440e9 --- /dev/null +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/version/__init__.py @@ -0,0 +1,15 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +__version__ = "0.61b0.dev" diff --git a/opentelemetry-proto-json/test-requirements.in b/opentelemetry-proto-json/test-requirements.in new file mode 100644 index 00000000000..60cf5e47dba --- /dev/null +++ b/opentelemetry-proto-json/test-requirements.in @@ -0,0 +1,6 @@ +colorama>=0.4.6 +iniconfig>=2.0.0 +packaging>=24.0 +pytest>=7.4.4 +pluggy>=1.0.0 +-e opentelemetry-proto-json diff --git a/opentelemetry-proto-json/test-requirements.latest.txt b/opentelemetry-proto-json/test-requirements.latest.txt new file mode 100644 index 00000000000..403b955c79d --- /dev/null +++ b/opentelemetry-proto-json/test-requirements.latest.txt @@ -0,0 +1,28 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile --python 3.9 --universal -c dev-requirements.txt opentelemetry-proto-json/test-requirements.in -o opentelemetry-proto-json/test-requirements.latest.txt +-e opentelemetry-proto-json + # via -r opentelemetry-proto-json/test-requirements.in +colorama==0.4.6 + # via + # -r opentelemetry-proto-json/test-requirements.in + # pytest +exceptiongroup==1.3.1 ; python_full_version < '3.11' + # via pytest +iniconfig==2.1.0 + # via + # -r opentelemetry-proto-json/test-requirements.in + # pytest +packaging==26.0 + # via + # -r opentelemetry-proto-json/test-requirements.in + # pytest +pluggy==1.6.0 + # via pytest +pytest==7.4.4 + # via + # -c dev-requirements.txt + # -r opentelemetry-proto-json/test-requirements.in +tomli==2.4.0 ; python_full_version < '3.11' + # via pytest +typing-extensions==4.15.0 ; python_full_version < '3.11' + # via exceptiongroup diff --git a/opentelemetry-proto-json/test-requirements.oldest.txt b/opentelemetry-proto-json/test-requirements.oldest.txt new file mode 100644 index 00000000000..730c9c03709 --- /dev/null +++ b/opentelemetry-proto-json/test-requirements.oldest.txt @@ -0,0 +1,28 @@ +# This file was autogenerated by uv via the following command: +# uv pip compile --python 3.9 --universal --resolution lowest -c dev-requirements.txt opentelemetry-proto-json/test-requirements.in -o opentelemetry-proto-json/test-requirements.oldest.txt +-e opentelemetry-proto-json + # via -r opentelemetry-proto-json/test-requirements.in +colorama==0.4.6 + # via + # -r opentelemetry-proto-json/test-requirements.in + # pytest +exceptiongroup==1.0.0 ; python_full_version < '3.11' + # via pytest +iniconfig==2.0.0 + # via + # -r opentelemetry-proto-json/test-requirements.in + # pytest +packaging==24.0 + # via + # -r opentelemetry-proto-json/test-requirements.in + # pytest +pluggy==1.0.0 + # via + # -r opentelemetry-proto-json/test-requirements.in + # pytest +pytest==7.4.4 + # via + # -c dev-requirements.txt + # -r opentelemetry-proto-json/test-requirements.in +tomli==1.0.0 ; python_full_version < '3.11' + # via pytest diff --git a/opentelemetry-proto-json/tests/__init__.py b/opentelemetry-proto-json/tests/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/opentelemetry-proto-json/tests/test_proto.py b/opentelemetry-proto-json/tests/test_proto.py new file mode 100644 index 00000000000..f99d4abfb07 --- /dev/null +++ b/opentelemetry-proto-json/tests/test_proto.py @@ -0,0 +1,23 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# type: ignore + +from importlib.util import find_spec +from unittest import TestCase + + +class TestInstrumentor(TestCase): + def test_proto(self): + if find_spec("opentelemetry.proto_json") is None: + self.fail("opentelemetry-proto-json not installed") From 67319f4f8a35c15421fb20689176285216d56b60 Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Fri, 27 Feb 2026 10:49:21 -0500 Subject: [PATCH 03/15] update project files to incorporate new packages --- .github/workflows/test_0.yml | 1222 ++++++++++++++++----------------- .github/workflows/test_1.yml | 672 ++++++++++++++++++ CHANGELOG.md | 2 + pyproject.toml | 7 + scripts/proto_codegen_json.sh | 58 ++ tox.ini | 10 + uv.lock | 51 ++ 7 files changed, 1395 insertions(+), 627 deletions(-) create mode 100755 scripts/proto_codegen_json.sh diff --git a/.github/workflows/test_0.yml b/.github/workflows/test_0.yml index 8be00065513..301f70c9d3c 100644 --- a/.github/workflows/test_0.yml +++ b/.github/workflows/test_0.yml @@ -493,6 +493,310 @@ jobs: - name: Run tests run: tox -e pypy3-test-opentelemetry-proto-gen-latest -- -ra + py39-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: + name: opentelemetry-protojson-gen-oldest 3.9 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-protojson-gen-oldest -- -ra + + py39-test-opentelemetry-protojson-gen-latest_ubuntu-latest: + name: opentelemetry-protojson-gen-latest 3.9 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-protojson-gen-latest -- -ra + + py310-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: + name: opentelemetry-protojson-gen-oldest 3.10 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-protojson-gen-oldest -- -ra + + py310-test-opentelemetry-protojson-gen-latest_ubuntu-latest: + name: opentelemetry-protojson-gen-latest 3.10 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-protojson-gen-latest -- -ra + + py311-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: + name: opentelemetry-protojson-gen-oldest 3.11 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-protojson-gen-oldest -- -ra + + py311-test-opentelemetry-protojson-gen-latest_ubuntu-latest: + name: opentelemetry-protojson-gen-latest 3.11 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-protojson-gen-latest -- -ra + + py312-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: + name: opentelemetry-protojson-gen-oldest 3.12 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-protojson-gen-oldest -- -ra + + py312-test-opentelemetry-protojson-gen-latest_ubuntu-latest: + name: opentelemetry-protojson-gen-latest 3.12 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-protojson-gen-latest -- -ra + + py313-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: + name: opentelemetry-protojson-gen-oldest 3.13 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-protojson-gen-oldest -- -ra + + py313-test-opentelemetry-protojson-gen-latest_ubuntu-latest: + name: opentelemetry-protojson-gen-latest 3.13 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-protojson-gen-latest -- -ra + + py314-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: + name: opentelemetry-protojson-gen-oldest 3.14 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314-test-opentelemetry-protojson-gen-oldest -- -ra + + py314-test-opentelemetry-protojson-gen-latest_ubuntu-latest: + name: opentelemetry-protojson-gen-latest 3.14 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314-test-opentelemetry-protojson-gen-latest -- -ra + + py314t-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: + name: opentelemetry-protojson-gen-oldest 3.14t Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14t + uses: actions/setup-python@v5 + with: + python-version: "3.14t" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314t-test-opentelemetry-protojson-gen-oldest -- -ra + + py314t-test-opentelemetry-protojson-gen-latest_ubuntu-latest: + name: opentelemetry-protojson-gen-latest 3.14t Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14t + uses: actions/setup-python@v5 + with: + python-version: "3.14t" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314t-test-opentelemetry-protojson-gen-latest -- -ra + + pypy3-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: + name: opentelemetry-protojson-gen-oldest pypy-3.9 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.9 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e pypy3-test-opentelemetry-protojson-gen-oldest -- -ra + + pypy3-test-opentelemetry-protojson-gen-latest_ubuntu-latest: + name: opentelemetry-protojson-gen-latest pypy-3.9 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.9 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e pypy3-test-opentelemetry-protojson-gen-latest -- -ra + py39-test-opentelemetry-sdk_ubuntu-latest: name: opentelemetry-sdk 3.9 Ubuntu runs-on: ubuntu-latest @@ -3547,302 +3851,8 @@ jobs: - name: Run tests run: tox -e pypy3-test-opentelemetry-proto-gen-latest -- -ra - py39-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.9 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-opentelemetry-sdk -- -ra - - py310-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.10 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py310-test-opentelemetry-sdk -- -ra - - py311-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.11 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py311-test-opentelemetry-sdk -- -ra - - py312-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.12 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py312-test-opentelemetry-sdk -- -ra - - py313-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.13 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.13 - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py313-test-opentelemetry-sdk -- -ra - - py314-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.14 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.14 - uses: actions/setup-python@v5 - with: - python-version: "3.14" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py314-test-opentelemetry-sdk -- -ra - - py314t-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.14t Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.14t - uses: actions/setup-python@v5 - with: - python-version: "3.14t" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py314t-test-opentelemetry-sdk -- -ra - - pypy3-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk pypy-3.9 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python pypy-3.9 - uses: actions/setup-python@v5 - with: - python-version: "pypy-3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e pypy3-test-opentelemetry-sdk -- -ra - - py39-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.9 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-opentelemetry-semantic-conventions -- -ra - - py310-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.10 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py310-test-opentelemetry-semantic-conventions -- -ra - - py311-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.11 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py311-test-opentelemetry-semantic-conventions -- -ra - - py312-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.12 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py312-test-opentelemetry-semantic-conventions -- -ra - - py313-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.13 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.13 - uses: actions/setup-python@v5 - with: - python-version: "3.13" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py313-test-opentelemetry-semantic-conventions -- -ra - - py314-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.14 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.14 - uses: actions/setup-python@v5 - with: - python-version: "3.14" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py314-test-opentelemetry-semantic-conventions -- -ra - - py314t-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.14t Windows + py39-test-opentelemetry-protojson-gen-oldest_windows-latest: + name: opentelemetry-protojson-gen-oldest 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -3851,19 +3861,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.14t + - name: Set up Python 3.9 uses: actions/setup-python@v5 with: - python-version: "3.14t" + python-version: "3.9" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py314t-test-opentelemetry-semantic-conventions -- -ra + run: tox -e py39-test-opentelemetry-protojson-gen-oldest -- -ra - pypy3-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions pypy-3.9 Windows + py39-test-opentelemetry-protojson-gen-latest_windows-latest: + name: opentelemetry-protojson-gen-latest 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -3872,19 +3882,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python pypy-3.9 + - name: Set up Python 3.9 uses: actions/setup-python@v5 with: - python-version: "pypy-3.9" + python-version: "3.9" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e pypy3-test-opentelemetry-semantic-conventions -- -ra + run: tox -e py39-test-opentelemetry-protojson-gen-latest -- -ra - py39-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.9 Windows + py310-test-opentelemetry-protojson-gen-oldest_windows-latest: + name: opentelemetry-protojson-gen-oldest 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -3893,26 +3903,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - - name: Set up Python 3.9 + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-getting-started -- -ra + run: tox -e py310-test-opentelemetry-protojson-gen-oldest -- -ra - py310-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.10 Windows + py310-test-opentelemetry-protojson-gen-latest_windows-latest: + name: opentelemetry-protojson-gen-latest 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -3921,13 +3924,6 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - name: Set up Python 3.10 uses: actions/setup-python@v5 with: @@ -3937,10 +3933,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-getting-started -- -ra + run: tox -e py310-test-opentelemetry-protojson-gen-latest -- -ra - py311-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.11 Windows + py311-test-opentelemetry-protojson-gen-oldest_windows-latest: + name: opentelemetry-protojson-gen-oldest 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -3949,13 +3945,6 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - name: Set up Python 3.11 uses: actions/setup-python@v5 with: @@ -3965,10 +3954,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-getting-started -- -ra + run: tox -e py311-test-opentelemetry-protojson-gen-oldest -- -ra - py312-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.12 Windows + py311-test-opentelemetry-protojson-gen-latest_windows-latest: + name: opentelemetry-protojson-gen-latest 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -3977,26 +3966,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - - name: Set up Python 3.12 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.11" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-getting-started -- -ra + run: tox -e py311-test-opentelemetry-protojson-gen-latest -- -ra - py313-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.13 Windows + py312-test-opentelemetry-protojson-gen-oldest_windows-latest: + name: opentelemetry-protojson-gen-oldest 3.12 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4005,26 +3987,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - - name: Set up Python 3.13 + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.12" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-getting-started -- -ra + run: tox -e py312-test-opentelemetry-protojson-gen-oldest -- -ra - py314-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.14 Windows + py312-test-opentelemetry-protojson-gen-latest_windows-latest: + name: opentelemetry-protojson-gen-latest 3.12 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4033,26 +4008,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - - name: Set up Python 3.14 + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: "3.14" + python-version: "3.12" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py314-test-opentelemetry-getting-started -- -ra + run: tox -e py312-test-opentelemetry-protojson-gen-latest -- -ra - py39-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.9 Windows + py313-test-opentelemetry-protojson-gen-oldest_windows-latest: + name: opentelemetry-protojson-gen-oldest 3.13 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4061,19 +4029,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.9 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.13" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-opentracing-shim -- -ra + run: tox -e py313-test-opentelemetry-protojson-gen-oldest -- -ra - py310-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.10 Windows + py313-test-opentelemetry-protojson-gen-latest_windows-latest: + name: opentelemetry-protojson-gen-latest 3.13 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4082,19 +4050,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.13" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-opentracing-shim -- -ra + run: tox -e py313-test-opentelemetry-protojson-gen-latest -- -ra - py311-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.11 Windows + py314-test-opentelemetry-protojson-gen-oldest_windows-latest: + name: opentelemetry-protojson-gen-oldest 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4103,19 +4071,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.11 + - name: Set up Python 3.14 uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.14" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-opentracing-shim -- -ra + run: tox -e py314-test-opentelemetry-protojson-gen-oldest -- -ra - py312-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.12 Windows + py314-test-opentelemetry-protojson-gen-latest_windows-latest: + name: opentelemetry-protojson-gen-latest 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4124,19 +4092,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.12 + - name: Set up Python 3.14 uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.14" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-opentracing-shim -- -ra + run: tox -e py314-test-opentelemetry-protojson-gen-latest -- -ra - py313-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.13 Windows + py314t-test-opentelemetry-protojson-gen-oldest_windows-latest: + name: opentelemetry-protojson-gen-oldest 3.14t Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4145,19 +4113,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.13 + - name: Set up Python 3.14t uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.14t" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-opentracing-shim -- -ra + run: tox -e py314t-test-opentelemetry-protojson-gen-oldest -- -ra - py314-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.14 Windows + py314t-test-opentelemetry-protojson-gen-latest_windows-latest: + name: opentelemetry-protojson-gen-latest 3.14t Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4166,19 +4134,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.14 + - name: Set up Python 3.14t uses: actions/setup-python@v5 with: - python-version: "3.14" + python-version: "3.14t" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py314-test-opentelemetry-opentracing-shim -- -ra + run: tox -e py314t-test-opentelemetry-protojson-gen-latest -- -ra - py314t-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.14t Windows + pypy3-test-opentelemetry-protojson-gen-oldest_windows-latest: + name: opentelemetry-protojson-gen-oldest pypy-3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4187,19 +4155,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.14t + - name: Set up Python pypy-3.9 uses: actions/setup-python@v5 with: - python-version: "3.14t" + python-version: "pypy-3.9" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py314t-test-opentelemetry-opentracing-shim -- -ra + run: tox -e pypy3-test-opentelemetry-protojson-gen-oldest -- -ra - pypy3-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim pypy-3.9 Windows + pypy3-test-opentelemetry-protojson-gen-latest_windows-latest: + name: opentelemetry-protojson-gen-latest pypy-3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4217,10 +4185,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e pypy3-test-opentelemetry-opentracing-shim -- -ra + run: tox -e pypy3-test-opentelemetry-protojson-gen-latest -- -ra - py39-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.9 Windows + py39-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4238,10 +4206,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-opencensus-shim -- -ra + run: tox -e py39-test-opentelemetry-sdk -- -ra - py310-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.10 Windows + py310-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4259,10 +4227,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-opencensus-shim -- -ra + run: tox -e py310-test-opentelemetry-sdk -- -ra - py311-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.11 Windows + py311-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4280,10 +4248,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-opencensus-shim -- -ra + run: tox -e py311-test-opentelemetry-sdk -- -ra - py312-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.12 Windows + py312-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.12 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4301,10 +4269,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-opencensus-shim -- -ra + run: tox -e py312-test-opentelemetry-sdk -- -ra - py313-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.13 Windows + py313-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.13 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4322,10 +4290,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-opencensus-shim -- -ra + run: tox -e py313-test-opentelemetry-sdk -- -ra - py314-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.14 Windows + py314-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4337,100 +4305,16 @@ jobs: - name: Set up Python 3.14 uses: actions/setup-python@v5 with: - python-version: "3.14" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py314-test-opentelemetry-opencensus-shim -- -ra - - py39-test-opentelemetry-exporter-opencensus_windows-latest: - name: opentelemetry-exporter-opencensus 3.9 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-opentelemetry-exporter-opencensus -- -ra - - py310-test-opentelemetry-exporter-opencensus_windows-latest: - name: opentelemetry-exporter-opencensus 3.10 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py310-test-opentelemetry-exporter-opencensus -- -ra - - py311-test-opentelemetry-exporter-opencensus_windows-latest: - name: opentelemetry-exporter-opencensus 3.11 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py311-test-opentelemetry-exporter-opencensus -- -ra - - py312-test-opentelemetry-exporter-opencensus_windows-latest: - name: opentelemetry-exporter-opencensus 3.12 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" + python-version: "3.14" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-exporter-opencensus -- -ra + run: tox -e py314-test-opentelemetry-sdk -- -ra - py313-test-opentelemetry-exporter-opencensus_windows-latest: - name: opentelemetry-exporter-opencensus 3.13 Windows + py314t-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.14t Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4439,19 +4323,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.13 + - name: Set up Python 3.14t uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.14t" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-exporter-opencensus -- -ra + run: tox -e py314t-test-opentelemetry-sdk -- -ra - py314-test-opentelemetry-exporter-opencensus_windows-latest: - name: opentelemetry-exporter-opencensus 3.14 Windows + pypy3-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk pypy-3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4460,19 +4344,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.14 + - name: Set up Python pypy-3.9 uses: actions/setup-python@v5 with: - python-version: "3.14" + python-version: "pypy-3.9" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py314-test-opentelemetry-exporter-opencensus -- -ra + run: tox -e pypy3-test-opentelemetry-sdk -- -ra - py39-test-opentelemetry-exporter-otlp-proto-common_windows-latest: - name: opentelemetry-exporter-otlp-proto-common 3.9 Windows + py39-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4490,10 +4374,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-exporter-otlp-proto-common -- -ra + run: tox -e py39-test-opentelemetry-semantic-conventions -- -ra - py310-test-opentelemetry-exporter-otlp-proto-common_windows-latest: - name: opentelemetry-exporter-otlp-proto-common 3.10 Windows + py310-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4511,10 +4395,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-exporter-otlp-proto-common -- -ra + run: tox -e py310-test-opentelemetry-semantic-conventions -- -ra - py311-test-opentelemetry-exporter-otlp-proto-common_windows-latest: - name: opentelemetry-exporter-otlp-proto-common 3.11 Windows + py311-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4532,10 +4416,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-exporter-otlp-proto-common -- -ra + run: tox -e py311-test-opentelemetry-semantic-conventions -- -ra - py312-test-opentelemetry-exporter-otlp-proto-common_windows-latest: - name: opentelemetry-exporter-otlp-proto-common 3.12 Windows + py312-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.12 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4553,10 +4437,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-exporter-otlp-proto-common -- -ra + run: tox -e py312-test-opentelemetry-semantic-conventions -- -ra - py313-test-opentelemetry-exporter-otlp-proto-common_windows-latest: - name: opentelemetry-exporter-otlp-proto-common 3.13 Windows + py313-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.13 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4574,10 +4458,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-exporter-otlp-proto-common -- -ra + run: tox -e py313-test-opentelemetry-semantic-conventions -- -ra - py314-test-opentelemetry-exporter-otlp-proto-common_windows-latest: - name: opentelemetry-exporter-otlp-proto-common 3.14 Windows + py314-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4595,10 +4479,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py314-test-opentelemetry-exporter-otlp-proto-common -- -ra + run: tox -e py314-test-opentelemetry-semantic-conventions -- -ra - py314t-test-opentelemetry-exporter-otlp-proto-common_windows-latest: - name: opentelemetry-exporter-otlp-proto-common 3.14t Windows + py314t-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.14t Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4616,10 +4500,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py314t-test-opentelemetry-exporter-otlp-proto-common -- -ra + run: tox -e py314t-test-opentelemetry-semantic-conventions -- -ra - pypy3-test-opentelemetry-exporter-otlp-proto-common_windows-latest: - name: opentelemetry-exporter-otlp-proto-common pypy-3.9 Windows + pypy3-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions pypy-3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4637,10 +4521,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e pypy3-test-opentelemetry-exporter-otlp-proto-common -- -ra + run: tox -e pypy3-test-opentelemetry-semantic-conventions -- -ra - py39-test-opentelemetry-exporter-otlp-combined_windows-latest: - name: opentelemetry-exporter-otlp-combined 3.9 Windows + py39-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4649,6 +4533,13 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib + - name: Set up Python 3.9 uses: actions/setup-python@v5 with: @@ -4658,10 +4549,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-exporter-otlp-combined -- -ra + run: tox -e py39-test-opentelemetry-getting-started -- -ra - py310-test-opentelemetry-exporter-otlp-combined_windows-latest: - name: opentelemetry-exporter-otlp-combined 3.10 Windows + py310-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4670,6 +4561,13 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: @@ -4679,10 +4577,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-exporter-otlp-combined -- -ra + run: tox -e py310-test-opentelemetry-getting-started -- -ra - py311-test-opentelemetry-exporter-otlp-combined_windows-latest: - name: opentelemetry-exporter-otlp-combined 3.11 Windows + py311-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4691,6 +4589,13 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: @@ -4700,10 +4605,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-exporter-otlp-combined -- -ra + run: tox -e py311-test-opentelemetry-getting-started -- -ra - py312-test-opentelemetry-exporter-otlp-combined_windows-latest: - name: opentelemetry-exporter-otlp-combined 3.12 Windows + py312-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.12 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4712,6 +4617,13 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: @@ -4721,10 +4633,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-exporter-otlp-combined -- -ra + run: tox -e py312-test-opentelemetry-getting-started -- -ra - py313-test-opentelemetry-exporter-otlp-combined_windows-latest: - name: opentelemetry-exporter-otlp-combined 3.13 Windows + py313-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.13 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4733,6 +4645,13 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: @@ -4742,10 +4661,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-exporter-otlp-combined -- -ra + run: tox -e py313-test-opentelemetry-getting-started -- -ra - py314-test-opentelemetry-exporter-otlp-combined_windows-latest: - name: opentelemetry-exporter-otlp-combined 3.14 Windows + py314-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4754,6 +4673,13 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib + - name: Set up Python 3.14 uses: actions/setup-python@v5 with: @@ -4763,10 +4689,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py314-test-opentelemetry-exporter-otlp-combined -- -ra + run: tox -e py314-test-opentelemetry-getting-started -- -ra - py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.9 Windows + py39-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4784,10 +4710,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + run: tox -e py39-test-opentelemetry-opentracing-shim -- -ra - py39-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-latest 3.9 Windows + py310-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4796,19 +4722,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.9 + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.10" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + run: tox -e py310-test-opentelemetry-opentracing-shim -- -ra - py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.10 Windows + py311-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4817,19 +4743,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.11" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + run: tox -e py311-test-opentelemetry-opentracing-shim -- -ra - py310-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-latest 3.10 Windows + py312-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.12 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4838,19 +4764,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.12" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + run: tox -e py312-test-opentelemetry-opentracing-shim -- -ra - py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.11 Windows + py313-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.13 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4859,19 +4785,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.11 + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.13" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + run: tox -e py313-test-opentelemetry-opentracing-shim -- -ra - py311-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-latest 3.11 Windows + py314-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4880,19 +4806,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.11 + - name: Set up Python 3.14 uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.14" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + run: tox -e py314-test-opentelemetry-opentracing-shim -- -ra - py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.12 Windows + py314t-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.14t Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4901,19 +4827,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.12 + - name: Set up Python 3.14t uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "3.14t" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + run: tox -e py314t-test-opentelemetry-opentracing-shim -- -ra - py312-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-latest 3.12 Windows + pypy3-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim pypy-3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4922,19 +4848,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.12 + - name: Set up Python pypy-3.9 uses: actions/setup-python@v5 with: - python-version: "3.12" + python-version: "pypy-3.9" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + run: tox -e pypy3-test-opentelemetry-opentracing-shim -- -ra - py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.13 Windows + py39-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4943,19 +4869,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.13 + - name: Set up Python 3.9 uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.9" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + run: tox -e py39-test-opentelemetry-opencensus-shim -- -ra - py313-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-latest 3.13 Windows + py310-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4964,19 +4890,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.13 + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.10" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + run: tox -e py310-test-opentelemetry-opencensus-shim -- -ra - py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.14 Windows + py311-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4985,19 +4911,61 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.14 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: - python-version: "3.14" + python-version: "3.11" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + run: tox -e py311-test-opentelemetry-opencensus-shim -- -ra + + py312-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.12 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-opencensus-shim -- -ra + + py313-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.13 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-opencensus-shim -- -ra - py314-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: - name: opentelemetry-exporter-otlp-proto-grpc-latest 3.14 Windows + py314-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -5015,10 +4983,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + run: tox -e py314-test-opentelemetry-opencensus-shim -- -ra - py39-test-opentelemetry-exporter-otlp-proto-http_windows-latest: - name: opentelemetry-exporter-otlp-proto-http 3.9 Windows + py39-test-opentelemetry-exporter-opencensus_windows-latest: + name: opentelemetry-exporter-opencensus 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -5036,10 +5004,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-exporter-otlp-proto-http -- -ra + run: tox -e py39-test-opentelemetry-exporter-opencensus -- -ra - py310-test-opentelemetry-exporter-otlp-proto-http_windows-latest: - name: opentelemetry-exporter-otlp-proto-http 3.10 Windows + py310-test-opentelemetry-exporter-opencensus_windows-latest: + name: opentelemetry-exporter-opencensus 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -5057,4 +5025,4 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-exporter-otlp-proto-http -- -ra + run: tox -e py310-test-opentelemetry-exporter-opencensus -- -ra diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index 30245606bdd..612ef7f8fae 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -37,6 +37,678 @@ env: jobs: + py311-test-opentelemetry-exporter-opencensus_windows-latest: + name: opentelemetry-exporter-opencensus 3.11 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-exporter-opencensus -- -ra + + py312-test-opentelemetry-exporter-opencensus_windows-latest: + name: opentelemetry-exporter-opencensus 3.12 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-exporter-opencensus -- -ra + + py313-test-opentelemetry-exporter-opencensus_windows-latest: + name: opentelemetry-exporter-opencensus 3.13 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-exporter-opencensus -- -ra + + py314-test-opentelemetry-exporter-opencensus_windows-latest: + name: opentelemetry-exporter-opencensus 3.14 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314-test-opentelemetry-exporter-opencensus -- -ra + + py39-test-opentelemetry-exporter-otlp-proto-common_windows-latest: + name: opentelemetry-exporter-otlp-proto-common 3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-exporter-otlp-proto-common -- -ra + + py310-test-opentelemetry-exporter-otlp-proto-common_windows-latest: + name: opentelemetry-exporter-otlp-proto-common 3.10 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-exporter-otlp-proto-common -- -ra + + py311-test-opentelemetry-exporter-otlp-proto-common_windows-latest: + name: opentelemetry-exporter-otlp-proto-common 3.11 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-exporter-otlp-proto-common -- -ra + + py312-test-opentelemetry-exporter-otlp-proto-common_windows-latest: + name: opentelemetry-exporter-otlp-proto-common 3.12 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-exporter-otlp-proto-common -- -ra + + py313-test-opentelemetry-exporter-otlp-proto-common_windows-latest: + name: opentelemetry-exporter-otlp-proto-common 3.13 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-exporter-otlp-proto-common -- -ra + + py314-test-opentelemetry-exporter-otlp-proto-common_windows-latest: + name: opentelemetry-exporter-otlp-proto-common 3.14 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314-test-opentelemetry-exporter-otlp-proto-common -- -ra + + py314t-test-opentelemetry-exporter-otlp-proto-common_windows-latest: + name: opentelemetry-exporter-otlp-proto-common 3.14t Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14t + uses: actions/setup-python@v5 + with: + python-version: "3.14t" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314t-test-opentelemetry-exporter-otlp-proto-common -- -ra + + pypy3-test-opentelemetry-exporter-otlp-proto-common_windows-latest: + name: opentelemetry-exporter-otlp-proto-common pypy-3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.9 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e pypy3-test-opentelemetry-exporter-otlp-proto-common -- -ra + + py39-test-opentelemetry-exporter-otlp-combined_windows-latest: + name: opentelemetry-exporter-otlp-combined 3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-exporter-otlp-combined -- -ra + + py310-test-opentelemetry-exporter-otlp-combined_windows-latest: + name: opentelemetry-exporter-otlp-combined 3.10 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-exporter-otlp-combined -- -ra + + py311-test-opentelemetry-exporter-otlp-combined_windows-latest: + name: opentelemetry-exporter-otlp-combined 3.11 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-exporter-otlp-combined -- -ra + + py312-test-opentelemetry-exporter-otlp-combined_windows-latest: + name: opentelemetry-exporter-otlp-combined 3.12 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-exporter-otlp-combined -- -ra + + py313-test-opentelemetry-exporter-otlp-combined_windows-latest: + name: opentelemetry-exporter-otlp-combined 3.13 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-exporter-otlp-combined -- -ra + + py314-test-opentelemetry-exporter-otlp-combined_windows-latest: + name: opentelemetry-exporter-otlp-combined 3.14 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314-test-opentelemetry-exporter-otlp-combined -- -ra + + py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + + py39-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-latest 3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + + py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.10 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + + py310-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-latest 3.10 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + + py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.11 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + + py311-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-latest 3.11 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + + py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.12 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + + py312-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-latest 3.12 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + + py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.13 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + + py313-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-latest 3.13 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + + py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-oldest 3.14 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra + + py314-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: + name: opentelemetry-exporter-otlp-proto-grpc-latest 3.14 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra + + py39-test-opentelemetry-exporter-otlp-proto-http_windows-latest: + name: opentelemetry-exporter-otlp-proto-http 3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-exporter-otlp-proto-http -- -ra + + py310-test-opentelemetry-exporter-otlp-proto-http_windows-latest: + name: opentelemetry-exporter-otlp-proto-http 3.10 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-exporter-otlp-proto-http -- -ra + py311-test-opentelemetry-exporter-otlp-proto-http_windows-latest: name: opentelemetry-exporter-otlp-proto-http 3.11 Windows runs-on: windows-latest diff --git a/CHANGELOG.md b/CHANGELOG.md index 540f7b9d347..a95b5e68d05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#4973](https://github.com/open-telemetry/opentelemetry-python/pull/4973)) - `opentelemetry-exporter-prometheus`: Fix metric name prefix ([#4895](https://github.com/open-telemetry/opentelemetry-python/pull/4895)) +- `opentelemetry-proto-json`, `opentelemetry-codegen-json`: Implement custom protoc plugin to generate OTLP JSON class definitions + ([#4910](https://github.com/open-telemetry/opentelemetry-python/pull/4910)) ## Version 1.40.0/0.61b0 (2026-03-04) diff --git a/pyproject.toml b/pyproject.toml index 9cfa14e723b..4c30d56435c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,6 +7,7 @@ dependencies = [ "opentelemetry-sdk", "opentelemetry-semantic-conventions", "opentelemetry-proto", + "opentelemetry-proto-json", "opentelemetry-test-utils", "opentelemetry-exporter-otlp-proto-grpc", "opentelemetry-exporter-otlp-proto-http", @@ -15,6 +16,7 @@ dependencies = [ "opentelemetry-exporter-prometheus", "opentelemetry-propagator-jaeger", "opentelemetry-propagator-b3", + "opentelemetry-codegen-json", ] # https://docs.astral.sh/uv/reference/settings/ @@ -26,6 +28,7 @@ required-version = ">=0.6.0" opentelemetry-api = { workspace = true} opentelemetry-sdk = { workspace = true } opentelemetry-proto = { workspace = true } +opentelemetry-proto-json = { workspace = true } opentelemetry-semantic-conventions = { workspace = true } opentelemetry-test-utils = { workspace = true } opentelemetry-exporter-otlp-proto-grpc = { workspace = true } @@ -35,6 +38,7 @@ opentelemetry-exporter-zipkin-json = { workspace = true } opentelemetry-exporter-prometheus = {workspace = true } opentelemetry-propagator-jaeger = { workspace = true } opentelemetry-propagator-b3 = { workspace = true } +opentelemetry-codegen-json = { workspace = true } [tool.uv.workspace] members = [ @@ -42,8 +46,10 @@ members = [ "opentelemetry-sdk", "opentelemetry-semantic-conventions", "opentelemetry-proto", + "opentelemetry-proto-json", "exporter/*", "propagator/*", + "codegen/*", "tests/opentelemetry-test-utils", ] @@ -63,6 +69,7 @@ target-version = "py38" line-length = 79 extend-exclude = [ "*_pb2*.py*", + "opentelemetry-proto-json/src/*", ] output-format = "concise" diff --git a/scripts/proto_codegen_json.sh b/scripts/proto_codegen_json.sh new file mode 100755 index 00000000000..b37806809a9 --- /dev/null +++ b/scripts/proto_codegen_json.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# +# Regenerate python code from OTLP protos in +# https://github.com/open-telemetry/opentelemetry-proto +# +# To use, update PROTO_REPO_BRANCH_OR_COMMIT variable below to a commit hash or +# tag in opentelemtry-proto repo that you want to build off of. Then, just run +# this script to update the proto files. Commit the changes as well as any +# fixes needed in the OTLP exporter. +# +# Optional envars: +# PROTO_REPO_DIR - the path to an existing checkout of the opentelemetry-proto repo + +# Pinned commit/branch/tag for the current version used in opentelemetry-proto python package. +PROTO_REPO_BRANCH_OR_COMMIT="v1.9.0" + +set -e + +PROTO_REPO_DIR=${PROTO_REPO_DIR:-"/tmp/opentelemetry-proto"} +# root of opentelemetry-python repo +repo_root="$(git rev-parse --show-toplevel)" + +protoc() { + uvx -c $repo_root/gen-requirements.txt \ + --python 3.12 \ + --from grpcio-tools \ + python -m grpc_tools.protoc "$@" +} + +protoc --version + +# Clone the proto repo if it doesn't exist +if [ ! -d "$PROTO_REPO_DIR" ]; then + git clone https://github.com/open-telemetry/opentelemetry-proto.git $PROTO_REPO_DIR +fi + +# Pull in changes and switch to requested branch +( + cd $PROTO_REPO_DIR + git fetch --all + git checkout $PROTO_REPO_BRANCH_OR_COMMIT + # pull if PROTO_REPO_BRANCH_OR_COMMIT is not a detached head + git symbolic-ref -q HEAD && git pull --ff-only || true +) + +cd $repo_root/opentelemetry-proto-json/src + +# clean up old generated code +find opentelemetry/proto_json/ -name "*.py" -delete + +# generate proto code for all protos +all_protos=$(find $PROTO_REPO_DIR/ -iname "*.proto") +protoc \ + -I $PROTO_REPO_DIR \ + --otlp_json_out=. \ + $all_protos + +echo "Please update ./opentelemetry-proto-json/README.rst to include the updated version." diff --git a/tox.ini b/tox.ini index e16bd9ab19c..da6619b7034 100644 --- a/tox.ini +++ b/tox.ini @@ -16,6 +16,9 @@ envlist = pypy3-test-opentelemetry-proto-gen-{oldest,latest} lint-opentelemetry-proto-gen-latest + py3{9,10,11,12,13,14,14t}-test-opentelemetry-protojson-gen-{oldest,latest} + pypy3-test-opentelemetry-protojson-gen-{oldest,latest} + py3{9,10,11,12,13,14,14t}-test-opentelemetry-sdk pypy3-test-opentelemetry-sdk lint-opentelemetry-sdk @@ -116,6 +119,9 @@ deps = opentelemetry-proto-gen-oldest: -r {toxinidir}/opentelemetry-proto/test-requirements.oldest.txt opentelemetry-proto-gen-latest: -r {toxinidir}/opentelemetry-proto/test-requirements.latest.txt + opentelemetry-protojson-gen-oldest: -r {toxinidir}/opentelemetry-proto-json/test-requirements.oldest.txt + opentelemetry-protojson-gen-latest: -r {toxinidir}/opentelemetry-proto-json/test-requirements.latest.txt + exporter-opencensus: -r {toxinidir}/exporter/opentelemetry-exporter-opencensus/test-requirements.txt exporter-otlp-proto-common: -r {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-common/test-requirements.txt @@ -182,6 +188,9 @@ commands = test-opentelemetry-proto-gen: pytest {toxinidir}/opentelemetry-proto/tests {posargs} lint-opentelemetry-proto-gen: pylint {toxinidir}/opentelemetry-proto + test-opentelemetry-protojson-gen: pytest {toxinidir}/opentelemetry-proto-json/tests {posargs} + lint-opentelemetry-protojson-gen: pylint {toxinidir}/opentelemetry-proto-json + test-opentelemetry-semantic-conventions: pytest {toxinidir}/opentelemetry-semantic-conventions/tests {posargs} lint-opentelemetry-semantic-conventions: pylint --rcfile {toxinidir}/opentelemetry-semantic-conventions/.pylintrc {toxinidir}/opentelemetry-semantic-conventions @@ -368,6 +377,7 @@ deps = -e {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-grpc -e {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-http -e {toxinidir}/opentelemetry-proto + -e {toxinidir}/opentelemetry-proto-json commands = pyright --version diff --git a/uv.lock b/uv.lock index 2f5c44e3611..571ea119134 100644 --- a/uv.lock +++ b/uv.lock @@ -11,6 +11,7 @@ resolution-markers = [ [manifest] members = [ "opentelemetry-api", + "opentelemetry-codegen-json", "opentelemetry-exporter-otlp", "opentelemetry-exporter-otlp-proto-common", "opentelemetry-exporter-otlp-proto-grpc", @@ -20,6 +21,7 @@ members = [ "opentelemetry-propagator-b3", "opentelemetry-propagator-jaeger", "opentelemetry-proto", + "opentelemetry-proto-json", "opentelemetry-python", "opentelemetry-sdk", "opentelemetry-semantic-conventions", @@ -901,6 +903,21 @@ requires-dist = [ { name = "typing-extensions", specifier = ">=4.5.0" }, ] +[[package]] +name = "opentelemetry-codegen-json" +source = { editable = "codegen/opentelemetry-codegen-json" } +dependencies = [ + { name = "protobuf" }, + { name = "types-protobuf", version = "6.32.1.20251210", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, + { name = "types-protobuf", version = "6.32.1.20260221", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, +] + +[package.metadata] +requires-dist = [ + { name = "protobuf", specifier = ">=4.25.3" }, + { name = "types-protobuf", specifier = ">=4.24" }, +] + [[package]] name = "opentelemetry-exporter-credential-provider-gcp" version = "0.60b0" @@ -1069,12 +1086,17 @@ dependencies = [ [package.metadata] requires-dist = [{ name = "protobuf", specifier = ">=5.0,<7.0" }] +[[package]] +name = "opentelemetry-proto-json" +source = { editable = "opentelemetry-proto-json" } + [[package]] name = "opentelemetry-python" version = "0.0.0" source = { virtual = "." } dependencies = [ { name = "opentelemetry-api" }, + { name = "opentelemetry-codegen-json" }, { name = "opentelemetry-exporter-otlp-proto-common" }, { name = "opentelemetry-exporter-otlp-proto-grpc" }, { name = "opentelemetry-exporter-otlp-proto-http" }, @@ -1083,6 +1105,7 @@ dependencies = [ { name = "opentelemetry-propagator-b3" }, { name = "opentelemetry-propagator-jaeger" }, { name = "opentelemetry-proto" }, + { name = "opentelemetry-proto-json" }, { name = "opentelemetry-sdk" }, { name = "opentelemetry-semantic-conventions" }, { name = "opentelemetry-test-utils" }, @@ -1103,6 +1126,7 @@ dev = [ [package.metadata] requires-dist = [ { name = "opentelemetry-api", editable = "opentelemetry-api" }, + { name = "opentelemetry-codegen-json", editable = "codegen/opentelemetry-codegen-json" }, { name = "opentelemetry-exporter-otlp-proto-common", editable = "exporter/opentelemetry-exporter-otlp-proto-common" }, { name = "opentelemetry-exporter-otlp-proto-grpc", editable = "exporter/opentelemetry-exporter-otlp-proto-grpc" }, { name = "opentelemetry-exporter-otlp-proto-http", editable = "exporter/opentelemetry-exporter-otlp-proto-http" }, @@ -1111,6 +1135,7 @@ requires-dist = [ { name = "opentelemetry-propagator-b3", editable = "propagator/opentelemetry-propagator-b3" }, { name = "opentelemetry-propagator-jaeger", editable = "propagator/opentelemetry-propagator-jaeger" }, { name = "opentelemetry-proto", editable = "opentelemetry-proto" }, + { name = "opentelemetry-proto-json", editable = "opentelemetry-proto-json" }, { name = "opentelemetry-sdk", editable = "opentelemetry-sdk" }, { name = "opentelemetry-semantic-conventions", editable = "opentelemetry-semantic-conventions" }, { name = "opentelemetry-test-utils", editable = "tests/opentelemetry-test-utils" }, @@ -2143,6 +2168,32 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/1b/a9/e3aee762739c1d7528da1c3e06d518503f8b6c439c35549b53735ba52ead/typeguard-4.4.4-py3-none-any.whl", hash = "sha256:b5f562281b6bfa1f5492470464730ef001646128b180769880468bd84b68b09e", size = 34874 }, ] +[[package]] +name = "types-protobuf" +version = "6.32.1.20251210" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.10'", +] +sdist = { url = "https://files.pythonhosted.org/packages/c2/59/c743a842911887cd96d56aa8936522b0cd5f7a7f228c96e81b59fced45be/types_protobuf-6.32.1.20251210.tar.gz", hash = "sha256:c698bb3f020274b1a2798ae09dc773728ce3f75209a35187bd11916ebfde6763", size = 63900, upload-time = "2025-12-10T03:14:25.451Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/aa/43/58e75bac4219cbafee83179505ff44cae3153ec279be0e30583a73b8f108/types_protobuf-6.32.1.20251210-py3-none-any.whl", hash = "sha256:2641f78f3696822a048cfb8d0ff42ccd85c25f12f871fbebe86da63793692140", size = 77921, upload-time = "2025-12-10T03:14:24.477Z" }, +] + +[[package]] +name = "types-protobuf" +version = "6.32.1.20260221" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.14'", + "python_full_version == '3.13.*'", + "python_full_version >= '3.10' and python_full_version < '3.13'", +] +sdist = { url = "https://files.pythonhosted.org/packages/5f/e2/9aa4a3b2469508bd7b4e2ae11cbedaf419222a09a1b94daffcd5efca4023/types_protobuf-6.32.1.20260221.tar.gz", hash = "sha256:6d5fb060a616bfb076cbb61b4b3c3969f5fc8bec5810f9a2f7e648ee5cbcbf6e", size = 64408, upload-time = "2026-02-21T03:55:13.916Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2e/e8/1fd38926f9cf031188fbc5a96694203ea6f24b0e34bd64a225ec6f6291ba/types_protobuf-6.32.1.20260221-py3-none-any.whl", hash = "sha256:da7cdd947975964a93c30bfbcc2c6841ee646b318d3816b033adc2c4eb6448e4", size = 77956, upload-time = "2026-02-21T03:55:12.894Z" }, +] + [[package]] name = "typing-extensions" version = "4.15.0" From 9eb2b8f10c661a04c6faaab61bdbf66f9a7c6914 Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Fri, 6 Mar 2026 23:16:13 -0500 Subject: [PATCH 04/15] add 'Private :: Do Not Upload' to codegen pyproject.toml classifiers --- codegen/opentelemetry-codegen-json/README.rst | 14 ++------------ codegen/opentelemetry-codegen-json/pyproject.toml | 3 ++- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/codegen/opentelemetry-codegen-json/README.rst b/codegen/opentelemetry-codegen-json/README.rst index 5d94521452f..76776a81dc9 100644 --- a/codegen/opentelemetry-codegen-json/README.rst +++ b/codegen/opentelemetry-codegen-json/README.rst @@ -1,21 +1,11 @@ OpenTelemetry JSON Code Generator ================================= -|pypi| - -.. |pypi| image:: https://badge.fury.io/py/opentelemetry-codegen-json.svg - :target: https://pypi.org/project/opentelemetry-codegen-json/ +.. note:: + This is an internal package and is not intended for publication to PyPI. This library is a protocol buffer plugin that generates code for the OpenTelemetry protocol in JSON format. -Installation ------------- - -:: - - pip install opentelemetry-codegen-json - - References ---------- diff --git a/codegen/opentelemetry-codegen-json/pyproject.toml b/codegen/opentelemetry-codegen-json/pyproject.toml index 1f59509ae69..627583e7ec3 100644 --- a/codegen/opentelemetry-codegen-json/pyproject.toml +++ b/codegen/opentelemetry-codegen-json/pyproject.toml @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Private :: Do Not Upload", ] dependencies = [ "protobuf>=4.25.3", @@ -34,7 +35,7 @@ dependencies = [ protoc-gen-otlp_json = "opentelemetry.codegen.json.plugin:main" [project.urls] -Homepage = "https://github.com/open-telemetry/opentelemetry-python/codegen/opentelemetry-codegen-proto-json" +Homepage = "https://github.com/open-telemetry/opentelemetry-python/tree/main/codegen/opentelemetry-codegen-json" Repository = "https://github.com/open-telemetry/opentelemetry-python" [tool.hatch.version] From e0017d2319a7db6f69e671fdafc9da73e3f31e97 Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Fri, 6 Mar 2026 23:46:49 -0500 Subject: [PATCH 05/15] add @json_serde decorator and update runtime utility file name --- .../opentelemetry/codegen/json/generator.py | 135 ++-- .../{otlp_json_utils.py => json_codec.py} | 27 + .../src/opentelemetry/codegen/json/writer.py | 2 +- .../tests/test_otlp_json_utils.py | 2 +- .../tests/test_writer.py | 2 +- .../{_otlp_json_utils.py => _json_codec.py} | 27 + .../collector/logs/v1/logs_service.py | 88 +-- .../collector/metrics/v1/metrics_service.py | 88 +-- .../v1development/profiles_service.py | 88 +-- .../collector/trace/v1/trace_service.py | 88 +-- .../proto_json/common/v1/common.py | 197 +----- .../opentelemetry/proto_json/logs/v1/logs.py | 149 +--- .../proto_json/metrics/v1/metrics.py | 657 +++++------------- .../profiles/v1development/profiles.py | 505 +++----------- .../proto_json/resource/v1/resource.py | 38 +- .../proto_json/trace/v1/trace.py | 274 ++------ 16 files changed, 551 insertions(+), 1816 deletions(-) rename codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/{otlp_json_utils.py => json_codec.py} (89%) rename opentelemetry-proto-json/src/opentelemetry/proto_json/{_otlp_json_utils.py => _json_codec.py} (89%) diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py index 6704e1dab45..52f63044a8b 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py @@ -37,7 +37,7 @@ _logger = logging.getLogger(__name__) -UTILS_MODULE_NAME: Final[str] = "_otlp_json_utils" +CODEC_MODULE_NAME: Final[str] = "_json_codec" class OtlpJsonGenerator: @@ -101,8 +101,8 @@ def generate_all(self) -> dict[str, str]: output_path = file_to_output[proto_file] self._generated_files[output_path] = code - utils_path = f"{self._common_root}/{UTILS_MODULE_NAME}.py" - self._generated_files[utils_path] = _load_utils_source() + codec_path = f"{self._common_root}/{CODEC_MODULE_NAME}.py" + self._generated_files[codec_path] = _load_codec_source() version_init_path = f"{self._common_root}/version/__init__.py" version_writer = CodeWriter(indent_size=4) @@ -184,17 +184,17 @@ def _ensure_init_files(self) -> None: if init_path not in self._generated_files: self._generated_files[init_path] = "" - def _get_utils_module_path(self) -> str: + def _get_codec_module_path(self) -> str: """ - Get the absolute module path for the utility module. + Get the absolute module path for the codec module. Returns: Absolute module path as a string """ return ( - f"{self._common_root.replace('/', '.')}.{UTILS_MODULE_NAME}" + f"{self._common_root.replace('/', '.')}.{CODEC_MODULE_NAME}" if self._common_root - else UTILS_MODULE_NAME + else CODEC_MODULE_NAME ) def _transform_proto_path(self, proto_path: str) -> str: @@ -346,7 +346,6 @@ def _generate_imports( "builtins", "dataclasses", "functools", - "json", "sys", "typing", ] @@ -358,6 +357,7 @@ def _generate_imports( writer.blank_line() + # TODO: Remove after dropping support for Python 3.9 with writer.if_("sys.version_info >= (3, 10)"): writer.assignment( "_dataclass", @@ -369,7 +369,7 @@ def _generate_imports( # Collect all imports needed imports = self._collect_imports(proto_file) - imports.add(f"import {self._get_utils_module_path()}") + imports.add(f"import {self._get_codec_module_path()}") # Generate cross file imports if imports: @@ -448,9 +448,13 @@ def _generate_message_class( current_path = ( f"{parent_path}.{msg_desc.name}" if parent_path else msg_desc.name ) + codec = self._get_codec_module_path() with writer.dataclass( msg_desc.name, - decorators=("typing.final",), + decorators=( + "typing.final", + f"{codec}.json_serde", + ), decorator_name="_dataclass", ): if msg_desc.field or msg_desc.nested_type or msg_desc.enum_type: @@ -479,13 +483,9 @@ def _generate_message_class( writer.blank_line() self._generate_to_dict(writer, msg_desc) writer.blank_line() - self._generate_to_json(writer) - writer.blank_line() self._generate_from_dict( writer, proto_file, msg_desc, current_path ) - writer.blank_line() - self._generate_from_json(writer, current_path) def _generate_enum_class( self, writer: CodeWriter, enum_desc: descriptor.EnumDescriptorProto @@ -598,24 +598,6 @@ def _generate_to_dict( writer.return_("_result") - def _generate_to_json(self, writer: CodeWriter) -> None: - """ - Generate a to_json() method that serializes the message to a JSON string. - - Args: - writer: Code writer instance - """ - with writer.method("to_json", ["self"], return_type="builtins.str"): - writer.docstring( - [ - "Serialize this message to a JSON string.", - "", - "Returns:", - " JSON string", - ] - ) - writer.return_("json.dumps(self.to_dict())") - def _generate_from_dict( self, writer: CodeWriter, @@ -649,9 +631,9 @@ def _generate_from_dict( f" {msg_desc.name} instance", ] ) - utils = self._get_utils_module_path() + codec = self._get_codec_module_path() writer.writeln( - f'{utils}.validate_type(data, builtins.dict, "data")' + f'{codec}.validate_type(data, builtins.dict, "data")' ) writer.assignment("_args", "{}") writer.blank_line() @@ -706,37 +688,6 @@ def _generate_from_dict( writer.blank_line() writer.return_("cls(**_args)") - def _generate_from_json( - self, - writer: CodeWriter, - current_path: str, - ) -> None: - """ - Generate a from_json() class method that creates an instance from a JSON string. - - Args: - writer: Code writer instance - current_path: Full class path for type hints and return type - """ - with writer.method( - "from_json", - ["cls", "data: typing.Union[builtins.str, builtins.bytes]"], - decorators=["builtins.classmethod"], - return_type=f'"{current_path}"', - ): - writer.docstring( - [ - "Deserialize from a JSON string or bytes.", - "", - "Args:", - " data: JSON string or bytes", - "", - "Returns:", - " Instance of the class", - ] - ) - writer.return_("cls.from_dict(json.loads(data))") - def _generate_serialization_statements( self, writer: CodeWriter, @@ -763,10 +714,10 @@ def _generate_serialization_statements( f'{target_dict}["{json_name}"]', f"self.{field_desc.name}" ) else: - utils = self._get_utils_module_path() + codec = self._get_codec_module_path() writer.assignment( f'{target_dict}["{json_name}"]', - f"{utils}.encode_repeated(self.{field_desc.name}, lambda _v: {item_expr})", + f"{codec}.encode_repeated(self.{field_desc.name}, lambda _v: {item_expr})", ) else: val_expr = self._get_serialization_expr( @@ -784,22 +735,22 @@ def _get_serialization_expr( field_desc: Field descriptor for the value being serialized var_name: Variable name representing the value to serialize """ - utils = self._get_utils_module_path() + codec = self._get_codec_module_path() if field_desc.type == descriptor.FieldDescriptorProto.TYPE_MESSAGE: return f"{var_name}.to_dict()" if field_desc.type == descriptor.FieldDescriptorProto.TYPE_ENUM: return f"builtins.int({var_name})" if is_hex_encoded_field(field_desc.name): - return f"{utils}.encode_hex({var_name})" + return f"{codec}.encode_hex({var_name})" if is_int64_type(field_desc.type): - return f"{utils}.encode_int64({var_name})" + return f"{codec}.encode_int64({var_name})" if is_bytes_type(field_desc.type): - return f"{utils}.encode_base64({var_name})" + return f"{codec}.encode_base64({var_name})" if field_desc.type in ( descriptor.FieldDescriptorProto.TYPE_FLOAT, descriptor.FieldDescriptorProto.TYPE_DOUBLE, ): - return f"{utils}.encode_float({var_name})" + return f"{codec}.encode_float({var_name})" return var_name @@ -821,14 +772,14 @@ def _generate_deserialization_statements( var_name: Variable name representing the JSON value to deserialize target_dict: Name of the dictionary variable to assign the deserialized value to """ - utils = self._get_utils_module_path() + codec = self._get_codec_module_path() if field_desc.label == descriptor.FieldDescriptorProto.LABEL_REPEATED: item_expr = self._get_deserialization_expr( proto_file, field_desc, "_v" ) writer.assignment( f'{target_dict}["{field_desc.name}"]', - f'{utils}.decode_repeated({var_name}, lambda _v: {item_expr}, "{field_desc.name}")', + f'{codec}.decode_repeated({var_name}, lambda _v: {item_expr}, "{field_desc.name}")', ) return @@ -845,7 +796,7 @@ def _generate_deserialization_statements( field_desc.type_name, proto_file ) writer.writeln( - f'{utils}.validate_type({var_name}, builtins.int, "{field_desc.name}")' + f'{codec}.validate_type({var_name}, builtins.int, "{field_desc.name}")' ) writer.assignment( f'{target_dict}["{field_desc.name}"]', @@ -854,17 +805,17 @@ def _generate_deserialization_statements( elif is_hex_encoded_field(field_desc.name): writer.assignment( f'{target_dict}["{field_desc.name}"]', - f'{utils}.decode_hex({var_name}, "{field_desc.name}")', + f'{codec}.decode_hex({var_name}, "{field_desc.name}")', ) elif is_int64_type(field_desc.type): writer.assignment( f'{target_dict}["{field_desc.name}"]', - f'{utils}.decode_int64({var_name}, "{field_desc.name}")', + f'{codec}.decode_int64({var_name}, "{field_desc.name}")', ) elif is_bytes_type(field_desc.type): writer.assignment( f'{target_dict}["{field_desc.name}"]', - f'{utils}.decode_base64({var_name}, "{field_desc.name}")', + f'{codec}.decode_base64({var_name}, "{field_desc.name}")', ) elif field_desc.type in ( descriptor.FieldDescriptorProto.TYPE_FLOAT, @@ -872,14 +823,14 @@ def _generate_deserialization_statements( ): writer.assignment( f'{target_dict}["{field_desc.name}"]', - f'{utils}.decode_float({var_name}, "{field_desc.name}")', + f'{codec}.decode_float({var_name}, "{field_desc.name}")', ) else: allowed_types = get_json_allowed_types( field_desc.type, field_desc.name ) writer.writeln( - f'{utils}.validate_type({var_name}, {allowed_types}, "{field_desc.name}")' + f'{codec}.validate_type({var_name}, {allowed_types}, "{field_desc.name}")' ) writer.assignment(f'{target_dict}["{field_desc.name}"]', var_name) @@ -900,7 +851,7 @@ def _get_deserialization_expr( Returns: Python expression string to perform deserialization """ - utils = self._get_utils_module_path() + codec = self._get_codec_module_path() if field_desc.type == descriptor.FieldDescriptorProto.TYPE_MESSAGE: msg_type = self._resolve_message_type( field_desc.type_name, proto_file @@ -912,16 +863,16 @@ def _get_deserialization_expr( ) return f"{enum_type}({var_name})" if is_hex_encoded_field(field_desc.name): - return f'{utils}.decode_hex({var_name}, "{field_desc.name}")' + return f'{codec}.decode_hex({var_name}, "{field_desc.name}")' if is_int64_type(field_desc.type): - return f'{utils}.decode_int64({var_name}, "{field_desc.name}")' + return f'{codec}.decode_int64({var_name}, "{field_desc.name}")' if is_bytes_type(field_desc.type): - return f'{utils}.decode_base64({var_name}, "{field_desc.name}")' + return f'{codec}.decode_base64({var_name}, "{field_desc.name}")' if field_desc.type in ( descriptor.FieldDescriptorProto.TYPE_FLOAT, descriptor.FieldDescriptorProto.TYPE_DOUBLE, ): - return f'{utils}.decode_float({var_name}, "{field_desc.name}")' + return f'{codec}.decode_float({var_name}, "{field_desc.name}")' return var_name @@ -1041,24 +992,24 @@ def _get_field_default( return get_default_value(field_desc.type) -def _load_utils_source() -> str: +def _load_codec_source() -> str: """ - Load the source code for the utility module from its source file. + Load the source code for the codec module from its source file. Returns: Source code as a string """ - utils_src_path = Path(__file__).parent / "runtime" / "otlp_json_utils.py" + codec_src_path = Path(__file__).parent / "runtime" / "json_codec.py" try: - return utils_src_path.read_text(encoding="utf-8") + return codec_src_path.read_text(encoding="utf-8") except Exception as e: _logger.error( - "Failed to load utility module source from %s: %s", - utils_src_path, + "Failed to load codec module source from %s: %s", + codec_src_path, e, ) raise RuntimeError( - f"Failed to load utility module source from {utils_src_path}" + f"Failed to load codec module source from {codec_src_path}" ) from e diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/otlp_json_utils.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py similarity index 89% rename from codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/otlp_json_utils.py rename to codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py index baae4901fe7..beb7540904d 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/otlp_json_utils.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py @@ -15,12 +15,39 @@ from __future__ import annotations import base64 +import json import math import typing T = typing.TypeVar("T") +def json_serde(cls: type[T]) -> type[T]: + """ + A decorator that adds "to_json" and "from_json" methods to a class. + The class must already have to_dict and from_dict methods. + """ + + def to_json(self: typing.Any) -> str: + """ + Serialize this message to a JSON string. + """ + return json.dumps(self.to_dict()) + + @classmethod + def from_json( + cls_inner: type[T], data: typing.Union[str, bytes] + ) -> T: + """ + Deserialize from a JSON string or bytes. + """ + return cls_inner.from_dict(json.loads(data)) + + cls.to_json = to_json # type: ignore[attr-defined] + cls.from_json = from_json # type: ignore[attr-defined] + return cls + + def encode_hex(value: bytes) -> str: """ Encode bytes as hex string. diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py index 337fd0edc52..1c626d567df 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py @@ -123,7 +123,7 @@ def import_(self, module: str, *items: str) -> CodeWriter: return self @contextmanager - def suite(self, header: str) -> Generator[CodeWriter, None, None]: + def block(self, header: str) -> Generator[CodeWriter, None, None]: """ Create a generic code block with a header (e.g. if, for, while, try, etc.) diff --git a/codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py b/codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py index 51c1aee6d8f..b539752977e 100644 --- a/codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py +++ b/codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py @@ -17,7 +17,7 @@ import pytest -from opentelemetry.codegen.json.runtime.otlp_json_utils import ( +from opentelemetry.codegen.json.runtime.json_codec import ( decode_base64, decode_float, decode_hex, diff --git a/codegen/opentelemetry-codegen-json/tests/test_writer.py b/codegen/opentelemetry-codegen-json/tests/test_writer.py index 647b6efce8e..196a33b8ef0 100644 --- a/codegen/opentelemetry-codegen-json/tests/test_writer.py +++ b/codegen/opentelemetry-codegen-json/tests/test_writer.py @@ -85,7 +85,7 @@ def test_import(module: str, items: list[str], expected: list[str]) -> None: def test_suite() -> None: writer = CodeWriter() - with writer.suite("def foo():"): + with writer.block("def foo():"): writer.writeln("pass") assert writer.to_lines() == ["def foo():", " pass"] diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/_otlp_json_utils.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py similarity index 89% rename from opentelemetry-proto-json/src/opentelemetry/proto_json/_otlp_json_utils.py rename to opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py index baae4901fe7..beb7540904d 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/_otlp_json_utils.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py @@ -15,12 +15,39 @@ from __future__ import annotations import base64 +import json import math import typing T = typing.TypeVar("T") +def json_serde(cls: type[T]) -> type[T]: + """ + A decorator that adds "to_json" and "from_json" methods to a class. + The class must already have to_dict and from_dict methods. + """ + + def to_json(self: typing.Any) -> str: + """ + Serialize this message to a JSON string. + """ + return json.dumps(self.to_dict()) + + @classmethod + def from_json( + cls_inner: type[T], data: typing.Union[str, bytes] + ) -> T: + """ + Deserialize from a JSON string or bytes. + """ + return cls_inner.from_dict(json.loads(data)) + + cls.to_json = to_json # type: ignore[attr-defined] + cls.from_json = from_json # type: ignore[attr-defined] + return cls + + def encode_hex(value: bytes) -> str: """ Encode bytes as hex string. diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py index 8002a77ba58..c4118b8d9ee 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py @@ -20,7 +20,6 @@ import builtins import dataclasses import functools -import json import sys import typing @@ -29,11 +28,12 @@ else: _dataclass = dataclasses.dataclass -import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json._json_codec import opentelemetry.proto_json.logs.v1.logs @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportLogsServiceRequest: """ @@ -51,18 +51,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.resource_logs: - _result["resourceLogs"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_logs, lambda _v: _v.to_dict()) + _result["resourceLogs"] = opentelemetry.proto_json._json_codec.encode_repeated(self.resource_logs, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogsServiceRequest": """ @@ -74,29 +65,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogs Returns: ExportLogsServiceRequest instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resourceLogs")) is not None: - _args["resource_logs"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.logs.v1.logs.ResourceLogs.from_dict(_v), "resource_logs") + _args["resource_logs"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.logs.v1.logs.ResourceLogs.from_dict(_v), "resource_logs") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportLogsServiceRequest": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportLogsServiceResponse: """ @@ -117,15 +96,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["partialSuccess"] = self.partial_success.to_dict() return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogsServiceResponse": """ @@ -137,7 +107,7 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogs Returns: ExportLogsServiceResponse instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("partialSuccess")) is not None: @@ -145,21 +115,9 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogs return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportLogsServiceResponse": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportLogsPartialSuccess: """ @@ -178,20 +136,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.rejected_log_records: - _result["rejectedLogRecords"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.rejected_log_records) + _result["rejectedLogRecords"] = opentelemetry.proto_json._json_codec.encode_int64(self.rejected_log_records) if self.error_message: _result["errorMessage"] = self.error_message return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogsPartialSuccess": """ @@ -203,26 +152,13 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogs Returns: ExportLogsPartialSuccess instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("rejectedLogRecords")) is not None: - _args["rejected_log_records"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "rejected_log_records") + _args["rejected_log_records"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "rejected_log_records") if (_value := data.get("errorMessage")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "error_message") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "error_message") _args["error_message"] = _value return cls(**_args) - - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportLogsPartialSuccess": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py index 150d28b8d39..5efc0797511 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py @@ -20,7 +20,6 @@ import builtins import dataclasses import functools -import json import sys import typing @@ -29,11 +28,12 @@ else: _dataclass = dataclasses.dataclass -import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json._json_codec import opentelemetry.proto_json.metrics.v1.metrics @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportMetricsServiceRequest: """ @@ -51,18 +51,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.resource_metrics: - _result["resourceMetrics"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_metrics, lambda _v: _v.to_dict()) + _result["resourceMetrics"] = opentelemetry.proto_json._json_codec.encode_repeated(self.resource_metrics, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetricsServiceRequest": """ @@ -74,29 +65,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetr Returns: ExportMetricsServiceRequest instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resourceMetrics")) is not None: - _args["resource_metrics"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.metrics.v1.metrics.ResourceMetrics.from_dict(_v), "resource_metrics") + _args["resource_metrics"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.metrics.v1.metrics.ResourceMetrics.from_dict(_v), "resource_metrics") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportMetricsServiceRequest": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportMetricsServiceResponse: """ @@ -117,15 +96,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["partialSuccess"] = self.partial_success.to_dict() return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetricsServiceResponse": """ @@ -137,7 +107,7 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetr Returns: ExportMetricsServiceResponse instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("partialSuccess")) is not None: @@ -145,21 +115,9 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetr return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportMetricsServiceResponse": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportMetricsPartialSuccess: """ @@ -178,20 +136,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.rejected_data_points: - _result["rejectedDataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.rejected_data_points) + _result["rejectedDataPoints"] = opentelemetry.proto_json._json_codec.encode_int64(self.rejected_data_points) if self.error_message: _result["errorMessage"] = self.error_message return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetricsPartialSuccess": """ @@ -203,26 +152,13 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetr Returns: ExportMetricsPartialSuccess instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("rejectedDataPoints")) is not None: - _args["rejected_data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "rejected_data_points") + _args["rejected_data_points"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "rejected_data_points") if (_value := data.get("errorMessage")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "error_message") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "error_message") _args["error_message"] = _value return cls(**_args) - - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportMetricsPartialSuccess": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py index 4c6cf119246..fab5a32c4b4 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py @@ -20,7 +20,6 @@ import builtins import dataclasses import functools -import json import sys import typing @@ -29,11 +28,12 @@ else: _dataclass = dataclasses.dataclass -import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json._json_codec import opentelemetry.proto_json.profiles.v1development.profiles @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportProfilesServiceRequest: """ @@ -52,20 +52,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.resource_profiles: - _result["resourceProfiles"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_profiles, lambda _v: _v.to_dict()) + _result["resourceProfiles"] = opentelemetry.proto_json._json_codec.encode_repeated(self.resource_profiles, lambda _v: _v.to_dict()) if self.dictionary: _result["dictionary"] = self.dictionary.to_dict() return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProfilesServiceRequest": """ @@ -77,31 +68,19 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProf Returns: ExportProfilesServiceRequest instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resourceProfiles")) is not None: - _args["resource_profiles"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.profiles.v1development.profiles.ResourceProfiles.from_dict(_v), "resource_profiles") + _args["resource_profiles"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.profiles.v1development.profiles.ResourceProfiles.from_dict(_v), "resource_profiles") if (_value := data.get("dictionary")) is not None: _args["dictionary"] = opentelemetry.proto_json.profiles.v1development.profiles.ProfilesDictionary.from_dict(_value) return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportProfilesServiceRequest": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportProfilesServiceResponse: """ @@ -122,15 +101,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["partialSuccess"] = self.partial_success.to_dict() return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProfilesServiceResponse": """ @@ -142,7 +112,7 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProf Returns: ExportProfilesServiceResponse instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("partialSuccess")) is not None: @@ -150,21 +120,9 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProf return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportProfilesServiceResponse": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportProfilesPartialSuccess: """ @@ -183,20 +141,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.rejected_profiles: - _result["rejectedProfiles"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.rejected_profiles) + _result["rejectedProfiles"] = opentelemetry.proto_json._json_codec.encode_int64(self.rejected_profiles) if self.error_message: _result["errorMessage"] = self.error_message return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProfilesPartialSuccess": """ @@ -208,26 +157,13 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProf Returns: ExportProfilesPartialSuccess instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("rejectedProfiles")) is not None: - _args["rejected_profiles"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "rejected_profiles") + _args["rejected_profiles"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "rejected_profiles") if (_value := data.get("errorMessage")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "error_message") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "error_message") _args["error_message"] = _value return cls(**_args) - - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportProfilesPartialSuccess": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py index 75b2b83f25d..6db2fcb3203 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py @@ -20,7 +20,6 @@ import builtins import dataclasses import functools -import json import sys import typing @@ -29,11 +28,12 @@ else: _dataclass = dataclasses.dataclass -import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json._json_codec import opentelemetry.proto_json.trace.v1.trace @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportTraceServiceRequest: """ @@ -51,18 +51,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.resource_spans: - _result["resourceSpans"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_spans, lambda _v: _v.to_dict()) + _result["resourceSpans"] = opentelemetry.proto_json._json_codec.encode_repeated(self.resource_spans, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTraceServiceRequest": """ @@ -74,29 +65,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTrac Returns: ExportTraceServiceRequest instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resourceSpans")) is not None: - _args["resource_spans"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.trace.v1.trace.ResourceSpans.from_dict(_v), "resource_spans") + _args["resource_spans"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.trace.v1.trace.ResourceSpans.from_dict(_v), "resource_spans") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportTraceServiceRequest": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportTraceServiceResponse: """ @@ -117,15 +96,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["partialSuccess"] = self.partial_success.to_dict() return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTraceServiceResponse": """ @@ -137,7 +107,7 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTrac Returns: ExportTraceServiceResponse instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("partialSuccess")) is not None: @@ -145,21 +115,9 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTrac return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportTraceServiceResponse": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExportTracePartialSuccess: """ @@ -178,20 +136,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.rejected_spans: - _result["rejectedSpans"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.rejected_spans) + _result["rejectedSpans"] = opentelemetry.proto_json._json_codec.encode_int64(self.rejected_spans) if self.error_message: _result["errorMessage"] = self.error_message return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTracePartialSuccess": """ @@ -203,26 +152,13 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTrac Returns: ExportTracePartialSuccess instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("rejectedSpans")) is not None: - _args["rejected_spans"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "rejected_spans") + _args["rejected_spans"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "rejected_spans") if (_value := data.get("errorMessage")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "error_message") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "error_message") _args["error_message"] = _value return cls(**_args) - - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExportTracePartialSuccess": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py index f0c482f407d..880a93343c3 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py @@ -20,7 +20,6 @@ import builtins import dataclasses import functools -import json import sys import typing @@ -29,10 +28,11 @@ else: _dataclass = dataclasses.dataclass -import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json._json_codec @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class AnyValue: """ @@ -56,30 +56,21 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.bytes_value is not None: - _result["bytesValue"] = opentelemetry.proto_json._otlp_json_utils.encode_base64(self.bytes_value) + _result["bytesValue"] = opentelemetry.proto_json._json_codec.encode_base64(self.bytes_value) elif self.kvlist_value is not None: _result["kvlistValue"] = self.kvlist_value.to_dict() elif self.array_value is not None: _result["arrayValue"] = self.array_value.to_dict() elif self.double_value is not None: - _result["doubleValue"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.double_value) + _result["doubleValue"] = opentelemetry.proto_json._json_codec.encode_float(self.double_value) elif self.int_value is not None: - _result["intValue"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.int_value) + _result["intValue"] = opentelemetry.proto_json._json_codec.encode_int64(self.int_value) elif self.bool_value is not None: _result["boolValue"] = self.bool_value elif self.string_value is not None: _result["stringValue"] = self.string_value return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "AnyValue": """ @@ -91,43 +82,31 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "AnyValue": Returns: AnyValue instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("bytesValue")) is not None: - _args["bytes_value"] = opentelemetry.proto_json._otlp_json_utils.decode_base64(_value, "bytes_value") + _args["bytes_value"] = opentelemetry.proto_json._json_codec.decode_base64(_value, "bytes_value") elif (_value := data.get("kvlistValue")) is not None: _args["kvlist_value"] = KeyValueList.from_dict(_value) elif (_value := data.get("arrayValue")) is not None: _args["array_value"] = ArrayValue.from_dict(_value) elif (_value := data.get("doubleValue")) is not None: - _args["double_value"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "double_value") + _args["double_value"] = opentelemetry.proto_json._json_codec.decode_float(_value, "double_value") elif (_value := data.get("intValue")) is not None: - _args["int_value"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "int_value") + _args["int_value"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "int_value") elif (_value := data.get("boolValue")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.bool, "bool_value") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.bool, "bool_value") _args["bool_value"] = _value elif (_value := data.get("stringValue")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "string_value") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "string_value") _args["string_value"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "AnyValue": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ArrayValue: """ @@ -145,18 +124,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.values: - _result["values"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.values, lambda _v: _v.to_dict()) + _result["values"] = opentelemetry.proto_json._json_codec.encode_repeated(self.values, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ArrayValue": """ @@ -168,29 +138,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ArrayValue Returns: ArrayValue instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("values")) is not None: - _args["values"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: AnyValue.from_dict(_v), "values") + _args["values"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: AnyValue.from_dict(_v), "values") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ArrayValue": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class KeyValueList: """ @@ -208,18 +166,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.values: - _result["values"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.values, lambda _v: _v.to_dict()) + _result["values"] = opentelemetry.proto_json._json_codec.encode_repeated(self.values, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValueList": """ @@ -231,29 +180,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValueLi Returns: KeyValueList instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("values")) is not None: - _args["values"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: KeyValue.from_dict(_v), "values") + _args["values"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: KeyValue.from_dict(_v), "values") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "KeyValueList": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class KeyValue: """ @@ -277,15 +214,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["value"] = self.value.to_dict() return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValue": """ @@ -297,32 +225,20 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValue": Returns: KeyValue instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("key")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "key") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "key") _args["key"] = _value if (_value := data.get("value")) is not None: _args["value"] = AnyValue.from_dict(_value) return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "KeyValue": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class InstrumentationScope: """ @@ -347,20 +263,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.version: _result["version"] = self.version if self.attributes: - _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + _result["attributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attributes, lambda _v: _v.to_dict()) if self.dropped_attributes_count: _result["droppedAttributesCount"] = self.dropped_attributes_count return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "InstrumentationScope": """ @@ -372,38 +279,26 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Instrument Returns: InstrumentationScope instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("name")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "name") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "name") _args["name"] = _value if (_value := data.get("version")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "version") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "version") _args["version"] = _value if (_value := data.get("attributes")) is not None: - _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: KeyValue.from_dict(_v), "attributes") + _args["attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: KeyValue.from_dict(_v), "attributes") if (_value := data.get("droppedAttributesCount")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "dropped_attributes_count") _args["dropped_attributes_count"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "InstrumentationScope": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class EntityRef: """ @@ -433,15 +328,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["descriptionKeys"] = self.description_keys return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "EntityRef": """ @@ -453,31 +339,18 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "EntityRef" Returns: EntityRef instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("schemaUrl")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "schema_url") _args["schema_url"] = _value if (_value := data.get("type")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "type") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "type") _args["type"] = _value if (_value := data.get("idKeys")) is not None: - _args["id_keys"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "id_keys") + _args["id_keys"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: _v, "id_keys") if (_value := data.get("descriptionKeys")) is not None: - _args["description_keys"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "description_keys") + _args["description_keys"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: _v, "description_keys") return cls(**_args) - - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "EntityRef": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py index 855c280328b..85be190ec13 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py @@ -21,7 +21,6 @@ import dataclasses import enum import functools -import json import sys import typing @@ -30,7 +29,7 @@ else: _dataclass = dataclasses.dataclass -import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json._json_codec import opentelemetry.proto_json.common.v1.common import opentelemetry.proto_json.resource.v1.resource @@ -77,6 +76,7 @@ class LogRecordFlags(enum.IntEnum): LOG_RECORD_FLAGS_TRACE_FLAGS_MASK = 255 @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class LogsData: """ @@ -94,18 +94,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.resource_logs: - _result["resourceLogs"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_logs, lambda _v: _v.to_dict()) + _result["resourceLogs"] = opentelemetry.proto_json._json_codec.encode_repeated(self.resource_logs, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "LogsData": """ @@ -117,29 +108,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "LogsData": Returns: LogsData instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resourceLogs")) is not None: - _args["resource_logs"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ResourceLogs.from_dict(_v), "resource_logs") + _args["resource_logs"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: ResourceLogs.from_dict(_v), "resource_logs") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "LogsData": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ResourceLogs: """ @@ -161,20 +140,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.resource: _result["resource"] = self.resource.to_dict() if self.scope_logs: - _result["scopeLogs"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.scope_logs, lambda _v: _v.to_dict()) + _result["scopeLogs"] = opentelemetry.proto_json._json_codec.encode_repeated(self.scope_logs, lambda _v: _v.to_dict()) if self.schema_url: _result["schemaUrl"] = self.schema_url return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceLogs": """ @@ -186,34 +156,22 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceLo Returns: ResourceLogs instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resource")) is not None: _args["resource"] = opentelemetry.proto_json.resource.v1.resource.Resource.from_dict(_value) if (_value := data.get("scopeLogs")) is not None: - _args["scope_logs"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ScopeLogs.from_dict(_v), "scope_logs") + _args["scope_logs"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: ScopeLogs.from_dict(_v), "scope_logs") if (_value := data.get("schemaUrl")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "schema_url") _args["schema_url"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ResourceLogs": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ScopeLogs: """ @@ -235,20 +193,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.scope: _result["scope"] = self.scope.to_dict() if self.log_records: - _result["logRecords"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.log_records, lambda _v: _v.to_dict()) + _result["logRecords"] = opentelemetry.proto_json._json_codec.encode_repeated(self.log_records, lambda _v: _v.to_dict()) if self.schema_url: _result["schemaUrl"] = self.schema_url return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeLogs": """ @@ -260,34 +209,22 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeLogs" Returns: ScopeLogs instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("scope")) is not None: _args["scope"] = opentelemetry.proto_json.common.v1.common.InstrumentationScope.from_dict(_value) if (_value := data.get("logRecords")) is not None: - _args["log_records"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: LogRecord.from_dict(_v), "log_records") + _args["log_records"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: LogRecord.from_dict(_v), "log_records") if (_value := data.get("schemaUrl")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "schema_url") _args["schema_url"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ScopeLogs": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class LogRecord: """ @@ -315,9 +252,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.time_unix_nano: - _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + _result["timeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.time_unix_nano) if self.observed_time_unix_nano: - _result["observedTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.observed_time_unix_nano) + _result["observedTimeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.observed_time_unix_nano) if self.severity_number: _result["severityNumber"] = builtins.int(self.severity_number) if self.severity_text: @@ -325,28 +262,19 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.body: _result["body"] = self.body.to_dict() if self.attributes: - _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + _result["attributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attributes, lambda _v: _v.to_dict()) if self.dropped_attributes_count: _result["droppedAttributesCount"] = self.dropped_attributes_count if self.flags: _result["flags"] = self.flags if self.trace_id: - _result["traceId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.trace_id) + _result["traceId"] = opentelemetry.proto_json._json_codec.encode_hex(self.trace_id) if self.span_id: - _result["spanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.span_id) + _result["spanId"] = opentelemetry.proto_json._json_codec.encode_hex(self.span_id) if self.event_name: _result["eventName"] = self.event_name return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "LogRecord": """ @@ -358,48 +286,35 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "LogRecord" Returns: LogRecord instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("timeUnixNano")) is not None: - _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + _args["time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "time_unix_nano") if (_value := data.get("observedTimeUnixNano")) is not None: - _args["observed_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "observed_time_unix_nano") + _args["observed_time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "observed_time_unix_nano") if (_value := data.get("severityNumber")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "severity_number") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "severity_number") _args["severity_number"] = SeverityNumber(_value) if (_value := data.get("severityText")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "severity_text") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "severity_text") _args["severity_text"] = _value if (_value := data.get("body")) is not None: _args["body"] = opentelemetry.proto_json.common.v1.common.AnyValue.from_dict(_value) if (_value := data.get("attributes")) is not None: - _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + _args["attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") if (_value := data.get("droppedAttributesCount")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "dropped_attributes_count") _args["dropped_attributes_count"] = _value if (_value := data.get("flags")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "flags") _args["flags"] = _value if (_value := data.get("traceId")) is not None: - _args["trace_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "trace_id") + _args["trace_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "trace_id") if (_value := data.get("spanId")) is not None: - _args["span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "span_id") + _args["span_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "span_id") if (_value := data.get("eventName")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "event_name") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "event_name") _args["event_name"] = _value return cls(**_args) - - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "LogRecord": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py index 81f8489907d..ceb02129f07 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py @@ -21,7 +21,6 @@ import dataclasses import enum import functools -import json import sys import typing @@ -30,7 +29,7 @@ else: _dataclass = dataclasses.dataclass -import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json._json_codec import opentelemetry.proto_json.common.v1.common import opentelemetry.proto_json.resource.v1.resource @@ -55,6 +54,7 @@ class DataPointFlags(enum.IntEnum): DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK = 1 @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class MetricsData: """ @@ -72,18 +72,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.resource_metrics: - _result["resourceMetrics"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_metrics, lambda _v: _v.to_dict()) + _result["resourceMetrics"] = opentelemetry.proto_json._json_codec.encode_repeated(self.resource_metrics, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "MetricsData": """ @@ -95,29 +86,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "MetricsDat Returns: MetricsData instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resourceMetrics")) is not None: - _args["resource_metrics"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ResourceMetrics.from_dict(_v), "resource_metrics") + _args["resource_metrics"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: ResourceMetrics.from_dict(_v), "resource_metrics") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "MetricsData": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ResourceMetrics: """ @@ -139,20 +118,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.resource: _result["resource"] = self.resource.to_dict() if self.scope_metrics: - _result["scopeMetrics"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.scope_metrics, lambda _v: _v.to_dict()) + _result["scopeMetrics"] = opentelemetry.proto_json._json_codec.encode_repeated(self.scope_metrics, lambda _v: _v.to_dict()) if self.schema_url: _result["schemaUrl"] = self.schema_url return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceMetrics": """ @@ -164,34 +134,22 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceMe Returns: ResourceMetrics instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resource")) is not None: _args["resource"] = opentelemetry.proto_json.resource.v1.resource.Resource.from_dict(_value) if (_value := data.get("scopeMetrics")) is not None: - _args["scope_metrics"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ScopeMetrics.from_dict(_v), "scope_metrics") + _args["scope_metrics"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: ScopeMetrics.from_dict(_v), "scope_metrics") if (_value := data.get("schemaUrl")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "schema_url") _args["schema_url"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ResourceMetrics": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ScopeMetrics: """ @@ -213,20 +171,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.scope: _result["scope"] = self.scope.to_dict() if self.metrics: - _result["metrics"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.metrics, lambda _v: _v.to_dict()) + _result["metrics"] = opentelemetry.proto_json._json_codec.encode_repeated(self.metrics, lambda _v: _v.to_dict()) if self.schema_url: _result["schemaUrl"] = self.schema_url return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeMetrics": """ @@ -238,34 +187,22 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeMetri Returns: ScopeMetrics instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("scope")) is not None: _args["scope"] = opentelemetry.proto_json.common.v1.common.InstrumentationScope.from_dict(_value) if (_value := data.get("metrics")) is not None: - _args["metrics"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Metric.from_dict(_v), "metrics") + _args["metrics"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Metric.from_dict(_v), "metrics") if (_value := data.get("schemaUrl")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "schema_url") _args["schema_url"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ScopeMetrics": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Metric: """ @@ -297,7 +234,7 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.unit: _result["unit"] = self.unit if self.metadata: - _result["metadata"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.metadata, lambda _v: _v.to_dict()) + _result["metadata"] = opentelemetry.proto_json._json_codec.encode_repeated(self.metadata, lambda _v: _v.to_dict()) if self.summary is not None: _result["summary"] = self.summary.to_dict() elif self.exponential_histogram is not None: @@ -310,15 +247,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["gauge"] = self.gauge.to_dict() return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Metric": """ @@ -330,20 +258,20 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Metric": Returns: Metric instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("name")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "name") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "name") _args["name"] = _value if (_value := data.get("description")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "description") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "description") _args["description"] = _value if (_value := data.get("unit")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "unit") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "unit") _args["unit"] = _value if (_value := data.get("metadata")) is not None: - _args["metadata"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "metadata") + _args["metadata"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "metadata") if (_value := data.get("summary")) is not None: _args["summary"] = Summary.from_dict(_value) elif (_value := data.get("exponentialHistogram")) is not None: @@ -357,21 +285,9 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Metric": return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Metric": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Gauge: """ @@ -389,18 +305,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.data_points: - _result["dataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.data_points, lambda _v: _v.to_dict()) + _result["dataPoints"] = opentelemetry.proto_json._json_codec.encode_repeated(self.data_points, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Gauge": """ @@ -412,29 +319,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Gauge": Returns: Gauge instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("dataPoints")) is not None: - _args["data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: NumberDataPoint.from_dict(_v), "data_points") + _args["data_points"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: NumberDataPoint.from_dict(_v), "data_points") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Gauge": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Sum: """ @@ -454,22 +349,13 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.data_points: - _result["dataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.data_points, lambda _v: _v.to_dict()) + _result["dataPoints"] = opentelemetry.proto_json._json_codec.encode_repeated(self.data_points, lambda _v: _v.to_dict()) if self.aggregation_temporality: _result["aggregationTemporality"] = builtins.int(self.aggregation_temporality) if self.is_monotonic: _result["isMonotonic"] = self.is_monotonic return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Sum": """ @@ -481,35 +367,23 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Sum": Returns: Sum instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("dataPoints")) is not None: - _args["data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: NumberDataPoint.from_dict(_v), "data_points") + _args["data_points"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: NumberDataPoint.from_dict(_v), "data_points") if (_value := data.get("aggregationTemporality")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "aggregation_temporality") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "aggregation_temporality") _args["aggregation_temporality"] = AggregationTemporality(_value) if (_value := data.get("isMonotonic")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.bool, "is_monotonic") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.bool, "is_monotonic") _args["is_monotonic"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Sum": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Histogram: """ @@ -528,20 +402,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.data_points: - _result["dataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.data_points, lambda _v: _v.to_dict()) + _result["dataPoints"] = opentelemetry.proto_json._json_codec.encode_repeated(self.data_points, lambda _v: _v.to_dict()) if self.aggregation_temporality: _result["aggregationTemporality"] = builtins.int(self.aggregation_temporality) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Histogram": """ @@ -553,32 +418,20 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Histogram" Returns: Histogram instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("dataPoints")) is not None: - _args["data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: HistogramDataPoint.from_dict(_v), "data_points") + _args["data_points"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: HistogramDataPoint.from_dict(_v), "data_points") if (_value := data.get("aggregationTemporality")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "aggregation_temporality") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "aggregation_temporality") _args["aggregation_temporality"] = AggregationTemporality(_value) return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Histogram": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExponentialHistogram: """ @@ -597,20 +450,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.data_points: - _result["dataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.data_points, lambda _v: _v.to_dict()) + _result["dataPoints"] = opentelemetry.proto_json._json_codec.encode_repeated(self.data_points, lambda _v: _v.to_dict()) if self.aggregation_temporality: _result["aggregationTemporality"] = builtins.int(self.aggregation_temporality) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExponentialHistogram": """ @@ -622,32 +466,20 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Exponentia Returns: ExponentialHistogram instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("dataPoints")) is not None: - _args["data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ExponentialHistogramDataPoint.from_dict(_v), "data_points") + _args["data_points"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: ExponentialHistogramDataPoint.from_dict(_v), "data_points") if (_value := data.get("aggregationTemporality")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "aggregation_temporality") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "aggregation_temporality") _args["aggregation_temporality"] = AggregationTemporality(_value) return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExponentialHistogram": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Summary: """ @@ -665,18 +497,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.data_points: - _result["dataPoints"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.data_points, lambda _v: _v.to_dict()) + _result["dataPoints"] = opentelemetry.proto_json._json_codec.encode_repeated(self.data_points, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Summary": """ @@ -688,29 +511,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Summary": Returns: Summary instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("dataPoints")) is not None: - _args["data_points"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: SummaryDataPoint.from_dict(_v), "data_points") + _args["data_points"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: SummaryDataPoint.from_dict(_v), "data_points") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Summary": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class NumberDataPoint: """ @@ -734,30 +545,21 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.attributes: - _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + _result["attributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attributes, lambda _v: _v.to_dict()) if self.start_time_unix_nano: - _result["startTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_time_unix_nano) + _result["startTimeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.start_time_unix_nano) if self.time_unix_nano: - _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + _result["timeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.time_unix_nano) if self.exemplars: - _result["exemplars"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.exemplars, lambda _v: _v.to_dict()) + _result["exemplars"] = opentelemetry.proto_json._json_codec.encode_repeated(self.exemplars, lambda _v: _v.to_dict()) if self.flags: _result["flags"] = self.flags if self.as_int is not None: - _result["asInt"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.as_int) + _result["asInt"] = opentelemetry.proto_json._json_codec.encode_int64(self.as_int) elif self.as_double is not None: - _result["asDouble"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.as_double) + _result["asDouble"] = opentelemetry.proto_json._json_codec.encode_float(self.as_double) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "NumberDataPoint": """ @@ -769,42 +571,30 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "NumberData Returns: NumberDataPoint instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("attributes")) is not None: - _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + _args["attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") if (_value := data.get("startTimeUnixNano")) is not None: - _args["start_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_time_unix_nano") + _args["start_time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "start_time_unix_nano") if (_value := data.get("timeUnixNano")) is not None: - _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + _args["time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "time_unix_nano") if (_value := data.get("exemplars")) is not None: - _args["exemplars"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Exemplar.from_dict(_v), "exemplars") + _args["exemplars"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Exemplar.from_dict(_v), "exemplars") if (_value := data.get("flags")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "flags") _args["flags"] = _value if (_value := data.get("asInt")) is not None: - _args["as_int"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "as_int") + _args["as_int"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "as_int") elif (_value := data.get("asDouble")) is not None: - _args["as_double"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "as_double") + _args["as_double"] = opentelemetry.proto_json._json_codec.decode_float(_value, "as_double") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "NumberDataPoint": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class HistogramDataPoint: """ @@ -815,13 +605,13 @@ class HistogramDataPoint: start_time_unix_nano: typing.Optional[builtins.int] = 0 time_unix_nano: typing.Optional[builtins.int] = 0 count: typing.Optional[builtins.int] = 0 - sum: typing.Optional[builtins.float] = 0.0 + sum: typing.Optional[builtins.float] = None bucket_counts: builtins.list[builtins.int] = dataclasses.field(default_factory=builtins.list) explicit_bounds: builtins.list[builtins.float] = dataclasses.field(default_factory=builtins.list) exemplars: builtins.list[Exemplar] = dataclasses.field(default_factory=builtins.list) flags: typing.Optional[builtins.int] = 0 - min: typing.Optional[builtins.float] = 0.0 - max: typing.Optional[builtins.float] = 0.0 + min: typing.Optional[builtins.float] = None + max: typing.Optional[builtins.float] = None def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ @@ -832,38 +622,29 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.attributes: - _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + _result["attributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attributes, lambda _v: _v.to_dict()) if self.start_time_unix_nano: - _result["startTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_time_unix_nano) + _result["startTimeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.start_time_unix_nano) if self.time_unix_nano: - _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + _result["timeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.time_unix_nano) if self.count: - _result["count"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.count) - if self.sum: - _result["sum"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.sum) + _result["count"] = opentelemetry.proto_json._json_codec.encode_int64(self.count) + if self.sum is not None: + _result["sum"] = opentelemetry.proto_json._json_codec.encode_float(self.sum) if self.bucket_counts: - _result["bucketCounts"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.bucket_counts, lambda _v: opentelemetry.proto_json._otlp_json_utils.encode_int64(_v)) + _result["bucketCounts"] = opentelemetry.proto_json._json_codec.encode_repeated(self.bucket_counts, lambda _v: opentelemetry.proto_json._json_codec.encode_int64(_v)) if self.explicit_bounds: - _result["explicitBounds"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.explicit_bounds, lambda _v: opentelemetry.proto_json._otlp_json_utils.encode_float(_v)) + _result["explicitBounds"] = opentelemetry.proto_json._json_codec.encode_repeated(self.explicit_bounds, lambda _v: opentelemetry.proto_json._json_codec.encode_float(_v)) if self.exemplars: - _result["exemplars"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.exemplars, lambda _v: _v.to_dict()) + _result["exemplars"] = opentelemetry.proto_json._json_codec.encode_repeated(self.exemplars, lambda _v: _v.to_dict()) if self.flags: _result["flags"] = self.flags - if self.min: - _result["min"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.min) - if self.max: - _result["max"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.max) + if self.min is not None: + _result["min"] = opentelemetry.proto_json._json_codec.encode_float(self.min) + if self.max is not None: + _result["max"] = opentelemetry.proto_json._json_codec.encode_float(self.max) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "HistogramDataPoint": """ @@ -875,50 +656,38 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "HistogramD Returns: HistogramDataPoint instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("attributes")) is not None: - _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + _args["attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") if (_value := data.get("startTimeUnixNano")) is not None: - _args["start_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_time_unix_nano") + _args["start_time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "start_time_unix_nano") if (_value := data.get("timeUnixNano")) is not None: - _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + _args["time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "time_unix_nano") if (_value := data.get("count")) is not None: - _args["count"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "count") + _args["count"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "count") if (_value := data.get("sum")) is not None: - _args["sum"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "sum") + _args["sum"] = opentelemetry.proto_json._json_codec.decode_float(_value, "sum") if (_value := data.get("bucketCounts")) is not None: - _args["bucket_counts"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json._otlp_json_utils.decode_int64(_v, "bucket_counts"), "bucket_counts") + _args["bucket_counts"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json._json_codec.decode_int64(_v, "bucket_counts"), "bucket_counts") if (_value := data.get("explicitBounds")) is not None: - _args["explicit_bounds"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json._otlp_json_utils.decode_float(_v, "explicit_bounds"), "explicit_bounds") + _args["explicit_bounds"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json._json_codec.decode_float(_v, "explicit_bounds"), "explicit_bounds") if (_value := data.get("exemplars")) is not None: - _args["exemplars"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Exemplar.from_dict(_v), "exemplars") + _args["exemplars"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Exemplar.from_dict(_v), "exemplars") if (_value := data.get("flags")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "flags") _args["flags"] = _value if (_value := data.get("min")) is not None: - _args["min"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "min") + _args["min"] = opentelemetry.proto_json._json_codec.decode_float(_value, "min") if (_value := data.get("max")) is not None: - _args["max"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "max") + _args["max"] = opentelemetry.proto_json._json_codec.decode_float(_value, "max") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "HistogramDataPoint": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ExponentialHistogramDataPoint: """ @@ -926,6 +695,7 @@ class ExponentialHistogramDataPoint: """ @typing.final + @opentelemetry.proto_json._json_codec.json_serde @_dataclass class Buckets: """ @@ -946,18 +716,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.offset: _result["offset"] = self.offset if self.bucket_counts: - _result["bucketCounts"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.bucket_counts, lambda _v: opentelemetry.proto_json._otlp_json_utils.encode_int64(_v)) + _result["bucketCounts"] = opentelemetry.proto_json._json_codec.encode_repeated(self.bucket_counts, lambda _v: opentelemetry.proto_json._json_codec.encode_int64(_v)) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExponentialHistogramDataPoint.Buckets": """ @@ -969,43 +730,30 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Exponentia Returns: Buckets instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("offset")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "offset") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "offset") _args["offset"] = _value if (_value := data.get("bucketCounts")) is not None: - _args["bucket_counts"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json._otlp_json_utils.decode_int64(_v, "bucket_counts"), "bucket_counts") + _args["bucket_counts"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json._json_codec.decode_int64(_v, "bucket_counts"), "bucket_counts") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExponentialHistogramDataPoint.Buckets": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) start_time_unix_nano: typing.Optional[builtins.int] = 0 time_unix_nano: typing.Optional[builtins.int] = 0 count: typing.Optional[builtins.int] = 0 - sum: typing.Optional[builtins.float] = 0.0 + sum: typing.Optional[builtins.float] = None scale: typing.Optional[builtins.int] = 0 zero_count: typing.Optional[builtins.int] = 0 positive: typing.Optional[ExponentialHistogramDataPoint.Buckets] = None negative: typing.Optional[ExponentialHistogramDataPoint.Buckets] = None flags: typing.Optional[builtins.int] = 0 exemplars: builtins.list[Exemplar] = dataclasses.field(default_factory=builtins.list) - min: typing.Optional[builtins.float] = 0.0 - max: typing.Optional[builtins.float] = 0.0 + min: typing.Optional[builtins.float] = None + max: typing.Optional[builtins.float] = None zero_threshold: typing.Optional[builtins.float] = 0.0 def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: @@ -1017,19 +765,19 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.attributes: - _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + _result["attributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attributes, lambda _v: _v.to_dict()) if self.start_time_unix_nano: - _result["startTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_time_unix_nano) + _result["startTimeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.start_time_unix_nano) if self.time_unix_nano: - _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + _result["timeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.time_unix_nano) if self.count: - _result["count"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.count) - if self.sum: - _result["sum"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.sum) + _result["count"] = opentelemetry.proto_json._json_codec.encode_int64(self.count) + if self.sum is not None: + _result["sum"] = opentelemetry.proto_json._json_codec.encode_float(self.sum) if self.scale: _result["scale"] = self.scale if self.zero_count: - _result["zeroCount"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.zero_count) + _result["zeroCount"] = opentelemetry.proto_json._json_codec.encode_int64(self.zero_count) if self.positive: _result["positive"] = self.positive.to_dict() if self.negative: @@ -1037,24 +785,15 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.flags: _result["flags"] = self.flags if self.exemplars: - _result["exemplars"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.exemplars, lambda _v: _v.to_dict()) - if self.min: - _result["min"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.min) - if self.max: - _result["max"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.max) + _result["exemplars"] = opentelemetry.proto_json._json_codec.encode_repeated(self.exemplars, lambda _v: _v.to_dict()) + if self.min is not None: + _result["min"] = opentelemetry.proto_json._json_codec.encode_float(self.min) + if self.max is not None: + _result["max"] = opentelemetry.proto_json._json_codec.encode_float(self.max) if self.zero_threshold: - _result["zeroThreshold"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.zero_threshold) + _result["zeroThreshold"] = opentelemetry.proto_json._json_codec.encode_float(self.zero_threshold) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExponentialHistogramDataPoint": """ @@ -1066,57 +805,45 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Exponentia Returns: ExponentialHistogramDataPoint instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("attributes")) is not None: - _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + _args["attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") if (_value := data.get("startTimeUnixNano")) is not None: - _args["start_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_time_unix_nano") + _args["start_time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "start_time_unix_nano") if (_value := data.get("timeUnixNano")) is not None: - _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + _args["time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "time_unix_nano") if (_value := data.get("count")) is not None: - _args["count"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "count") + _args["count"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "count") if (_value := data.get("sum")) is not None: - _args["sum"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "sum") + _args["sum"] = opentelemetry.proto_json._json_codec.decode_float(_value, "sum") if (_value := data.get("scale")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "scale") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "scale") _args["scale"] = _value if (_value := data.get("zeroCount")) is not None: - _args["zero_count"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "zero_count") + _args["zero_count"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "zero_count") if (_value := data.get("positive")) is not None: _args["positive"] = ExponentialHistogramDataPoint.Buckets.from_dict(_value) if (_value := data.get("negative")) is not None: _args["negative"] = ExponentialHistogramDataPoint.Buckets.from_dict(_value) if (_value := data.get("flags")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "flags") _args["flags"] = _value if (_value := data.get("exemplars")) is not None: - _args["exemplars"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Exemplar.from_dict(_v), "exemplars") + _args["exemplars"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Exemplar.from_dict(_v), "exemplars") if (_value := data.get("min")) is not None: - _args["min"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "min") + _args["min"] = opentelemetry.proto_json._json_codec.decode_float(_value, "min") if (_value := data.get("max")) is not None: - _args["max"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "max") + _args["max"] = opentelemetry.proto_json._json_codec.decode_float(_value, "max") if (_value := data.get("zeroThreshold")) is not None: - _args["zero_threshold"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "zero_threshold") + _args["zero_threshold"] = opentelemetry.proto_json._json_codec.decode_float(_value, "zero_threshold") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ExponentialHistogramDataPoint": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class SummaryDataPoint: """ @@ -1124,6 +851,7 @@ class SummaryDataPoint: """ @typing.final + @opentelemetry.proto_json._json_codec.json_serde @_dataclass class ValueAtQuantile: """ @@ -1142,20 +870,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.quantile: - _result["quantile"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.quantile) + _result["quantile"] = opentelemetry.proto_json._json_codec.encode_float(self.quantile) if self.value: - _result["value"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.value) + _result["value"] = opentelemetry.proto_json._json_codec.encode_float(self.value) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "SummaryDataPoint.ValueAtQuantile": """ @@ -1167,29 +886,16 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "SummaryDat Returns: ValueAtQuantile instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("quantile")) is not None: - _args["quantile"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "quantile") + _args["quantile"] = opentelemetry.proto_json._json_codec.decode_float(_value, "quantile") if (_value := data.get("value")) is not None: - _args["value"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "value") + _args["value"] = opentelemetry.proto_json._json_codec.decode_float(_value, "value") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "SummaryDataPoint.ValueAtQuantile": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - attributes: builtins.list[opentelemetry.proto_json.common.v1.common.KeyValue] = dataclasses.field(default_factory=builtins.list) start_time_unix_nano: typing.Optional[builtins.int] = 0 time_unix_nano: typing.Optional[builtins.int] = 0 @@ -1207,30 +913,21 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.attributes: - _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + _result["attributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attributes, lambda _v: _v.to_dict()) if self.start_time_unix_nano: - _result["startTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_time_unix_nano) + _result["startTimeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.start_time_unix_nano) if self.time_unix_nano: - _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + _result["timeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.time_unix_nano) if self.count: - _result["count"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.count) + _result["count"] = opentelemetry.proto_json._json_codec.encode_int64(self.count) if self.sum: - _result["sum"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.sum) + _result["sum"] = opentelemetry.proto_json._json_codec.encode_float(self.sum) if self.quantile_values: - _result["quantileValues"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.quantile_values, lambda _v: _v.to_dict()) + _result["quantileValues"] = opentelemetry.proto_json._json_codec.encode_repeated(self.quantile_values, lambda _v: _v.to_dict()) if self.flags: _result["flags"] = self.flags return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "SummaryDataPoint": """ @@ -1242,42 +939,30 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "SummaryDat Returns: SummaryDataPoint instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("attributes")) is not None: - _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + _args["attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") if (_value := data.get("startTimeUnixNano")) is not None: - _args["start_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_time_unix_nano") + _args["start_time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "start_time_unix_nano") if (_value := data.get("timeUnixNano")) is not None: - _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + _args["time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "time_unix_nano") if (_value := data.get("count")) is not None: - _args["count"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "count") + _args["count"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "count") if (_value := data.get("sum")) is not None: - _args["sum"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "sum") + _args["sum"] = opentelemetry.proto_json._json_codec.decode_float(_value, "sum") if (_value := data.get("quantileValues")) is not None: - _args["quantile_values"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: SummaryDataPoint.ValueAtQuantile.from_dict(_v), "quantile_values") + _args["quantile_values"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: SummaryDataPoint.ValueAtQuantile.from_dict(_v), "quantile_values") if (_value := data.get("flags")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "flags") _args["flags"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "SummaryDataPoint": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Exemplar: """ @@ -1300,28 +985,19 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.filtered_attributes: - _result["filteredAttributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.filtered_attributes, lambda _v: _v.to_dict()) + _result["filteredAttributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.filtered_attributes, lambda _v: _v.to_dict()) if self.time_unix_nano: - _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + _result["timeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.time_unix_nano) if self.span_id: - _result["spanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.span_id) + _result["spanId"] = opentelemetry.proto_json._json_codec.encode_hex(self.span_id) if self.trace_id: - _result["traceId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.trace_id) + _result["traceId"] = opentelemetry.proto_json._json_codec.encode_hex(self.trace_id) if self.as_int is not None: - _result["asInt"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.as_int) + _result["asInt"] = opentelemetry.proto_json._json_codec.encode_int64(self.as_int) elif self.as_double is not None: - _result["asDouble"] = opentelemetry.proto_json._otlp_json_utils.encode_float(self.as_double) + _result["asDouble"] = opentelemetry.proto_json._json_codec.encode_float(self.as_double) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Exemplar": """ @@ -1333,33 +1009,20 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Exemplar": Returns: Exemplar instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("filteredAttributes")) is not None: - _args["filtered_attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "filtered_attributes") + _args["filtered_attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "filtered_attributes") if (_value := data.get("timeUnixNano")) is not None: - _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + _args["time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "time_unix_nano") if (_value := data.get("spanId")) is not None: - _args["span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "span_id") + _args["span_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "span_id") if (_value := data.get("traceId")) is not None: - _args["trace_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "trace_id") + _args["trace_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "trace_id") if (_value := data.get("asInt")) is not None: - _args["as_int"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "as_int") + _args["as_int"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "as_int") elif (_value := data.get("asDouble")) is not None: - _args["as_double"] = opentelemetry.proto_json._otlp_json_utils.decode_float(_value, "as_double") + _args["as_double"] = opentelemetry.proto_json._json_codec.decode_float(_value, "as_double") return cls(**_args) - - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Exemplar": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py index 02d8efa1d8f..02fa2ad7044 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py @@ -20,7 +20,6 @@ import builtins import dataclasses import functools -import json import sys import typing @@ -29,12 +28,13 @@ else: _dataclass = dataclasses.dataclass -import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json._json_codec import opentelemetry.proto_json.common.v1.common import opentelemetry.proto_json.resource.v1.resource @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ProfilesDictionary: """ @@ -58,30 +58,21 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.mapping_table: - _result["mappingTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.mapping_table, lambda _v: _v.to_dict()) + _result["mappingTable"] = opentelemetry.proto_json._json_codec.encode_repeated(self.mapping_table, lambda _v: _v.to_dict()) if self.location_table: - _result["locationTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.location_table, lambda _v: _v.to_dict()) + _result["locationTable"] = opentelemetry.proto_json._json_codec.encode_repeated(self.location_table, lambda _v: _v.to_dict()) if self.function_table: - _result["functionTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.function_table, lambda _v: _v.to_dict()) + _result["functionTable"] = opentelemetry.proto_json._json_codec.encode_repeated(self.function_table, lambda _v: _v.to_dict()) if self.link_table: - _result["linkTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.link_table, lambda _v: _v.to_dict()) + _result["linkTable"] = opentelemetry.proto_json._json_codec.encode_repeated(self.link_table, lambda _v: _v.to_dict()) if self.string_table: _result["stringTable"] = self.string_table if self.attribute_table: - _result["attributeTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attribute_table, lambda _v: _v.to_dict()) + _result["attributeTable"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attribute_table, lambda _v: _v.to_dict()) if self.stack_table: - _result["stackTable"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.stack_table, lambda _v: _v.to_dict()) + _result["stackTable"] = opentelemetry.proto_json._json_codec.encode_repeated(self.stack_table, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ProfilesDictionary": """ @@ -93,41 +84,29 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ProfilesDi Returns: ProfilesDictionary instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("mappingTable")) is not None: - _args["mapping_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Mapping.from_dict(_v), "mapping_table") + _args["mapping_table"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Mapping.from_dict(_v), "mapping_table") if (_value := data.get("locationTable")) is not None: - _args["location_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Location.from_dict(_v), "location_table") + _args["location_table"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Location.from_dict(_v), "location_table") if (_value := data.get("functionTable")) is not None: - _args["function_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Function.from_dict(_v), "function_table") + _args["function_table"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Function.from_dict(_v), "function_table") if (_value := data.get("linkTable")) is not None: - _args["link_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Link.from_dict(_v), "link_table") + _args["link_table"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Link.from_dict(_v), "link_table") if (_value := data.get("stringTable")) is not None: - _args["string_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "string_table") + _args["string_table"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: _v, "string_table") if (_value := data.get("attributeTable")) is not None: - _args["attribute_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: KeyValueAndUnit.from_dict(_v), "attribute_table") + _args["attribute_table"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: KeyValueAndUnit.from_dict(_v), "attribute_table") if (_value := data.get("stackTable")) is not None: - _args["stack_table"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Stack.from_dict(_v), "stack_table") + _args["stack_table"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Stack.from_dict(_v), "stack_table") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ProfilesDictionary": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ProfilesData: """ @@ -146,20 +125,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.resource_profiles: - _result["resourceProfiles"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_profiles, lambda _v: _v.to_dict()) + _result["resourceProfiles"] = opentelemetry.proto_json._json_codec.encode_repeated(self.resource_profiles, lambda _v: _v.to_dict()) if self.dictionary: _result["dictionary"] = self.dictionary.to_dict() return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ProfilesData": """ @@ -171,31 +141,19 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ProfilesDa Returns: ProfilesData instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resourceProfiles")) is not None: - _args["resource_profiles"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ResourceProfiles.from_dict(_v), "resource_profiles") + _args["resource_profiles"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: ResourceProfiles.from_dict(_v), "resource_profiles") if (_value := data.get("dictionary")) is not None: _args["dictionary"] = ProfilesDictionary.from_dict(_value) return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ProfilesData": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ResourceProfiles: """ @@ -217,20 +175,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.resource: _result["resource"] = self.resource.to_dict() if self.scope_profiles: - _result["scopeProfiles"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.scope_profiles, lambda _v: _v.to_dict()) + _result["scopeProfiles"] = opentelemetry.proto_json._json_codec.encode_repeated(self.scope_profiles, lambda _v: _v.to_dict()) if self.schema_url: _result["schemaUrl"] = self.schema_url return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceProfiles": """ @@ -242,34 +191,22 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourcePr Returns: ResourceProfiles instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resource")) is not None: _args["resource"] = opentelemetry.proto_json.resource.v1.resource.Resource.from_dict(_value) if (_value := data.get("scopeProfiles")) is not None: - _args["scope_profiles"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ScopeProfiles.from_dict(_v), "scope_profiles") + _args["scope_profiles"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: ScopeProfiles.from_dict(_v), "scope_profiles") if (_value := data.get("schemaUrl")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "schema_url") _args["schema_url"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ResourceProfiles": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ScopeProfiles: """ @@ -291,20 +228,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.scope: _result["scope"] = self.scope.to_dict() if self.profiles: - _result["profiles"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.profiles, lambda _v: _v.to_dict()) + _result["profiles"] = opentelemetry.proto_json._json_codec.encode_repeated(self.profiles, lambda _v: _v.to_dict()) if self.schema_url: _result["schemaUrl"] = self.schema_url return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeProfiles": """ @@ -316,34 +244,22 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeProfi Returns: ScopeProfiles instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("scope")) is not None: _args["scope"] = opentelemetry.proto_json.common.v1.common.InstrumentationScope.from_dict(_value) if (_value := data.get("profiles")) is not None: - _args["profiles"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Profile.from_dict(_v), "profiles") + _args["profiles"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Profile.from_dict(_v), "profiles") if (_value := data.get("schemaUrl")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "schema_url") _args["schema_url"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ScopeProfiles": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Profile: """ @@ -373,36 +289,27 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.sample_type: _result["sampleType"] = self.sample_type.to_dict() if self.samples: - _result["samples"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.samples, lambda _v: _v.to_dict()) + _result["samples"] = opentelemetry.proto_json._json_codec.encode_repeated(self.samples, lambda _v: _v.to_dict()) if self.time_unix_nano: - _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + _result["timeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.time_unix_nano) if self.duration_nano: - _result["durationNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.duration_nano) + _result["durationNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.duration_nano) if self.period_type: _result["periodType"] = self.period_type.to_dict() if self.period: - _result["period"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.period) + _result["period"] = opentelemetry.proto_json._json_codec.encode_int64(self.period) if self.profile_id: - _result["profileId"] = opentelemetry.proto_json._otlp_json_utils.encode_base64(self.profile_id) + _result["profileId"] = opentelemetry.proto_json._json_codec.encode_base64(self.profile_id) if self.dropped_attributes_count: _result["droppedAttributesCount"] = self.dropped_attributes_count if self.original_payload_format: _result["originalPayloadFormat"] = self.original_payload_format if self.original_payload: - _result["originalPayload"] = opentelemetry.proto_json._otlp_json_utils.encode_base64(self.original_payload) + _result["originalPayload"] = opentelemetry.proto_json._json_codec.encode_base64(self.original_payload) if self.attribute_indices: _result["attributeIndices"] = self.attribute_indices return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Profile": """ @@ -414,51 +321,39 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Profile": Returns: Profile instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("sampleType")) is not None: _args["sample_type"] = ValueType.from_dict(_value) if (_value := data.get("samples")) is not None: - _args["samples"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Sample.from_dict(_v), "samples") + _args["samples"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Sample.from_dict(_v), "samples") if (_value := data.get("timeUnixNano")) is not None: - _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + _args["time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "time_unix_nano") if (_value := data.get("durationNano")) is not None: - _args["duration_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "duration_nano") + _args["duration_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "duration_nano") if (_value := data.get("periodType")) is not None: _args["period_type"] = ValueType.from_dict(_value) if (_value := data.get("period")) is not None: - _args["period"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "period") + _args["period"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "period") if (_value := data.get("profileId")) is not None: - _args["profile_id"] = opentelemetry.proto_json._otlp_json_utils.decode_base64(_value, "profile_id") + _args["profile_id"] = opentelemetry.proto_json._json_codec.decode_base64(_value, "profile_id") if (_value := data.get("droppedAttributesCount")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "dropped_attributes_count") _args["dropped_attributes_count"] = _value if (_value := data.get("originalPayloadFormat")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "original_payload_format") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "original_payload_format") _args["original_payload_format"] = _value if (_value := data.get("originalPayload")) is not None: - _args["original_payload"] = opentelemetry.proto_json._otlp_json_utils.decode_base64(_value, "original_payload") + _args["original_payload"] = opentelemetry.proto_json._json_codec.decode_base64(_value, "original_payload") if (_value := data.get("attributeIndices")) is not None: - _args["attribute_indices"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "attribute_indices") + _args["attribute_indices"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: _v, "attribute_indices") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Profile": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Link: """ @@ -477,20 +372,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.trace_id: - _result["traceId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.trace_id) + _result["traceId"] = opentelemetry.proto_json._json_codec.encode_hex(self.trace_id) if self.span_id: - _result["spanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.span_id) + _result["spanId"] = opentelemetry.proto_json._json_codec.encode_hex(self.span_id) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Link": """ @@ -502,31 +388,19 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Link": Returns: Link instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("traceId")) is not None: - _args["trace_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "trace_id") + _args["trace_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "trace_id") if (_value := data.get("spanId")) is not None: - _args["span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "span_id") + _args["span_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "span_id") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Link": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ValueType: """ @@ -550,15 +424,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["unitStrindex"] = self.unit_strindex return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ValueType": """ @@ -570,33 +435,21 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ValueType" Returns: ValueType instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("typeStrindex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "type_strindex") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "type_strindex") _args["type_strindex"] = _value if (_value := data.get("unitStrindex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "unit_strindex") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "unit_strindex") _args["unit_strindex"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ValueType": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Sample: """ @@ -620,24 +473,15 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.stack_index: _result["stackIndex"] = self.stack_index if self.values: - _result["values"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.values, lambda _v: opentelemetry.proto_json._otlp_json_utils.encode_int64(_v)) + _result["values"] = opentelemetry.proto_json._json_codec.encode_repeated(self.values, lambda _v: opentelemetry.proto_json._json_codec.encode_int64(_v)) if self.attribute_indices: _result["attributeIndices"] = self.attribute_indices if self.link_index: _result["linkIndex"] = self.link_index if self.timestamps_unix_nano: - _result["timestampsUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.timestamps_unix_nano, lambda _v: opentelemetry.proto_json._otlp_json_utils.encode_int64(_v)) + _result["timestampsUnixNano"] = opentelemetry.proto_json._json_codec.encode_repeated(self.timestamps_unix_nano, lambda _v: opentelemetry.proto_json._json_codec.encode_int64(_v)) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Sample": """ @@ -649,39 +493,27 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Sample": Returns: Sample instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("stackIndex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "stack_index") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "stack_index") _args["stack_index"] = _value if (_value := data.get("values")) is not None: - _args["values"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json._otlp_json_utils.decode_int64(_v, "values"), "values") + _args["values"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json._json_codec.decode_int64(_v, "values"), "values") if (_value := data.get("attributeIndices")) is not None: - _args["attribute_indices"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "attribute_indices") + _args["attribute_indices"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: _v, "attribute_indices") if (_value := data.get("linkIndex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "link_index") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "link_index") _args["link_index"] = _value if (_value := data.get("timestampsUnixNano")) is not None: - _args["timestamps_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json._otlp_json_utils.decode_int64(_v, "timestamps_unix_nano"), "timestamps_unix_nano") + _args["timestamps_unix_nano"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json._json_codec.decode_int64(_v, "timestamps_unix_nano"), "timestamps_unix_nano") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Sample": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Mapping: """ @@ -703,26 +535,17 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.memory_start: - _result["memoryStart"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.memory_start) + _result["memoryStart"] = opentelemetry.proto_json._json_codec.encode_int64(self.memory_start) if self.memory_limit: - _result["memoryLimit"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.memory_limit) + _result["memoryLimit"] = opentelemetry.proto_json._json_codec.encode_int64(self.memory_limit) if self.file_offset: - _result["fileOffset"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.file_offset) + _result["fileOffset"] = opentelemetry.proto_json._json_codec.encode_int64(self.file_offset) if self.filename_strindex: _result["filenameStrindex"] = self.filename_strindex if self.attribute_indices: _result["attributeIndices"] = self.attribute_indices return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Mapping": """ @@ -734,38 +557,26 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Mapping": Returns: Mapping instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("memoryStart")) is not None: - _args["memory_start"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "memory_start") + _args["memory_start"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "memory_start") if (_value := data.get("memoryLimit")) is not None: - _args["memory_limit"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "memory_limit") + _args["memory_limit"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "memory_limit") if (_value := data.get("fileOffset")) is not None: - _args["file_offset"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "file_offset") + _args["file_offset"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "file_offset") if (_value := data.get("filenameStrindex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "filename_strindex") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "filename_strindex") _args["filename_strindex"] = _value if (_value := data.get("attributeIndices")) is not None: - _args["attribute_indices"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "attribute_indices") + _args["attribute_indices"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: _v, "attribute_indices") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Mapping": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Stack: """ @@ -786,15 +597,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["locationIndices"] = self.location_indices return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Stack": """ @@ -806,29 +608,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Stack": Returns: Stack instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("locationIndices")) is not None: - _args["location_indices"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "location_indices") + _args["location_indices"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: _v, "location_indices") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Stack": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Location: """ @@ -851,22 +641,13 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.mapping_index: _result["mappingIndex"] = self.mapping_index if self.address: - _result["address"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.address) + _result["address"] = opentelemetry.proto_json._json_codec.encode_int64(self.address) if self.lines: - _result["lines"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.lines, lambda _v: _v.to_dict()) + _result["lines"] = opentelemetry.proto_json._json_codec.encode_repeated(self.lines, lambda _v: _v.to_dict()) if self.attribute_indices: _result["attributeIndices"] = self.attribute_indices return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Location": """ @@ -878,36 +659,24 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Location": Returns: Location instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("mappingIndex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "mapping_index") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "mapping_index") _args["mapping_index"] = _value if (_value := data.get("address")) is not None: - _args["address"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "address") + _args["address"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "address") if (_value := data.get("lines")) is not None: - _args["lines"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Line.from_dict(_v), "lines") + _args["lines"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Line.from_dict(_v), "lines") if (_value := data.get("attributeIndices")) is not None: - _args["attribute_indices"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: _v, "attribute_indices") + _args["attribute_indices"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: _v, "attribute_indices") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Location": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Line: """ @@ -929,20 +698,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.function_index: _result["functionIndex"] = self.function_index if self.line: - _result["line"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.line) + _result["line"] = opentelemetry.proto_json._json_codec.encode_int64(self.line) if self.column: - _result["column"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.column) + _result["column"] = opentelemetry.proto_json._json_codec.encode_int64(self.column) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Line": """ @@ -954,34 +714,22 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Line": Returns: Line instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("functionIndex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "function_index") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "function_index") _args["function_index"] = _value if (_value := data.get("line")) is not None: - _args["line"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "line") + _args["line"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "line") if (_value := data.get("column")) is not None: - _args["column"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "column") + _args["column"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "column") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Line": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Function: """ @@ -1008,18 +756,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.filename_strindex: _result["filenameStrindex"] = self.filename_strindex if self.start_line: - _result["startLine"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_line) + _result["startLine"] = opentelemetry.proto_json._json_codec.encode_int64(self.start_line) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Function": """ @@ -1031,38 +770,26 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Function": Returns: Function instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("nameStrindex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "name_strindex") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "name_strindex") _args["name_strindex"] = _value if (_value := data.get("systemNameStrindex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "system_name_strindex") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "system_name_strindex") _args["system_name_strindex"] = _value if (_value := data.get("filenameStrindex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "filename_strindex") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "filename_strindex") _args["filename_strindex"] = _value if (_value := data.get("startLine")) is not None: - _args["start_line"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_line") + _args["start_line"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "start_line") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Function": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class KeyValueAndUnit: """ @@ -1089,15 +816,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["unitStrindex"] = self.unit_strindex return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValueAndUnit": """ @@ -1109,29 +827,16 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValueAn Returns: KeyValueAndUnit instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("keyStrindex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "key_strindex") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "key_strindex") _args["key_strindex"] = _value if (_value := data.get("value")) is not None: _args["value"] = opentelemetry.proto_json.common.v1.common.AnyValue.from_dict(_value) if (_value := data.get("unitStrindex")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "unit_strindex") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "unit_strindex") _args["unit_strindex"] = _value return cls(**_args) - - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "KeyValueAndUnit": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py index bc80bf49aa4..e20f21e516b 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py @@ -20,7 +20,6 @@ import builtins import dataclasses import functools -import json import sys import typing @@ -29,11 +28,12 @@ else: _dataclass = dataclasses.dataclass -import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json._json_codec import opentelemetry.proto_json.common.v1.common @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Resource: """ @@ -53,22 +53,13 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.attributes: - _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + _result["attributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attributes, lambda _v: _v.to_dict()) if self.dropped_attributes_count: _result["droppedAttributesCount"] = self.dropped_attributes_count if self.entity_refs: - _result["entityRefs"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.entity_refs, lambda _v: _v.to_dict()) + _result["entityRefs"] = opentelemetry.proto_json._json_codec.encode_repeated(self.entity_refs, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Resource": """ @@ -80,28 +71,15 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Resource": Returns: Resource instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("attributes")) is not None: - _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + _args["attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") if (_value := data.get("droppedAttributesCount")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "dropped_attributes_count") _args["dropped_attributes_count"] = _value if (_value := data.get("entityRefs")) is not None: - _args["entity_refs"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.EntityRef.from_dict(_v), "entity_refs") + _args["entity_refs"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.EntityRef.from_dict(_v), "entity_refs") return cls(**_args) - - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Resource": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py index a1fa28f18e3..dda9433d590 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py @@ -21,7 +21,6 @@ import dataclasses import enum import functools -import json import sys import typing @@ -30,7 +29,7 @@ else: _dataclass = dataclasses.dataclass -import opentelemetry.proto_json._otlp_json_utils +import opentelemetry.proto_json._json_codec import opentelemetry.proto_json.common.v1.common import opentelemetry.proto_json.resource.v1.resource @@ -47,6 +46,7 @@ class SpanFlags(enum.IntEnum): SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 512 @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class TracesData: """ @@ -64,18 +64,9 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.resource_spans: - _result["resourceSpans"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.resource_spans, lambda _v: _v.to_dict()) + _result["resourceSpans"] = opentelemetry.proto_json._json_codec.encode_repeated(self.resource_spans, lambda _v: _v.to_dict()) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "TracesData": """ @@ -87,29 +78,17 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "TracesData Returns: TracesData instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resourceSpans")) is not None: - _args["resource_spans"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ResourceSpans.from_dict(_v), "resource_spans") + _args["resource_spans"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: ResourceSpans.from_dict(_v), "resource_spans") return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "TracesData": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ResourceSpans: """ @@ -131,20 +110,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.resource: _result["resource"] = self.resource.to_dict() if self.scope_spans: - _result["scopeSpans"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.scope_spans, lambda _v: _v.to_dict()) + _result["scopeSpans"] = opentelemetry.proto_json._json_codec.encode_repeated(self.scope_spans, lambda _v: _v.to_dict()) if self.schema_url: _result["schemaUrl"] = self.schema_url return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceSpans": """ @@ -156,34 +126,22 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceSp Returns: ResourceSpans instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("resource")) is not None: _args["resource"] = opentelemetry.proto_json.resource.v1.resource.Resource.from_dict(_value) if (_value := data.get("scopeSpans")) is not None: - _args["scope_spans"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: ScopeSpans.from_dict(_v), "scope_spans") + _args["scope_spans"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: ScopeSpans.from_dict(_v), "scope_spans") if (_value := data.get("schemaUrl")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "schema_url") _args["schema_url"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ResourceSpans": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class ScopeSpans: """ @@ -205,20 +163,11 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.scope: _result["scope"] = self.scope.to_dict() if self.spans: - _result["spans"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.spans, lambda _v: _v.to_dict()) + _result["spans"] = opentelemetry.proto_json._json_codec.encode_repeated(self.spans, lambda _v: _v.to_dict()) if self.schema_url: _result["schemaUrl"] = self.schema_url return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeSpans": """ @@ -230,34 +179,22 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeSpans Returns: ScopeSpans instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("scope")) is not None: _args["scope"] = opentelemetry.proto_json.common.v1.common.InstrumentationScope.from_dict(_value) if (_value := data.get("spans")) is not None: - _args["spans"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Span.from_dict(_v), "spans") + _args["spans"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Span.from_dict(_v), "spans") if (_value := data.get("schemaUrl")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "schema_url") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "schema_url") _args["schema_url"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "ScopeSpans": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Span: """ @@ -278,6 +215,7 @@ class SpanKind(enum.IntEnum): SPAN_KIND_CONSUMER = 5 @typing.final + @opentelemetry.proto_json._json_codec.json_serde @_dataclass class Event: """ @@ -298,24 +236,15 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.time_unix_nano: - _result["timeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.time_unix_nano) + _result["timeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.time_unix_nano) if self.name: _result["name"] = self.name if self.attributes: - _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + _result["attributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attributes, lambda _v: _v.to_dict()) if self.dropped_attributes_count: _result["droppedAttributesCount"] = self.dropped_attributes_count return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span.Event": """ @@ -327,36 +256,24 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span.Event Returns: Event instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("timeUnixNano")) is not None: - _args["time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "time_unix_nano") + _args["time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "time_unix_nano") if (_value := data.get("name")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "name") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "name") _args["name"] = _value if (_value := data.get("attributes")) is not None: - _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + _args["attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") if (_value := data.get("droppedAttributesCount")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "dropped_attributes_count") _args["dropped_attributes_count"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Span.Event": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final + @opentelemetry.proto_json._json_codec.json_serde @_dataclass class Link: """ @@ -379,28 +296,19 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.trace_id: - _result["traceId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.trace_id) + _result["traceId"] = opentelemetry.proto_json._json_codec.encode_hex(self.trace_id) if self.span_id: - _result["spanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.span_id) + _result["spanId"] = opentelemetry.proto_json._json_codec.encode_hex(self.span_id) if self.trace_state: _result["traceState"] = self.trace_state if self.attributes: - _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + _result["attributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attributes, lambda _v: _v.to_dict()) if self.dropped_attributes_count: _result["droppedAttributesCount"] = self.dropped_attributes_count if self.flags: _result["flags"] = self.flags return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span.Link": """ @@ -412,40 +320,27 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span.Link" Returns: Link instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("traceId")) is not None: - _args["trace_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "trace_id") + _args["trace_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "trace_id") if (_value := data.get("spanId")) is not None: - _args["span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "span_id") + _args["span_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "span_id") if (_value := data.get("traceState")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "trace_state") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "trace_state") _args["trace_state"] = _value if (_value := data.get("attributes")) is not None: - _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + _args["attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") if (_value := data.get("droppedAttributesCount")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "dropped_attributes_count") _args["dropped_attributes_count"] = _value if (_value := data.get("flags")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "flags") _args["flags"] = _value return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Span.Link": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - trace_id: typing.Optional[builtins.bytes] = b"" span_id: typing.Optional[builtins.bytes] = b"" trace_state: typing.Optional[builtins.str] = "" @@ -472,13 +367,13 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: """ _result = {} if self.trace_id: - _result["traceId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.trace_id) + _result["traceId"] = opentelemetry.proto_json._json_codec.encode_hex(self.trace_id) if self.span_id: - _result["spanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.span_id) + _result["spanId"] = opentelemetry.proto_json._json_codec.encode_hex(self.span_id) if self.trace_state: _result["traceState"] = self.trace_state if self.parent_span_id: - _result["parentSpanId"] = opentelemetry.proto_json._otlp_json_utils.encode_hex(self.parent_span_id) + _result["parentSpanId"] = opentelemetry.proto_json._json_codec.encode_hex(self.parent_span_id) if self.flags: _result["flags"] = self.flags if self.name: @@ -486,34 +381,25 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: if self.kind: _result["kind"] = builtins.int(self.kind) if self.start_time_unix_nano: - _result["startTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.start_time_unix_nano) + _result["startTimeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.start_time_unix_nano) if self.end_time_unix_nano: - _result["endTimeUnixNano"] = opentelemetry.proto_json._otlp_json_utils.encode_int64(self.end_time_unix_nano) + _result["endTimeUnixNano"] = opentelemetry.proto_json._json_codec.encode_int64(self.end_time_unix_nano) if self.attributes: - _result["attributes"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.attributes, lambda _v: _v.to_dict()) + _result["attributes"] = opentelemetry.proto_json._json_codec.encode_repeated(self.attributes, lambda _v: _v.to_dict()) if self.dropped_attributes_count: _result["droppedAttributesCount"] = self.dropped_attributes_count if self.events: - _result["events"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.events, lambda _v: _v.to_dict()) + _result["events"] = opentelemetry.proto_json._json_codec.encode_repeated(self.events, lambda _v: _v.to_dict()) if self.dropped_events_count: _result["droppedEventsCount"] = self.dropped_events_count if self.links: - _result["links"] = opentelemetry.proto_json._otlp_json_utils.encode_repeated(self.links, lambda _v: _v.to_dict()) + _result["links"] = opentelemetry.proto_json._json_codec.encode_repeated(self.links, lambda _v: _v.to_dict()) if self.dropped_links_count: _result["droppedLinksCount"] = self.dropped_links_count if self.status: _result["status"] = self.status.to_dict() return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span": """ @@ -525,66 +411,54 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span": Returns: Span instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("traceId")) is not None: - _args["trace_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "trace_id") + _args["trace_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "trace_id") if (_value := data.get("spanId")) is not None: - _args["span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "span_id") + _args["span_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "span_id") if (_value := data.get("traceState")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "trace_state") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "trace_state") _args["trace_state"] = _value if (_value := data.get("parentSpanId")) is not None: - _args["parent_span_id"] = opentelemetry.proto_json._otlp_json_utils.decode_hex(_value, "parent_span_id") + _args["parent_span_id"] = opentelemetry.proto_json._json_codec.decode_hex(_value, "parent_span_id") if (_value := data.get("flags")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "flags") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "flags") _args["flags"] = _value if (_value := data.get("name")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "name") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "name") _args["name"] = _value if (_value := data.get("kind")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "kind") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "kind") _args["kind"] = Span.SpanKind(_value) if (_value := data.get("startTimeUnixNano")) is not None: - _args["start_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "start_time_unix_nano") + _args["start_time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "start_time_unix_nano") if (_value := data.get("endTimeUnixNano")) is not None: - _args["end_time_unix_nano"] = opentelemetry.proto_json._otlp_json_utils.decode_int64(_value, "end_time_unix_nano") + _args["end_time_unix_nano"] = opentelemetry.proto_json._json_codec.decode_int64(_value, "end_time_unix_nano") if (_value := data.get("attributes")) is not None: - _args["attributes"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") + _args["attributes"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: opentelemetry.proto_json.common.v1.common.KeyValue.from_dict(_v), "attributes") if (_value := data.get("droppedAttributesCount")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_attributes_count") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "dropped_attributes_count") _args["dropped_attributes_count"] = _value if (_value := data.get("events")) is not None: - _args["events"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Span.Event.from_dict(_v), "events") + _args["events"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Span.Event.from_dict(_v), "events") if (_value := data.get("droppedEventsCount")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_events_count") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "dropped_events_count") _args["dropped_events_count"] = _value if (_value := data.get("links")) is not None: - _args["links"] = opentelemetry.proto_json._otlp_json_utils.decode_repeated(_value, lambda _v: Span.Link.from_dict(_v), "links") + _args["links"] = opentelemetry.proto_json._json_codec.decode_repeated(_value, lambda _v: Span.Link.from_dict(_v), "links") if (_value := data.get("droppedLinksCount")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "dropped_links_count") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "dropped_links_count") _args["dropped_links_count"] = _value if (_value := data.get("status")) is not None: _args["status"] = Status.from_dict(_value) return cls(**_args) - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Span": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) - @typing.final +@opentelemetry.proto_json._json_codec.json_serde @_dataclass class Status: """ @@ -618,15 +492,6 @@ def to_dict(self) -> builtins.dict[builtins.str, typing.Any]: _result["code"] = builtins.int(self.code) return _result - def to_json(self) -> builtins.str: - """ - Serialize this message to a JSON string. - - Returns: - JSON string - """ - return json.dumps(self.to_dict()) - @builtins.classmethod def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Status": """ @@ -638,27 +503,14 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Status": Returns: Status instance """ - opentelemetry.proto_json._otlp_json_utils.validate_type(data, builtins.dict, "data") + opentelemetry.proto_json._json_codec.validate_type(data, builtins.dict, "data") _args = {} if (_value := data.get("message")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.str, "message") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.str, "message") _args["message"] = _value if (_value := data.get("code")) is not None: - opentelemetry.proto_json._otlp_json_utils.validate_type(_value, builtins.int, "code") + opentelemetry.proto_json._json_codec.validate_type(_value, builtins.int, "code") _args["code"] = Status.StatusCode(_value) return cls(**_args) - - @builtins.classmethod - def from_json(cls, data: typing.Union[builtins.str, builtins.bytes]) -> "Status": - """ - Deserialize from a JSON string or bytes. - - Args: - data: JSON string or bytes - - Returns: - Instance of the class - """ - return cls.from_dict(json.loads(data)) From 28e5bca97cc97b0cc72dc4aab1fec02e847f465f Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Fri, 6 Mar 2026 23:47:33 -0500 Subject: [PATCH 06/15] update docstring --- .../src/opentelemetry/codegen/json/runtime/json_codec.py | 1 - 1 file changed, 1 deletion(-) diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py index beb7540904d..4cfc6e23d47 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py @@ -25,7 +25,6 @@ def json_serde(cls: type[T]) -> type[T]: """ A decorator that adds "to_json" and "from_json" methods to a class. - The class must already have to_dict and from_dict methods. """ def to_json(self: typing.Any) -> str: From 8cc929df1b1fe8250a198d7140c2dc6227593943 Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Sat, 7 Mar 2026 23:36:01 -0500 Subject: [PATCH 07/15] add typechecking and linting for json codegen package --- .github/workflows/lint_0.yml | 38 ++ .github/workflows/test_0.yml | 580 +++++++++--------- .github/workflows/test_1.yml | 336 ++++++++++ .pylintrc | 2 +- .../opentelemetry/codegen/json/generator.py | 13 +- .../src/opentelemetry/codegen/json/plugin.py | 5 +- .../codegen/json/runtime/json_codec.py | 26 +- .../src/opentelemetry/codegen/json/types.py | 35 +- .../src/opentelemetry/codegen/json/writer.py | 1 + .../tests/conftest.py | 31 +- ..._otlp_json_utils.py => test_json_codec.py} | 10 +- .../tests/test_protobuf_compatibility.py | 35 +- .../tests/{test_serdes.py => test_serde.py} | 36 +- .../tests/test_types.py | 5 +- .../tests/test_writer.py | 5 +- .../opentelemetry/proto_json/_json_codec.py | 11 +- pyproject.toml | 1 + tox.ini | 11 + 18 files changed, 802 insertions(+), 379 deletions(-) rename codegen/opentelemetry-codegen-json/tests/{test_otlp_json_utils.py => test_json_codec.py} (95%) rename codegen/opentelemetry-codegen-json/tests/{test_serdes.py => test_serde.py} (91%) diff --git a/.github/workflows/lint_0.yml b/.github/workflows/lint_0.yml index a356157aec2..063d3806c3b 100644 --- a/.github/workflows/lint_0.yml +++ b/.github/workflows/lint_0.yml @@ -70,6 +70,44 @@ jobs: - name: Run tests run: tox -e lint-opentelemetry-proto-gen-latest + lint-opentelemetry-protojson-gen-latest: + name: opentelemetry-protojson-gen-latest + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e lint-opentelemetry-protojson-gen-latest + + lint-opentelemetry-codegen-json: + name: opentelemetry-codegen-json + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e lint-opentelemetry-codegen-json + lint-opentelemetry-sdk: name: opentelemetry-sdk runs-on: ubuntu-latest diff --git a/.github/workflows/test_0.yml b/.github/workflows/test_0.yml index 301f70c9d3c..3c925712790 100644 --- a/.github/workflows/test_0.yml +++ b/.github/workflows/test_0.yml @@ -797,6 +797,158 @@ jobs: - name: Run tests run: tox -e pypy3-test-opentelemetry-protojson-gen-latest -- -ra + py39-test-opentelemetry-codegen-json_ubuntu-latest: + name: opentelemetry-codegen-json 3.9 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-codegen-json -- -ra + + py310-test-opentelemetry-codegen-json_ubuntu-latest: + name: opentelemetry-codegen-json 3.10 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-codegen-json -- -ra + + py311-test-opentelemetry-codegen-json_ubuntu-latest: + name: opentelemetry-codegen-json 3.11 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-codegen-json -- -ra + + py312-test-opentelemetry-codegen-json_ubuntu-latest: + name: opentelemetry-codegen-json 3.12 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-codegen-json -- -ra + + py313-test-opentelemetry-codegen-json_ubuntu-latest: + name: opentelemetry-codegen-json 3.13 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-codegen-json -- -ra + + py314-test-opentelemetry-codegen-json_ubuntu-latest: + name: opentelemetry-codegen-json 3.14 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314-test-opentelemetry-codegen-json -- -ra + + py314t-test-opentelemetry-codegen-json_ubuntu-latest: + name: opentelemetry-codegen-json 3.14t Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14t + uses: actions/setup-python@v5 + with: + python-version: "3.14t" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314t-test-opentelemetry-codegen-json -- -ra + + pypy3-test-opentelemetry-codegen-json_ubuntu-latest: + name: opentelemetry-codegen-json pypy-3.9 Ubuntu + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.9 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e pypy3-test-opentelemetry-codegen-json -- -ra + py39-test-opentelemetry-sdk_ubuntu-latest: name: opentelemetry-sdk 3.9 Ubuntu runs-on: ubuntu-latest @@ -4187,8 +4339,8 @@ jobs: - name: Run tests run: tox -e pypy3-test-opentelemetry-protojson-gen-latest -- -ra - py39-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.9 Windows + py39-test-opentelemetry-codegen-json_windows-latest: + name: opentelemetry-codegen-json 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4206,10 +4358,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-sdk -- -ra + run: tox -e py39-test-opentelemetry-codegen-json -- -ra - py310-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.10 Windows + py310-test-opentelemetry-codegen-json_windows-latest: + name: opentelemetry-codegen-json 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4227,10 +4379,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-sdk -- -ra + run: tox -e py310-test-opentelemetry-codegen-json -- -ra - py311-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.11 Windows + py311-test-opentelemetry-codegen-json_windows-latest: + name: opentelemetry-codegen-json 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4248,10 +4400,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-sdk -- -ra + run: tox -e py311-test-opentelemetry-codegen-json -- -ra - py312-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.12 Windows + py312-test-opentelemetry-codegen-json_windows-latest: + name: opentelemetry-codegen-json 3.12 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4269,10 +4421,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-sdk -- -ra + run: tox -e py312-test-opentelemetry-codegen-json -- -ra - py313-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.13 Windows + py313-test-opentelemetry-codegen-json_windows-latest: + name: opentelemetry-codegen-json 3.13 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4290,10 +4442,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-sdk -- -ra + run: tox -e py313-test-opentelemetry-codegen-json -- -ra - py314-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.14 Windows + py314-test-opentelemetry-codegen-json_windows-latest: + name: opentelemetry-codegen-json 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4311,10 +4463,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py314-test-opentelemetry-sdk -- -ra + run: tox -e py314-test-opentelemetry-codegen-json -- -ra - py314t-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk 3.14t Windows + py314t-test-opentelemetry-codegen-json_windows-latest: + name: opentelemetry-codegen-json 3.14t Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4332,10 +4484,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py314t-test-opentelemetry-sdk -- -ra + run: tox -e py314t-test-opentelemetry-codegen-json -- -ra - pypy3-test-opentelemetry-sdk_windows-latest: - name: opentelemetry-sdk pypy-3.9 Windows + pypy3-test-opentelemetry-codegen-json_windows-latest: + name: opentelemetry-codegen-json pypy-3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4353,10 +4505,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e pypy3-test-opentelemetry-sdk -- -ra + run: tox -e pypy3-test-opentelemetry-codegen-json -- -ra - py39-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.9 Windows + py39-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4374,10 +4526,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-semantic-conventions -- -ra + run: tox -e py39-test-opentelemetry-sdk -- -ra - py310-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.10 Windows + py310-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4395,10 +4547,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-semantic-conventions -- -ra + run: tox -e py310-test-opentelemetry-sdk -- -ra - py311-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.11 Windows + py311-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4416,10 +4568,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-semantic-conventions -- -ra + run: tox -e py311-test-opentelemetry-sdk -- -ra - py312-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.12 Windows + py312-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.12 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4437,10 +4589,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-semantic-conventions -- -ra + run: tox -e py312-test-opentelemetry-sdk -- -ra - py313-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.13 Windows + py313-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.13 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4458,10 +4610,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-semantic-conventions -- -ra + run: tox -e py313-test-opentelemetry-sdk -- -ra - py314-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.14 Windows + py314-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4479,10 +4631,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py314-test-opentelemetry-semantic-conventions -- -ra + run: tox -e py314-test-opentelemetry-sdk -- -ra - py314t-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions 3.14t Windows + py314t-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk 3.14t Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4500,10 +4652,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py314t-test-opentelemetry-semantic-conventions -- -ra + run: tox -e py314t-test-opentelemetry-sdk -- -ra - pypy3-test-opentelemetry-semantic-conventions_windows-latest: - name: opentelemetry-semantic-conventions pypy-3.9 Windows + pypy3-test-opentelemetry-sdk_windows-latest: + name: opentelemetry-sdk pypy-3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4521,10 +4673,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e pypy3-test-opentelemetry-semantic-conventions -- -ra + run: tox -e pypy3-test-opentelemetry-sdk -- -ra - py39-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.9 Windows + py39-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4533,13 +4685,6 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - name: Set up Python 3.9 uses: actions/setup-python@v5 with: @@ -4549,10 +4694,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-getting-started -- -ra + run: tox -e py39-test-opentelemetry-semantic-conventions -- -ra - py310-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.10 Windows + py310-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4561,13 +4706,6 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - name: Set up Python 3.10 uses: actions/setup-python@v5 with: @@ -4577,10 +4715,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-getting-started -- -ra + run: tox -e py310-test-opentelemetry-semantic-conventions -- -ra - py311-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.11 Windows + py311-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4589,13 +4727,6 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - name: Set up Python 3.11 uses: actions/setup-python@v5 with: @@ -4605,10 +4736,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-getting-started -- -ra + run: tox -e py311-test-opentelemetry-semantic-conventions -- -ra - py312-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.12 Windows + py312-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.12 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4617,13 +4748,6 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - name: Set up Python 3.12 uses: actions/setup-python@v5 with: @@ -4633,10 +4757,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-getting-started -- -ra + run: tox -e py312-test-opentelemetry-semantic-conventions -- -ra - py313-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.13 Windows + py313-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.13 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4645,13 +4769,6 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - name: Set up Python 3.13 uses: actions/setup-python@v5 with: @@ -4661,10 +4778,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-getting-started -- -ra + run: tox -e py313-test-opentelemetry-semantic-conventions -- -ra - py314-test-opentelemetry-getting-started_windows-latest: - name: opentelemetry-getting-started 3.14 Windows + py314-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4673,13 +4790,6 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} - uses: actions/checkout@v4 - with: - repository: open-telemetry/opentelemetry-python-contrib - ref: ${{ env.CONTRIB_REPO_SHA }} - path: opentelemetry-python-contrib - - name: Set up Python 3.14 uses: actions/setup-python@v5 with: @@ -4689,10 +4799,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py314-test-opentelemetry-getting-started -- -ra + run: tox -e py314-test-opentelemetry-semantic-conventions -- -ra - py39-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.9 Windows + py314t-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions 3.14t Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4701,19 +4811,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.9 + - name: Set up Python 3.14t uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.14t" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py39-test-opentelemetry-opentracing-shim -- -ra + run: tox -e py314t-test-opentelemetry-semantic-conventions -- -ra - py310-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.10 Windows + pypy3-test-opentelemetry-semantic-conventions_windows-latest: + name: opentelemetry-semantic-conventions pypy-3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4722,19 +4832,19 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python pypy-3.9 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "pypy-3.9" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-opentracing-shim -- -ra + run: tox -e pypy3-test-opentelemetry-semantic-conventions -- -ra - py311-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.11 Windows + py39-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.9 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4743,61 +4853,26 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py311-test-opentelemetry-opentracing-shim -- -ra - - py312-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.12 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 with: - python-version: "3.12" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py312-test-opentelemetry-opentracing-shim -- -ra - - py313-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.13 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib - - name: Set up Python 3.13 + - name: Set up Python 3.9 uses: actions/setup-python@v5 with: - python-version: "3.13" + python-version: "3.9" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-opentracing-shim -- -ra + run: tox -e py39-test-opentelemetry-getting-started -- -ra - py314-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.14 Windows + py310-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.10 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4806,61 +4881,26 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.14 - uses: actions/setup-python@v5 - with: - python-version: "3.14" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py314-test-opentelemetry-opentracing-shim -- -ra - - py314t-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.14t Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} uses: actions/checkout@v4 - - - name: Set up Python 3.14t - uses: actions/setup-python@v5 with: - python-version: "3.14t" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py314t-test-opentelemetry-opentracing-shim -- -ra - - pypy3-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim pypy-3.9 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib - - name: Set up Python pypy-3.9 + - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: "pypy-3.9" + python-version: "3.10" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e pypy3-test-opentelemetry-opentracing-shim -- -ra + run: tox -e py310-test-opentelemetry-getting-started -- -ra - py39-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.9 Windows + py311-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.11 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4869,47 +4909,12 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-opentelemetry-opencensus-shim -- -ra - - py310-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.10 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 with: - python-version: "3.10" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py310-test-opentelemetry-opencensus-shim -- -ra - - py311-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.11 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib - name: Set up Python 3.11 uses: actions/setup-python@v5 @@ -4920,10 +4925,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py311-test-opentelemetry-opencensus-shim -- -ra + run: tox -e py311-test-opentelemetry-getting-started -- -ra - py312-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.12 Windows + py312-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.12 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4932,6 +4937,13 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: @@ -4941,10 +4953,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py312-test-opentelemetry-opencensus-shim -- -ra + run: tox -e py312-test-opentelemetry-getting-started -- -ra - py313-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.13 Windows + py313-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.13 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4953,6 +4965,13 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib + - name: Set up Python 3.13 uses: actions/setup-python@v5 with: @@ -4962,10 +4981,10 @@ jobs: run: pip install tox-uv - name: Run tests - run: tox -e py313-test-opentelemetry-opencensus-shim -- -ra + run: tox -e py313-test-opentelemetry-getting-started -- -ra - py314-test-opentelemetry-opencensus-shim_windows-latest: - name: opentelemetry-opencensus-shim 3.14 Windows + py314-test-opentelemetry-getting-started_windows-latest: + name: opentelemetry-getting-started 3.14 Windows runs-on: windows-latest timeout-minutes: 30 steps: @@ -4974,55 +4993,20 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 - - name: Set up Python 3.14 - uses: actions/setup-python@v5 - with: - python-version: "3.14" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py314-test-opentelemetry-opencensus-shim -- -ra - - py39-test-opentelemetry-exporter-opencensus_windows-latest: - name: opentelemetry-exporter-opencensus 3.9 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} + - name: Checkout contrib repo @ ${{ env.CONTRIB_REPO_SHA }} uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-opentelemetry-exporter-opencensus -- -ra - - py310-test-opentelemetry-exporter-opencensus_windows-latest: - name: opentelemetry-exporter-opencensus 3.10 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + path: opentelemetry-python-contrib - - name: Set up Python 3.10 + - name: Set up Python 3.14 uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: "3.14" - name: Install tox run: pip install tox-uv - name: Run tests - run: tox -e py310-test-opentelemetry-exporter-opencensus -- -ra + run: tox -e py314-test-opentelemetry-getting-started -- -ra diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index 612ef7f8fae..bdf60184d8b 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -37,6 +37,342 @@ env: jobs: + py39-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-opentracing-shim -- -ra + + py310-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.10 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-opentracing-shim -- -ra + + py311-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.11 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-opentracing-shim -- -ra + + py312-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.12 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-opentracing-shim -- -ra + + py313-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.13 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-opentracing-shim -- -ra + + py314-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.14 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314-test-opentelemetry-opentracing-shim -- -ra + + py314t-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.14t Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14t + uses: actions/setup-python@v5 + with: + python-version: "3.14t" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314t-test-opentelemetry-opentracing-shim -- -ra + + pypy3-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim pypy-3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python pypy-3.9 + uses: actions/setup-python@v5 + with: + python-version: "pypy-3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e pypy3-test-opentelemetry-opentracing-shim -- -ra + + py39-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-opencensus-shim -- -ra + + py310-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.10 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-opencensus-shim -- -ra + + py311-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.11 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-opencensus-shim -- -ra + + py312-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.12 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-opencensus-shim -- -ra + + py313-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.13 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.13 + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py313-test-opentelemetry-opencensus-shim -- -ra + + py314-test-opentelemetry-opencensus-shim_windows-latest: + name: opentelemetry-opencensus-shim 3.14 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.14 + uses: actions/setup-python@v5 + with: + python-version: "3.14" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py314-test-opentelemetry-opencensus-shim -- -ra + + py39-test-opentelemetry-exporter-opencensus_windows-latest: + name: opentelemetry-exporter-opencensus 3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-exporter-opencensus -- -ra + + py310-test-opentelemetry-exporter-opencensus_windows-latest: + name: opentelemetry-exporter-opencensus 3.10 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-exporter-opencensus -- -ra + py311-test-opentelemetry-exporter-opencensus_windows-latest: name: opentelemetry-exporter-opencensus 3.11 Windows runs-on: windows-latest diff --git a/.pylintrc b/.pylintrc index 8d60670082b..df65d4d501a 100644 --- a/.pylintrc +++ b/.pylintrc @@ -7,7 +7,7 @@ extension-pkg-whitelist= # Add list of files or directories to be excluded. They should be base names, not # paths. -ignore=CVS,gen,proto +ignore=CVS,gen,proto,proto_json # Add files or directories matching the regex patterns to be excluded. The # regex matches against base names, not paths. diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py index 52f63044a8b..b05cefd46f5 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: disable=no-member,invalid-name,too-many-lines + from __future__ import annotations import logging @@ -292,8 +294,9 @@ def _msg_has_enums(self, msg_desc: descriptor.DescriptorProto) -> bool: return True return False + @classmethod def _generate_header( - self, writer: CodeWriter, proto_file: str = "" + cls, writer: CodeWriter, proto_file: str = "" ) -> None: """ Generate file header with license and metadata. @@ -487,8 +490,9 @@ def _generate_message_class( writer, proto_file, msg_desc, current_path ) + @classmethod def _generate_enum_class( - self, writer: CodeWriter, enum_desc: descriptor.EnumDescriptorProto + cls, writer: CodeWriter, enum_desc: descriptor.EnumDescriptorProto ) -> None: """ Generate an IntEnum class for a protobuf enum. @@ -725,6 +729,7 @@ def _generate_serialization_statements( ) writer.assignment(f'{target_dict}["{json_name}"]', val_expr) + # pylint: disable-next=too-many-return-statements def _get_serialization_expr( self, field_desc: descriptor.FieldDescriptorProto, var_name: str ) -> str: @@ -834,6 +839,7 @@ def _generate_deserialization_statements( ) writer.assignment(f'{target_dict}["{field_desc.name}"]', var_name) + # pylint: disable-next=too-many-return-statements def _get_deserialization_expr( self, proto_file: str, @@ -960,8 +966,9 @@ def _resolve_enum_type(self, type_name: str, proto_file: str) -> str: module_path = self._get_module_path(target_file) return f"{module_path}.{class_path}" + @classmethod def _get_field_default( - self, field_desc: descriptor.FieldDescriptorProto + cls, field_desc: descriptor.FieldDescriptorProto ) -> Optional[str]: """ Get the default value for a field. diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/plugin.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/plugin.py index 0299be6afff..ce9e8b8a30d 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/plugin.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/plugin.py @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: disable=no-member + import logging import sys from collections.abc import Iterator from contextlib import contextmanager -from typing import Tuple from google.protobuf.compiler import plugin_pb2 as plugin @@ -28,7 +29,7 @@ @contextmanager def code_generation() -> Iterator[ - Tuple[plugin.CodeGeneratorRequest, plugin.CodeGeneratorResponse], + tuple[plugin.CodeGeneratorRequest, plugin.CodeGeneratorResponse], ]: """ Context manager for handling the code generation process. diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py index 4cfc6e23d47..5e9ec97cec5 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py @@ -31,23 +31,23 @@ def to_json(self: typing.Any) -> str: """ Serialize this message to a JSON string. """ - return json.dumps(self.to_dict()) + # pylint: disable-next=no-member + return json.dumps(self.to_dict()) # type: ignore @classmethod - def from_json( - cls_inner: type[T], data: typing.Union[str, bytes] - ) -> T: + def from_json(cls_inner: type[T], data: typing.Union[str, bytes]) -> T: """ Deserialize from a JSON string or bytes. """ - return cls_inner.from_dict(json.loads(data)) + # pylint: disable-next=no-member + return cls_inner.from_dict(json.loads(data)) # type: ignore cls.to_json = to_json # type: ignore[attr-defined] cls.from_json = from_json # type: ignore[attr-defined] return cls -def encode_hex(value: bytes) -> str: +def encode_hex(value: typing.Optional[bytes]) -> str: """ Encode bytes as hex string. @@ -59,7 +59,7 @@ def encode_hex(value: bytes) -> str: return value.hex() if value else "" -def encode_base64(value: bytes) -> str: +def encode_base64(value: typing.Optional[bytes]) -> str: """ Encode bytes as base64 string. Standard Proto3 JSON mapping for bytes. @@ -102,8 +102,8 @@ def encode_float(value: float) -> typing.Union[float, str]: def encode_repeated( - values: typing.Optional[list[typing.Any]], - map_fn: typing.Callable[[typing.Any], typing.Any], + values: typing.Optional[list[T]], + map_fn: typing.Callable[[T], typing.Any], ) -> list[typing.Any]: """ Helper to serialize repeated fields with a mapping function. @@ -132,9 +132,9 @@ def decode_hex(value: typing.Optional[str], field_name: str) -> bytes: validate_type(value, str, field_name) try: return bytes.fromhex(value) - except ValueError as e: + except ValueError as error: raise ValueError( - f"Invalid hex string for field '{field_name}': {e}" + f"Invalid hex string for field '{field_name}': {error}" ) from None @@ -153,9 +153,9 @@ def decode_base64(value: typing.Optional[str], field_name: str) -> bytes: validate_type(value, str, field_name) try: return base64.b64decode(value) - except Exception as e: + except Exception as error: raise ValueError( - f"Invalid base64 string for field '{field_name}': {e}" + f"Invalid base64 string for field '{field_name}': {error}" ) from None diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/types.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/types.py index 93d9132f77e..5424d279784 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/types.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/types.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: disable=no-member + from typing import Final from google.protobuf import descriptor_pb2 as descriptor @@ -60,6 +62,17 @@ descriptor.FieldDescriptorProto.TYPE_SINT64, } +NUMERIC_TYPES: Final[set[int]] = { + *INT64_TYPES, + descriptor.FieldDescriptorProto.TYPE_DOUBLE, + descriptor.FieldDescriptorProto.TYPE_FLOAT, + descriptor.FieldDescriptorProto.TYPE_INT32, + descriptor.FieldDescriptorProto.TYPE_FIXED32, + descriptor.FieldDescriptorProto.TYPE_UINT32, + descriptor.FieldDescriptorProto.TYPE_SFIXED32, + descriptor.FieldDescriptorProto.TYPE_SINT32, +} + HEX_ENCODED_FIELDS: Final[set[str]] = { "trace_id", "span_id", @@ -76,7 +89,9 @@ def get_python_type(proto_type: int) -> str: Returns: A string representing the Python type """ - return PROTO_TO_PYTHON.get(proto_type, "typing.Any") + if proto_type not in PROTO_TO_PYTHON: + raise ValueError(f"Unknown protobuf type: {proto_type}") + return PROTO_TO_PYTHON[proto_type] def get_default_value(proto_type: int) -> str: @@ -134,7 +149,7 @@ def to_json_field_name(snake_name: str) -> str: Args: snake_name: The field name in snake_case. Returns: - The field name converted to camelCase.k + The field name converted to camelCase. """ components = snake_name.split("_") return components[0] + "".join(x.title() for x in components[1:]) @@ -149,17 +164,7 @@ def is_numeric_type(proto_type: int) -> bool: Returns: True if the type is a numeric type, False otherwise. """ - if proto_type in INT64_TYPES: - return True - return proto_type in { - descriptor.FieldDescriptorProto.TYPE_DOUBLE, - descriptor.FieldDescriptorProto.TYPE_FLOAT, - descriptor.FieldDescriptorProto.TYPE_INT32, - descriptor.FieldDescriptorProto.TYPE_FIXED32, - descriptor.FieldDescriptorProto.TYPE_UINT32, - descriptor.FieldDescriptorProto.TYPE_SFIXED32, - descriptor.FieldDescriptorProto.TYPE_SINT32, - } + return proto_type in NUMERIC_TYPES def get_json_allowed_types(proto_type: int, field_name: str = "") -> str: @@ -184,6 +189,4 @@ def get_json_allowed_types(proto_type: int, field_name: str = "") -> str: descriptor.FieldDescriptorProto.TYPE_DOUBLE, ): return "(builtins.float, builtins.int, builtins.str)" - - py_type = get_python_type(proto_type) - return py_type + return get_python_type(proto_type) diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py index 1c626d567df..687de172d5b 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/writer.py @@ -19,6 +19,7 @@ from typing import Any, Generator, Optional, Union +# pylint: disable-next=too-many-public-methods class CodeWriter: def __init__(self, indent_size: int = 4) -> None: """ diff --git a/codegen/opentelemetry-codegen-json/tests/conftest.py b/codegen/opentelemetry-codegen-json/tests/conftest.py index 4443caff6e6..cf381a001db 100644 --- a/codegen/opentelemetry-codegen-json/tests/conftest.py +++ b/codegen/opentelemetry-codegen-json/tests/conftest.py @@ -1,15 +1,40 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# pylint: disable=redefined-outer-name + import subprocess import sys from pathlib import Path -import pytest +import pytest # type: ignore +from _pytest.monkeypatch import MonkeyPatch # type: ignore PROTO_PATH = Path(__file__).parent / "proto" GEN_PATH = Path(__file__).parent / "generated" +@pytest.fixture(scope="session") +def monkeysession(): + with pytest.MonkeyPatch.context() as mp: + yield mp + + @pytest.fixture(scope="session", autouse=True) -def generate_code(tmp_path_factory: pytest.TempPathFactory) -> None: +def generate_code( + tmp_path_factory: pytest.TempPathFactory, monkeysession: MonkeyPatch +) -> None: gen_path = tmp_path_factory.mktemp("generated") protos = list(PROTO_PATH.glob("**/*.proto")) @@ -27,4 +52,4 @@ def generate_code(tmp_path_factory: pytest.TempPathFactory) -> None: ] ) - sys.path.insert(0, str(gen_path.absolute())) + monkeysession.syspath_prepend(gen_path.absolute()) diff --git a/codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py b/codegen/opentelemetry-codegen-json/tests/test_json_codec.py similarity index 95% rename from codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py rename to codegen/opentelemetry-codegen-json/tests/test_json_codec.py index b539752977e..3cfa07b764d 100644 --- a/codegen/opentelemetry-codegen-json/tests/test_otlp_json_utils.py +++ b/codegen/opentelemetry-codegen-json/tests/test_json_codec.py @@ -15,7 +15,7 @@ import math from typing import Optional, Union -import pytest +import pytest # type: ignore from opentelemetry.codegen.json.runtime.json_codec import ( decode_base64, @@ -172,12 +172,12 @@ def test_decode_float_errors() -> None: def test_repeated_fields() -> None: values = [1, 2, 3] assert encode_repeated(values, str) == ["1", "2", "3"] - assert encode_repeated([], str) == [] - assert encode_repeated(None, str) == [] # type: ignore + assert not encode_repeated([], str) + assert not encode_repeated(None, str) assert decode_repeated(["1", "2"], int, "field") == [1, 2] - assert decode_repeated([], int, "field") == [] - assert decode_repeated(None, int, "field") == [] + assert not decode_repeated([], int, "field") + assert not decode_repeated(None, int, "field") def test_decode_repeated_errors() -> None: diff --git a/codegen/opentelemetry-codegen-json/tests/test_protobuf_compatibility.py b/codegen/opentelemetry-codegen-json/tests/test_protobuf_compatibility.py index 66224116018..19f30be795e 100644 --- a/codegen/opentelemetry-codegen-json/tests/test_protobuf_compatibility.py +++ b/codegen/opentelemetry-codegen-json/tests/test_protobuf_compatibility.py @@ -12,12 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: skip-file # ruff: noqa: PLC0415 import base64 from typing import Any, Type -import pytest +import pytest # type: ignore from google.protobuf import json_format @@ -39,18 +40,26 @@ def normalize_otlp_json(data: Any) -> Any: @pytest.fixture def test_msg_classes() -> tuple[Type[Any], Type[Any], Type[Any]]: - from otel_test_json.test.v1.test import SubMessage as JSONSubMessage - from otel_test_json.test.v1.test import TestMessage as JSONTestMessage - from otel_test_json.test.v1.test_pb2 import TestMessage as ProtoTestMessage + from otel_test_json.test.v1.test import ( # type: ignore + SubMessage as JSONSubMessage, # type: ignore + ) + from otel_test_json.test.v1.test import ( # type: ignore + TestMessage as JSONTestMessage, # type: ignore + ) + from otel_test_json.test.v1.test_pb2 import ( # type: ignore + TestMessage as ProtoTestMessage, # type: ignore + ) return JSONTestMessage, JSONSubMessage, ProtoTestMessage @pytest.fixture def numeric_msg_classes() -> tuple[Type[Any], Type[Any]]: - from otel_test_json.test.v1.complex import NumericTest as JSONNumericTest - from otel_test_json.test.v1.complex_pb2 import ( - NumericTest as ProtoNumericTest, + from otel_test_json.test.v1.complex import ( # type: ignore + NumericTest as JSONNumericTest, # type: ignore + ) + from otel_test_json.test.v1.complex_pb2 import ( # type: ignore + NumericTest as ProtoNumericTest, # type: ignore ) return JSONNumericTest, ProtoNumericTest @@ -58,11 +67,13 @@ def numeric_msg_classes() -> tuple[Type[Any], Type[Any]]: @pytest.fixture def oneof_msg_classes() -> tuple[Type[Any], Type[Any], Type[Any]]: - from otel_test_json.common.v1.common import ( + from otel_test_json.common.v1.common import ( # type: ignore InstrumentationScope as JSONScope, ) - from otel_test_json.test.v1.complex import OneofSuite as JSONOneofSuite - from otel_test_json.test.v1.complex_pb2 import ( + from otel_test_json.test.v1.complex import ( # type: ignore + OneofSuite as JSONOneofSuite, # type: ignore + ) + from otel_test_json.test.v1.complex_pb2 import ( # type: ignore OneofSuite as ProtoOneofSuite, ) @@ -71,10 +82,10 @@ def oneof_msg_classes() -> tuple[Type[Any], Type[Any], Type[Any]]: @pytest.fixture def optional_msg_classes() -> tuple[Type[Any], Type[Any]]: - from otel_test_json.test.v1.complex import ( + from otel_test_json.test.v1.complex import ( # type: ignore OptionalScalar as JSONOptionalScalar, ) - from otel_test_json.test.v1.complex_pb2 import ( + from otel_test_json.test.v1.complex_pb2 import ( # type: ignore OptionalScalar as ProtoOptionalScalar, ) diff --git a/codegen/opentelemetry-codegen-json/tests/test_serdes.py b/codegen/opentelemetry-codegen-json/tests/test_serde.py similarity index 91% rename from codegen/opentelemetry-codegen-json/tests/test_serdes.py rename to codegen/opentelemetry-codegen-json/tests/test_serde.py index 49da1617389..67db5366196 100644 --- a/codegen/opentelemetry-codegen-json/tests/test_serdes.py +++ b/codegen/opentelemetry-codegen-json/tests/test_serde.py @@ -12,32 +12,38 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: skip-file # ruff: noqa: PLC0415 import json import math from typing import Any, Type -import pytest +import pytest # type: ignore @pytest.fixture def test_v1_types() -> tuple[Type[Any], Type[Any]]: - from otel_test_json.test.v1.test import SubMessage, TestMessage + from otel_test_json.test.v1.test import ( # type: ignore + SubMessage, + TestMessage, + ) return TestMessage, SubMessage @pytest.fixture def common_v1_types() -> Type[Any]: - from otel_test_json.common.v1.common import InstrumentationScope + from otel_test_json.common.v1.common import ( # type: ignore + InstrumentationScope, # type: ignore + ) return InstrumentationScope @pytest.fixture def trace_v1_types() -> Type[Any]: - from otel_test_json.trace.v1.trace import Span + from otel_test_json.trace.v1.trace import Span # type: ignore return Span @@ -46,7 +52,7 @@ def trace_v1_types() -> Type[Any]: def complex_v1_types() -> tuple[ Type[Any], Type[Any], Type[Any], Type[Any], Type[Any] ]: - from otel_test_json.test.v1.complex import ( + from otel_test_json.test.v1.complex import ( # type: ignore DeeplyNested, NestedEnumSuite, NumericTest, @@ -111,7 +117,7 @@ def test_generated_message_roundtrip( def test_cross_reference( - common_v1_types: Type[Any], trace_v1_types: Type[Any] + common_v1_types: type[Any], trace_v1_types: type[Any] ) -> None: InstrumentationScope = common_v1_types Span = trace_v1_types @@ -155,7 +161,7 @@ def test_cross_reference( ], ) def test_numeric_types( - complex_v1_types: tuple[Type[Any], ...], + complex_v1_types: tuple[type[Any], ...], field: str, value: Any, expected_json_val: Any, @@ -191,8 +197,8 @@ def test_numeric_types( ], ) def test_oneof_suite_variants( - common_v1_types: Type[Any], - complex_v1_types: tuple[Type[Any], ...], + common_v1_types: type[Any], + complex_v1_types: tuple[type[Any], ...], kwargs: dict[str, Any], expected_data: dict[str, Any], ) -> None: @@ -230,7 +236,7 @@ def test_oneof_suite_variants( ], ) def test_optional_scalars( - complex_v1_types: tuple[Type[Any], ...], + complex_v1_types: tuple[type[Any], ...], kwargs: dict[str, Any], expected_dict: dict[str, Any], ) -> None: @@ -241,7 +247,7 @@ def test_optional_scalars( assert OptionalScalar.from_dict(expected_dict) == msg -def test_nested_enum_suite(complex_v1_types: tuple[Type[Any], ...]) -> None: +def test_nested_enum_suite(complex_v1_types: tuple[type[Any], ...]) -> None: NestedEnumSuite = complex_v1_types[3] msg = NestedEnumSuite( @@ -261,7 +267,7 @@ def test_nested_enum_suite(complex_v1_types: tuple[Type[Any], ...]) -> None: assert new_msg.repeated_nested == msg.repeated_nested -def test_deeply_nested(complex_v1_types: tuple[Type[Any], ...]) -> None: +def test_deeply_nested(complex_v1_types: tuple[type[Any], ...]) -> None: DeeplyNested = complex_v1_types[4] msg = DeeplyNested( @@ -289,7 +295,7 @@ def test_deeply_nested(complex_v1_types: tuple[Type[Any], ...]) -> None: ], ) def test_defaults_and_none( - test_v1_types: tuple[Type[Any], Type[Any]], + test_v1_types: tuple[type[Any], type[Any]], data: dict[str, Any], expected_name: str, expected_int: int, @@ -314,7 +320,7 @@ def test_defaults_and_none( ], ) def test_validation_errors( - test_v1_types: tuple[Type[Any], Type[Any]], + test_v1_types: tuple[type[Any], type[Any]], data: dict[str, Any], expected_error: type, match: str, @@ -329,7 +335,7 @@ def test_validation_errors( def test_unknown_fields_ignored( - test_v1_types: tuple[Type[Any], Type[Any]], + test_v1_types: tuple[type[Any], type[Any]], ) -> None: TestMessage, _ = test_v1_types diff --git a/codegen/opentelemetry-codegen-json/tests/test_types.py b/codegen/opentelemetry-codegen-json/tests/test_types.py index bed82b0f59a..6524bd3b3d2 100644 --- a/codegen/opentelemetry-codegen-json/tests/test_types.py +++ b/codegen/opentelemetry-codegen-json/tests/test_types.py @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pytest +# pylint: disable=no-member + +import pytest # type: ignore from google.protobuf import descriptor_pb2 as descriptor from opentelemetry.codegen.json.types import ( @@ -35,7 +37,6 @@ (descriptor.FieldDescriptorProto.TYPE_BOOL, "builtins.bool"), (descriptor.FieldDescriptorProto.TYPE_STRING, "builtins.str"), (descriptor.FieldDescriptorProto.TYPE_BYTES, "builtins.bytes"), - (999, "typing.Any"), ], ) def test_get_python_type(proto_type: int, expected: str) -> None: diff --git a/codegen/opentelemetry-codegen-json/tests/test_writer.py b/codegen/opentelemetry-codegen-json/tests/test_writer.py index 196a33b8ef0..e9565e55dec 100644 --- a/codegen/opentelemetry-codegen-json/tests/test_writer.py +++ b/codegen/opentelemetry-codegen-json/tests/test_writer.py @@ -13,15 +13,16 @@ # limitations under the License. from typing import Any, Optional -import pytest +import pytest # type: ignore from opentelemetry.codegen.json.writer import CodeWriter def test_initialization() -> None: writer = CodeWriter(indent_size=2) + # pylint: disable-next=protected-access assert writer._indent_size == 2 - assert writer.to_lines() == [] + assert not writer.to_lines() assert writer.to_string() == "" diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py index beb7540904d..c4cb1537758 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py @@ -25,19 +25,16 @@ def json_serde(cls: type[T]) -> type[T]: """ A decorator that adds "to_json" and "from_json" methods to a class. - The class must already have to_dict and from_dict methods. """ - def to_json(self: typing.Any) -> str: + def to_json(self: T) -> str: """ Serialize this message to a JSON string. """ return json.dumps(self.to_dict()) @classmethod - def from_json( - cls_inner: type[T], data: typing.Union[str, bytes] - ) -> T: + def from_json(cls_inner: type[T], data: typing.Union[str, bytes]) -> T: """ Deserialize from a JSON string or bytes. """ @@ -103,8 +100,8 @@ def encode_float(value: float) -> typing.Union[float, str]: def encode_repeated( - values: typing.Optional[list[typing.Any]], - map_fn: typing.Callable[[typing.Any], typing.Any], + values: typing.Optional[list[T]], + map_fn: typing.Callable[[T], typing.Any], ) -> list[typing.Any]: """ Helper to serialize repeated fields with a mapping function. diff --git a/pyproject.toml b/pyproject.toml index 4c30d56435c..a7228320562 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,6 +114,7 @@ include = [ "opentelemetry-api", "opentelemetry-sdk", "exporter/opentelemetry-exporter-otlp-proto-grpc", + "codegen/opentelemetry-codegen-json" ] exclude = [ diff --git a/tox.ini b/tox.ini index da6619b7034..d3cb9823b23 100644 --- a/tox.ini +++ b/tox.ini @@ -18,6 +18,11 @@ envlist = py3{9,10,11,12,13,14,14t}-test-opentelemetry-protojson-gen-{oldest,latest} pypy3-test-opentelemetry-protojson-gen-{oldest,latest} + lint-opentelemetry-protojson-gen-latest + + py3{9,10,11,12,13,14,14t}-test-opentelemetry-codegen-json + pypy3-test-opentelemetry-codegen-json + lint-opentelemetry-codegen-json py3{9,10,11,12,13,14,14t}-test-opentelemetry-sdk pypy3-test-opentelemetry-sdk @@ -109,6 +114,8 @@ deps = api: -r {toxinidir}/opentelemetry-api/test-requirements.txt + codegen-json: -r {toxinidir}/codegen/opentelemetry-codegen-json/test-requirements.txt + sdk: -r {toxinidir}/opentelemetry-sdk/test-requirements.txt benchmark-opentelemetry-sdk: -r {toxinidir}/opentelemetry-sdk/benchmark-requirements.txt @@ -181,6 +188,9 @@ commands = test-opentelemetry-api: pytest {toxinidir}/opentelemetry-api/tests {posargs} lint-opentelemetry-api: pylint {toxinidir}/opentelemetry-api + test-opentelemetry-codegen-json: pytest {toxinidir}/codegen/opentelemetry-codegen-json/tests {posargs} + lint-opentelemetry-codegen-json: pylint {toxinidir}/codegen/opentelemetry-codegen-json + test-opentelemetry-sdk: pytest {toxinidir}/opentelemetry-sdk/tests {posargs} lint-opentelemetry-sdk: pylint {toxinidir}/opentelemetry-sdk benchmark-opentelemetry-sdk: pytest {toxinidir}/opentelemetry-sdk/benchmarks --benchmark-json={toxinidir}/opentelemetry-sdk/sdk-benchmark.json {posargs} @@ -378,6 +388,7 @@ deps = -e {toxinidir}/exporter/opentelemetry-exporter-otlp-proto-http -e {toxinidir}/opentelemetry-proto -e {toxinidir}/opentelemetry-proto-json + -e {toxinidir}/codegen/opentelemetry-codegen-json commands = pyright --version From 98e63d39c7e5589bbcf11a5717927be0d5db5846 Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Sat, 7 Mar 2026 23:52:11 -0500 Subject: [PATCH 08/15] update to use 'path.as_posix()' for Windows compatability --- codegen/opentelemetry-codegen-json/tests/conftest.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/codegen/opentelemetry-codegen-json/tests/conftest.py b/codegen/opentelemetry-codegen-json/tests/conftest.py index cf381a001db..3a183090582 100644 --- a/codegen/opentelemetry-codegen-json/tests/conftest.py +++ b/codegen/opentelemetry-codegen-json/tests/conftest.py @@ -38,16 +38,16 @@ def generate_code( gen_path = tmp_path_factory.mktemp("generated") protos = list(PROTO_PATH.glob("**/*.proto")) - proto_files = [str(p.relative_to(PROTO_PATH)) for p in protos] + proto_files = [p.relative_to(PROTO_PATH).as_posix() for p in protos] subprocess.check_call( [ sys.executable, "-m", "grpc_tools.protoc", - f"-I{PROTO_PATH}", - f"--otlp_json_out={gen_path}", - f"--python_out={gen_path}", + f"-I{PROTO_PATH.as_posix()}", + f"--otlp_json_out={gen_path.as_posix()}", + f"--python_out={gen_path.as_posix()}", *proto_files, ] ) From dc73c4cdcdd4a17517b2ef57e2c694c8822d215c Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Sat, 7 Mar 2026 23:56:42 -0500 Subject: [PATCH 09/15] add 'importlib.invalidate_caches()' to generate code fixture --- codegen/opentelemetry-codegen-json/tests/conftest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/codegen/opentelemetry-codegen-json/tests/conftest.py b/codegen/opentelemetry-codegen-json/tests/conftest.py index 3a183090582..d349025bf45 100644 --- a/codegen/opentelemetry-codegen-json/tests/conftest.py +++ b/codegen/opentelemetry-codegen-json/tests/conftest.py @@ -14,6 +14,7 @@ # pylint: disable=redefined-outer-name +import importlib import subprocess import sys from pathlib import Path @@ -52,4 +53,5 @@ def generate_code( ] ) - monkeysession.syspath_prepend(gen_path.absolute()) + monkeysession.syspath_prepend(str(gen_path.absolute())) + importlib.invalidate_caches() From f6c79633018fa4b4533644753a4785e5b6659026 Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Sun, 8 Mar 2026 00:05:29 -0500 Subject: [PATCH 10/15] add USERNAME=runner env var to github workflows for Windows compatability --- .github/workflows/templates/test.yml.j2 | 2 + .github/workflows/test_0.yml | 500 ++++++++++++++++++++++++ .github/workflows/test_1.yml | 220 +++++++++++ 3 files changed, 722 insertions(+) diff --git a/.github/workflows/templates/test.yml.j2 b/.github/workflows/templates/test.yml.j2 index 6b9080a771a..1a2839b8577 100644 --- a/.github/workflows/templates/test.yml.j2 +++ b/.github/workflows/templates/test.yml.j2 @@ -69,5 +69,7 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e {{ job_data.tox_env }} -- -ra {%- endfor %} diff --git a/.github/workflows/test_0.yml b/.github/workflows/test_0.yml index 3c925712790..fa885882afe 100644 --- a/.github/workflows/test_0.yml +++ b/.github/workflows/test_0.yml @@ -54,6 +54,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-api -- -ra py310-test-opentelemetry-api_ubuntu-latest: @@ -73,6 +75,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-api -- -ra py311-test-opentelemetry-api_ubuntu-latest: @@ -92,6 +96,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-api -- -ra py312-test-opentelemetry-api_ubuntu-latest: @@ -111,6 +117,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-api -- -ra py313-test-opentelemetry-api_ubuntu-latest: @@ -130,6 +138,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-api -- -ra py314-test-opentelemetry-api_ubuntu-latest: @@ -149,6 +159,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-api -- -ra py314t-test-opentelemetry-api_ubuntu-latest: @@ -168,6 +180,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-api -- -ra pypy3-test-opentelemetry-api_ubuntu-latest: @@ -187,6 +201,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-api -- -ra py39-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -206,6 +222,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-proto-gen-oldest -- -ra py39-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -225,6 +243,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-proto-gen-latest -- -ra py310-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -244,6 +264,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-proto-gen-oldest -- -ra py310-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -263,6 +285,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-proto-gen-latest -- -ra py311-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -282,6 +306,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-proto-gen-oldest -- -ra py311-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -301,6 +327,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-proto-gen-latest -- -ra py312-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -320,6 +348,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-proto-gen-oldest -- -ra py312-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -339,6 +369,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-proto-gen-latest -- -ra py313-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -358,6 +390,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-proto-gen-oldest -- -ra py313-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -377,6 +411,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-proto-gen-latest -- -ra py314-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -396,6 +432,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-proto-gen-oldest -- -ra py314-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -415,6 +453,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-proto-gen-latest -- -ra py314t-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -434,6 +474,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-proto-gen-oldest -- -ra py314t-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -453,6 +495,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-proto-gen-latest -- -ra pypy3-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -472,6 +516,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-proto-gen-oldest -- -ra pypy3-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -491,6 +537,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-proto-gen-latest -- -ra py39-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -510,6 +558,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-protojson-gen-oldest -- -ra py39-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -529,6 +579,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-protojson-gen-latest -- -ra py310-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -548,6 +600,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-protojson-gen-oldest -- -ra py310-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -567,6 +621,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-protojson-gen-latest -- -ra py311-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -586,6 +642,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-protojson-gen-oldest -- -ra py311-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -605,6 +663,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-protojson-gen-latest -- -ra py312-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -624,6 +684,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-protojson-gen-oldest -- -ra py312-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -643,6 +705,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-protojson-gen-latest -- -ra py313-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -662,6 +726,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-protojson-gen-oldest -- -ra py313-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -681,6 +747,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-protojson-gen-latest -- -ra py314-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -700,6 +768,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-protojson-gen-oldest -- -ra py314-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -719,6 +789,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-protojson-gen-latest -- -ra py314t-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -738,6 +810,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-protojson-gen-oldest -- -ra py314t-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -757,6 +831,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-protojson-gen-latest -- -ra pypy3-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -776,6 +852,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-protojson-gen-oldest -- -ra pypy3-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -795,6 +873,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-protojson-gen-latest -- -ra py39-test-opentelemetry-codegen-json_ubuntu-latest: @@ -814,6 +894,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-codegen-json -- -ra py310-test-opentelemetry-codegen-json_ubuntu-latest: @@ -833,6 +915,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-codegen-json -- -ra py311-test-opentelemetry-codegen-json_ubuntu-latest: @@ -852,6 +936,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-codegen-json -- -ra py312-test-opentelemetry-codegen-json_ubuntu-latest: @@ -871,6 +957,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-codegen-json -- -ra py313-test-opentelemetry-codegen-json_ubuntu-latest: @@ -890,6 +978,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-codegen-json -- -ra py314-test-opentelemetry-codegen-json_ubuntu-latest: @@ -909,6 +999,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-codegen-json -- -ra py314t-test-opentelemetry-codegen-json_ubuntu-latest: @@ -928,6 +1020,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-codegen-json -- -ra pypy3-test-opentelemetry-codegen-json_ubuntu-latest: @@ -947,6 +1041,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-codegen-json -- -ra py39-test-opentelemetry-sdk_ubuntu-latest: @@ -966,6 +1062,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-sdk -- -ra py310-test-opentelemetry-sdk_ubuntu-latest: @@ -985,6 +1083,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-sdk -- -ra py311-test-opentelemetry-sdk_ubuntu-latest: @@ -1004,6 +1104,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-sdk -- -ra py312-test-opentelemetry-sdk_ubuntu-latest: @@ -1023,6 +1125,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-sdk -- -ra py313-test-opentelemetry-sdk_ubuntu-latest: @@ -1042,6 +1146,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-sdk -- -ra py314-test-opentelemetry-sdk_ubuntu-latest: @@ -1061,6 +1167,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-sdk -- -ra py314t-test-opentelemetry-sdk_ubuntu-latest: @@ -1080,6 +1188,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-sdk -- -ra pypy3-test-opentelemetry-sdk_ubuntu-latest: @@ -1099,6 +1209,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-sdk -- -ra py39-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1118,6 +1230,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-semantic-conventions -- -ra py310-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1137,6 +1251,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-semantic-conventions -- -ra py311-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1156,6 +1272,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-semantic-conventions -- -ra py312-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1175,6 +1293,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-semantic-conventions -- -ra py313-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1194,6 +1314,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-semantic-conventions -- -ra py314-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1213,6 +1335,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-semantic-conventions -- -ra py314t-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1232,6 +1356,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-semantic-conventions -- -ra pypy3-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1251,6 +1377,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-semantic-conventions -- -ra py39-test-opentelemetry-getting-started_ubuntu-latest: @@ -1277,6 +1405,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-getting-started -- -ra py310-test-opentelemetry-getting-started_ubuntu-latest: @@ -1303,6 +1433,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-getting-started -- -ra py311-test-opentelemetry-getting-started_ubuntu-latest: @@ -1329,6 +1461,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-getting-started -- -ra py312-test-opentelemetry-getting-started_ubuntu-latest: @@ -1355,6 +1489,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-getting-started -- -ra py313-test-opentelemetry-getting-started_ubuntu-latest: @@ -1381,6 +1517,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-getting-started -- -ra py314-test-opentelemetry-getting-started_ubuntu-latest: @@ -1407,6 +1545,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-getting-started -- -ra py39-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1426,6 +1566,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-opentracing-shim -- -ra py310-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1445,6 +1587,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-opentracing-shim -- -ra py311-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1464,6 +1608,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-opentracing-shim -- -ra py312-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1483,6 +1629,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-opentracing-shim -- -ra py313-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1502,6 +1650,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-opentracing-shim -- -ra py314-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1521,6 +1671,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-opentracing-shim -- -ra py314t-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1540,6 +1692,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-opentracing-shim -- -ra pypy3-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1559,6 +1713,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-opentracing-shim -- -ra py39-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1578,6 +1734,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-opencensus-shim -- -ra py310-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1597,6 +1755,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-opencensus-shim -- -ra py311-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1616,6 +1776,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-opencensus-shim -- -ra py312-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1635,6 +1797,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-opencensus-shim -- -ra py313-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1654,6 +1818,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-opencensus-shim -- -ra py314-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1673,6 +1839,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-opencensus-shim -- -ra py39-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1692,6 +1860,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-opencensus -- -ra py310-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1711,6 +1881,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-opencensus -- -ra py311-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1730,6 +1902,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-opencensus -- -ra py312-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1749,6 +1923,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-opencensus -- -ra py313-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1768,6 +1944,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-opencensus -- -ra py314-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1787,6 +1965,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-opencensus -- -ra py39-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -1806,6 +1986,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-common -- -ra py310-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -1825,6 +2007,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-common -- -ra py311-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -1844,6 +2028,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-common -- -ra py312-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -1863,6 +2049,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-common -- -ra py313-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -1882,6 +2070,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-common -- -ra py314-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -1901,6 +2091,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-common -- -ra py314t-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -1920,6 +2112,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-otlp-proto-common -- -ra pypy3-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -1939,6 +2133,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-otlp-proto-common -- -ra py39-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -1958,6 +2154,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-combined -- -ra py310-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -1977,6 +2175,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-combined -- -ra py311-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -1996,6 +2196,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-combined -- -ra py312-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -2015,6 +2217,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-combined -- -ra py313-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -2034,6 +2238,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-combined -- -ra py314-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -2053,6 +2259,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-combined -- -ra py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2072,6 +2280,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py39-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2091,6 +2301,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2110,6 +2322,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py310-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2129,6 +2343,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2148,6 +2364,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py311-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2167,6 +2385,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2186,6 +2406,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py312-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2205,6 +2427,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2224,6 +2448,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py313-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2243,6 +2469,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2262,6 +2490,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py314-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2281,6 +2511,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py39-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2300,6 +2532,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-http -- -ra py310-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2319,6 +2553,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-http -- -ra py311-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2338,6 +2574,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-http -- -ra py312-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2357,6 +2595,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-http -- -ra py313-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2376,6 +2616,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-http -- -ra py314-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2395,6 +2637,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-http -- -ra py314t-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2414,6 +2658,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-otlp-proto-http -- -ra pypy3-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2433,6 +2679,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-otlp-proto-http -- -ra py39-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2452,6 +2700,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-prometheus -- -ra py310-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2471,6 +2721,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-prometheus -- -ra py311-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2490,6 +2742,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-prometheus -- -ra py312-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2509,6 +2763,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-prometheus -- -ra py313-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2528,6 +2784,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-prometheus -- -ra py314-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2547,6 +2805,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-prometheus -- -ra py314t-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2566,6 +2826,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-prometheus -- -ra pypy3-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2585,6 +2847,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-prometheus -- -ra py39-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2604,6 +2868,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-combined -- -ra py310-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2623,6 +2889,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-combined -- -ra py311-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2642,6 +2910,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-combined -- -ra py312-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2661,6 +2931,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-combined -- -ra py313-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2680,6 +2952,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-combined -- -ra py314-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2699,6 +2973,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-combined -- -ra py314t-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2718,6 +2994,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-combined -- -ra pypy3-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2737,6 +3015,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-combined -- -ra py39-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -2756,6 +3036,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-proto-http -- -ra py310-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -2775,6 +3057,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-proto-http -- -ra py311-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -2794,6 +3078,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-proto-http -- -ra py312-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -2813,6 +3099,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-proto-http -- -ra py313-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -2832,6 +3120,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-proto-http -- -ra py314-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -2851,6 +3141,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-proto-http -- -ra py314t-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -2870,6 +3162,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-proto-http -- -ra pypy3-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -2889,6 +3183,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-proto-http -- -ra py39-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -2908,6 +3204,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-json -- -ra py310-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -2927,6 +3225,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-json -- -ra py311-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -2946,6 +3246,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-json -- -ra py312-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -2965,6 +3267,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-json -- -ra py313-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -2984,6 +3288,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-json -- -ra py314-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3003,6 +3309,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-json -- -ra py314t-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3022,6 +3330,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-json -- -ra pypy3-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3041,6 +3351,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-json -- -ra py39-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3060,6 +3372,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-propagator-b3 -- -ra py310-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3079,6 +3393,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-propagator-b3 -- -ra py311-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3098,6 +3414,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-propagator-b3 -- -ra py312-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3117,6 +3435,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-propagator-b3 -- -ra py313-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3136,6 +3456,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-propagator-b3 -- -ra py314-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3155,6 +3477,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-propagator-b3 -- -ra py314t-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3174,6 +3498,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-propagator-b3 -- -ra pypy3-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3193,6 +3519,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-propagator-b3 -- -ra py39-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3212,6 +3540,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-propagator-jaeger -- -ra py310-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3231,6 +3561,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-propagator-jaeger -- -ra py311-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3250,6 +3582,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-propagator-jaeger -- -ra py312-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3269,6 +3603,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-propagator-jaeger -- -ra py313-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3288,6 +3624,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-propagator-jaeger -- -ra py314-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3307,6 +3645,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-propagator-jaeger -- -ra py314t-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3326,6 +3666,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-propagator-jaeger -- -ra pypy3-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3345,6 +3687,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-propagator-jaeger -- -ra py39-test-opentelemetry-test-utils_ubuntu-latest: @@ -3364,6 +3708,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-test-utils -- -ra py310-test-opentelemetry-test-utils_ubuntu-latest: @@ -3383,6 +3729,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-test-utils -- -ra py311-test-opentelemetry-test-utils_ubuntu-latest: @@ -3402,6 +3750,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-test-utils -- -ra py312-test-opentelemetry-test-utils_ubuntu-latest: @@ -3421,6 +3771,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-test-utils -- -ra py313-test-opentelemetry-test-utils_ubuntu-latest: @@ -3440,6 +3792,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-test-utils -- -ra py314-test-opentelemetry-test-utils_ubuntu-latest: @@ -3459,6 +3813,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-test-utils -- -ra py314t-test-opentelemetry-test-utils_ubuntu-latest: @@ -3478,6 +3834,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-test-utils -- -ra pypy3-test-opentelemetry-test-utils_ubuntu-latest: @@ -3497,6 +3855,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-test-utils -- -ra py39-test-opentelemetry-api_windows-latest: @@ -3518,6 +3878,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-api -- -ra py310-test-opentelemetry-api_windows-latest: @@ -3539,6 +3901,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-api -- -ra py311-test-opentelemetry-api_windows-latest: @@ -3560,6 +3924,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-api -- -ra py312-test-opentelemetry-api_windows-latest: @@ -3581,6 +3947,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-api -- -ra py313-test-opentelemetry-api_windows-latest: @@ -3602,6 +3970,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-api -- -ra py314-test-opentelemetry-api_windows-latest: @@ -3623,6 +3993,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-api -- -ra py314t-test-opentelemetry-api_windows-latest: @@ -3644,6 +4016,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-api -- -ra pypy3-test-opentelemetry-api_windows-latest: @@ -3665,6 +4039,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-api -- -ra py39-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -3686,6 +4062,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-proto-gen-oldest -- -ra py39-test-opentelemetry-proto-gen-latest_windows-latest: @@ -3707,6 +4085,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-proto-gen-latest -- -ra py310-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -3728,6 +4108,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-proto-gen-oldest -- -ra py310-test-opentelemetry-proto-gen-latest_windows-latest: @@ -3749,6 +4131,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-proto-gen-latest -- -ra py311-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -3770,6 +4154,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-proto-gen-oldest -- -ra py311-test-opentelemetry-proto-gen-latest_windows-latest: @@ -3791,6 +4177,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-proto-gen-latest -- -ra py312-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -3812,6 +4200,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-proto-gen-oldest -- -ra py312-test-opentelemetry-proto-gen-latest_windows-latest: @@ -3833,6 +4223,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-proto-gen-latest -- -ra py313-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -3854,6 +4246,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-proto-gen-oldest -- -ra py313-test-opentelemetry-proto-gen-latest_windows-latest: @@ -3875,6 +4269,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-proto-gen-latest -- -ra py314-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -3896,6 +4292,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-proto-gen-oldest -- -ra py314-test-opentelemetry-proto-gen-latest_windows-latest: @@ -3917,6 +4315,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-proto-gen-latest -- -ra py314t-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -3938,6 +4338,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-proto-gen-oldest -- -ra py314t-test-opentelemetry-proto-gen-latest_windows-latest: @@ -3959,6 +4361,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-proto-gen-latest -- -ra pypy3-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -3980,6 +4384,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-proto-gen-oldest -- -ra pypy3-test-opentelemetry-proto-gen-latest_windows-latest: @@ -4001,6 +4407,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-proto-gen-latest -- -ra py39-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4022,6 +4430,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-protojson-gen-oldest -- -ra py39-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4043,6 +4453,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-protojson-gen-latest -- -ra py310-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4064,6 +4476,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-protojson-gen-oldest -- -ra py310-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4085,6 +4499,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-protojson-gen-latest -- -ra py311-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4106,6 +4522,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-protojson-gen-oldest -- -ra py311-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4127,6 +4545,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-protojson-gen-latest -- -ra py312-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4148,6 +4568,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-protojson-gen-oldest -- -ra py312-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4169,6 +4591,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-protojson-gen-latest -- -ra py313-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4190,6 +4614,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-protojson-gen-oldest -- -ra py313-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4211,6 +4637,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-protojson-gen-latest -- -ra py314-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4232,6 +4660,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-protojson-gen-oldest -- -ra py314-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4253,6 +4683,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-protojson-gen-latest -- -ra py314t-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4274,6 +4706,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-protojson-gen-oldest -- -ra py314t-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4295,6 +4729,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-protojson-gen-latest -- -ra pypy3-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4316,6 +4752,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-protojson-gen-oldest -- -ra pypy3-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4337,6 +4775,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-protojson-gen-latest -- -ra py39-test-opentelemetry-codegen-json_windows-latest: @@ -4358,6 +4798,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-codegen-json -- -ra py310-test-opentelemetry-codegen-json_windows-latest: @@ -4379,6 +4821,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-codegen-json -- -ra py311-test-opentelemetry-codegen-json_windows-latest: @@ -4400,6 +4844,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-codegen-json -- -ra py312-test-opentelemetry-codegen-json_windows-latest: @@ -4421,6 +4867,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-codegen-json -- -ra py313-test-opentelemetry-codegen-json_windows-latest: @@ -4442,6 +4890,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-codegen-json -- -ra py314-test-opentelemetry-codegen-json_windows-latest: @@ -4463,6 +4913,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-codegen-json -- -ra py314t-test-opentelemetry-codegen-json_windows-latest: @@ -4484,6 +4936,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-codegen-json -- -ra pypy3-test-opentelemetry-codegen-json_windows-latest: @@ -4505,6 +4959,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-codegen-json -- -ra py39-test-opentelemetry-sdk_windows-latest: @@ -4526,6 +4982,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-sdk -- -ra py310-test-opentelemetry-sdk_windows-latest: @@ -4547,6 +5005,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-sdk -- -ra py311-test-opentelemetry-sdk_windows-latest: @@ -4568,6 +5028,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-sdk -- -ra py312-test-opentelemetry-sdk_windows-latest: @@ -4589,6 +5051,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-sdk -- -ra py313-test-opentelemetry-sdk_windows-latest: @@ -4610,6 +5074,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-sdk -- -ra py314-test-opentelemetry-sdk_windows-latest: @@ -4631,6 +5097,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-sdk -- -ra py314t-test-opentelemetry-sdk_windows-latest: @@ -4652,6 +5120,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-sdk -- -ra pypy3-test-opentelemetry-sdk_windows-latest: @@ -4673,6 +5143,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-sdk -- -ra py39-test-opentelemetry-semantic-conventions_windows-latest: @@ -4694,6 +5166,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-semantic-conventions -- -ra py310-test-opentelemetry-semantic-conventions_windows-latest: @@ -4715,6 +5189,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-semantic-conventions -- -ra py311-test-opentelemetry-semantic-conventions_windows-latest: @@ -4736,6 +5212,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-semantic-conventions -- -ra py312-test-opentelemetry-semantic-conventions_windows-latest: @@ -4757,6 +5235,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-semantic-conventions -- -ra py313-test-opentelemetry-semantic-conventions_windows-latest: @@ -4778,6 +5258,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-semantic-conventions -- -ra py314-test-opentelemetry-semantic-conventions_windows-latest: @@ -4799,6 +5281,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-semantic-conventions -- -ra py314t-test-opentelemetry-semantic-conventions_windows-latest: @@ -4820,6 +5304,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-semantic-conventions -- -ra pypy3-test-opentelemetry-semantic-conventions_windows-latest: @@ -4841,6 +5327,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-semantic-conventions -- -ra py39-test-opentelemetry-getting-started_windows-latest: @@ -4869,6 +5357,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-getting-started -- -ra py310-test-opentelemetry-getting-started_windows-latest: @@ -4897,6 +5387,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-getting-started -- -ra py311-test-opentelemetry-getting-started_windows-latest: @@ -4925,6 +5417,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-getting-started -- -ra py312-test-opentelemetry-getting-started_windows-latest: @@ -4953,6 +5447,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-getting-started -- -ra py313-test-opentelemetry-getting-started_windows-latest: @@ -4981,6 +5477,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-getting-started -- -ra py314-test-opentelemetry-getting-started_windows-latest: @@ -5009,4 +5507,6 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-getting-started -- -ra diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index bdf60184d8b..a81543f1eda 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -56,6 +56,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-opentracing-shim -- -ra py310-test-opentelemetry-opentracing-shim_windows-latest: @@ -77,6 +79,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-opentracing-shim -- -ra py311-test-opentelemetry-opentracing-shim_windows-latest: @@ -98,6 +102,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-opentracing-shim -- -ra py312-test-opentelemetry-opentracing-shim_windows-latest: @@ -119,6 +125,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-opentracing-shim -- -ra py313-test-opentelemetry-opentracing-shim_windows-latest: @@ -140,6 +148,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-opentracing-shim -- -ra py314-test-opentelemetry-opentracing-shim_windows-latest: @@ -161,6 +171,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-opentracing-shim -- -ra py314t-test-opentelemetry-opentracing-shim_windows-latest: @@ -182,6 +194,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-opentracing-shim -- -ra pypy3-test-opentelemetry-opentracing-shim_windows-latest: @@ -203,6 +217,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-opentracing-shim -- -ra py39-test-opentelemetry-opencensus-shim_windows-latest: @@ -224,6 +240,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-opencensus-shim -- -ra py310-test-opentelemetry-opencensus-shim_windows-latest: @@ -245,6 +263,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-opencensus-shim -- -ra py311-test-opentelemetry-opencensus-shim_windows-latest: @@ -266,6 +286,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-opencensus-shim -- -ra py312-test-opentelemetry-opencensus-shim_windows-latest: @@ -287,6 +309,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-opencensus-shim -- -ra py313-test-opentelemetry-opencensus-shim_windows-latest: @@ -308,6 +332,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-opencensus-shim -- -ra py314-test-opentelemetry-opencensus-shim_windows-latest: @@ -329,6 +355,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-opencensus-shim -- -ra py39-test-opentelemetry-exporter-opencensus_windows-latest: @@ -350,6 +378,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-opencensus -- -ra py310-test-opentelemetry-exporter-opencensus_windows-latest: @@ -371,6 +401,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-opencensus -- -ra py311-test-opentelemetry-exporter-opencensus_windows-latest: @@ -392,6 +424,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-opencensus -- -ra py312-test-opentelemetry-exporter-opencensus_windows-latest: @@ -413,6 +447,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-opencensus -- -ra py313-test-opentelemetry-exporter-opencensus_windows-latest: @@ -434,6 +470,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-opencensus -- -ra py314-test-opentelemetry-exporter-opencensus_windows-latest: @@ -455,6 +493,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-opencensus -- -ra py39-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -476,6 +516,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-common -- -ra py310-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -497,6 +539,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-common -- -ra py311-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -518,6 +562,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-common -- -ra py312-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -539,6 +585,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-common -- -ra py313-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -560,6 +608,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-common -- -ra py314-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -581,6 +631,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-common -- -ra py314t-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -602,6 +654,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-otlp-proto-common -- -ra pypy3-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -623,6 +677,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-otlp-proto-common -- -ra py39-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -644,6 +700,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-combined -- -ra py310-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -665,6 +723,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-combined -- -ra py311-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -686,6 +746,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-combined -- -ra py312-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -707,6 +769,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-combined -- -ra py313-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -728,6 +792,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-combined -- -ra py314-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -749,6 +815,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-combined -- -ra py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -770,6 +838,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py39-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -791,6 +861,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -812,6 +884,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py310-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -833,6 +907,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -854,6 +930,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py311-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -875,6 +953,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -896,6 +976,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py312-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -917,6 +999,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -938,6 +1022,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py313-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -959,6 +1045,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -980,6 +1068,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py314-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -1001,6 +1091,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py39-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1022,6 +1114,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-http -- -ra py310-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1043,6 +1137,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-http -- -ra py311-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1064,6 +1160,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-http -- -ra py312-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1085,6 +1183,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-http -- -ra py313-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1106,6 +1206,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-http -- -ra py314-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1127,6 +1229,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-http -- -ra py314t-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1148,6 +1252,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-otlp-proto-http -- -ra pypy3-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1169,6 +1275,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-otlp-proto-http -- -ra py39-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1190,6 +1298,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-prometheus -- -ra py310-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1211,6 +1321,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-prometheus -- -ra py311-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1232,6 +1344,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-prometheus -- -ra py312-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1253,6 +1367,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-prometheus -- -ra py313-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1274,6 +1390,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-prometheus -- -ra py314-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1295,6 +1413,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-prometheus -- -ra py314t-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1316,6 +1436,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-prometheus -- -ra pypy3-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1337,6 +1459,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-prometheus -- -ra py39-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1358,6 +1482,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-combined -- -ra py310-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1379,6 +1505,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-combined -- -ra py311-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1400,6 +1528,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-combined -- -ra py312-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1421,6 +1551,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-combined -- -ra py313-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1442,6 +1574,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-combined -- -ra py314-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1463,6 +1597,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-combined -- -ra py314t-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1484,6 +1620,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-combined -- -ra pypy3-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1505,6 +1643,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-combined -- -ra py39-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1526,6 +1666,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-proto-http -- -ra py310-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1547,6 +1689,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-proto-http -- -ra py311-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1568,6 +1712,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-proto-http -- -ra py312-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1589,6 +1735,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-proto-http -- -ra py313-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1610,6 +1758,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-proto-http -- -ra py314-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1631,6 +1781,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-proto-http -- -ra py314t-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1652,6 +1804,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-proto-http -- -ra pypy3-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1673,6 +1827,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-proto-http -- -ra py39-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1694,6 +1850,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-json -- -ra py310-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1715,6 +1873,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-json -- -ra py311-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1736,6 +1896,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-json -- -ra py312-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1757,6 +1919,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-json -- -ra py313-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1778,6 +1942,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-json -- -ra py314-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1799,6 +1965,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-json -- -ra py314t-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1820,6 +1988,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-json -- -ra pypy3-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1841,6 +2011,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-json -- -ra py39-test-opentelemetry-propagator-b3_windows-latest: @@ -1862,6 +2034,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-propagator-b3 -- -ra py310-test-opentelemetry-propagator-b3_windows-latest: @@ -1883,6 +2057,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-propagator-b3 -- -ra py311-test-opentelemetry-propagator-b3_windows-latest: @@ -1904,6 +2080,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-propagator-b3 -- -ra py312-test-opentelemetry-propagator-b3_windows-latest: @@ -1925,6 +2103,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-propagator-b3 -- -ra py313-test-opentelemetry-propagator-b3_windows-latest: @@ -1946,6 +2126,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-propagator-b3 -- -ra py314-test-opentelemetry-propagator-b3_windows-latest: @@ -1967,6 +2149,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-propagator-b3 -- -ra py314t-test-opentelemetry-propagator-b3_windows-latest: @@ -1988,6 +2172,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-propagator-b3 -- -ra pypy3-test-opentelemetry-propagator-b3_windows-latest: @@ -2009,6 +2195,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-propagator-b3 -- -ra py39-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2030,6 +2218,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-propagator-jaeger -- -ra py310-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2051,6 +2241,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-propagator-jaeger -- -ra py311-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2072,6 +2264,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-propagator-jaeger -- -ra py312-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2093,6 +2287,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-propagator-jaeger -- -ra py313-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2114,6 +2310,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-propagator-jaeger -- -ra py314-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2135,6 +2333,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-propagator-jaeger -- -ra py314t-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2156,6 +2356,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-propagator-jaeger -- -ra pypy3-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2177,6 +2379,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-propagator-jaeger -- -ra py39-test-opentelemetry-test-utils_windows-latest: @@ -2198,6 +2402,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py39-test-opentelemetry-test-utils -- -ra py310-test-opentelemetry-test-utils_windows-latest: @@ -2219,6 +2425,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py310-test-opentelemetry-test-utils -- -ra py311-test-opentelemetry-test-utils_windows-latest: @@ -2240,6 +2448,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py311-test-opentelemetry-test-utils -- -ra py312-test-opentelemetry-test-utils_windows-latest: @@ -2261,6 +2471,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py312-test-opentelemetry-test-utils -- -ra py313-test-opentelemetry-test-utils_windows-latest: @@ -2282,6 +2494,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py313-test-opentelemetry-test-utils -- -ra py314-test-opentelemetry-test-utils_windows-latest: @@ -2303,6 +2517,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314-test-opentelemetry-test-utils -- -ra py314t-test-opentelemetry-test-utils_windows-latest: @@ -2324,6 +2540,8 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e py314t-test-opentelemetry-test-utils -- -ra pypy3-test-opentelemetry-test-utils_windows-latest: @@ -2345,4 +2563,6 @@ jobs: run: pip install tox-uv - name: Run tests + env: + USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-test-utils -- -ra From 2e60381393d6f4e2bbdaca5a0007df363a555901 Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Sun, 8 Mar 2026 00:11:22 -0500 Subject: [PATCH 11/15] update workflows --- .github/workflows/templates/test.yml.j2 | 2 - .github/workflows/test_0.yml | 500 ------------------ .github/workflows/test_1.yml | 220 -------- .../tests/conftest.py | 3 + 4 files changed, 3 insertions(+), 722 deletions(-) diff --git a/.github/workflows/templates/test.yml.j2 b/.github/workflows/templates/test.yml.j2 index 1a2839b8577..6b9080a771a 100644 --- a/.github/workflows/templates/test.yml.j2 +++ b/.github/workflows/templates/test.yml.j2 @@ -69,7 +69,5 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e {{ job_data.tox_env }} -- -ra {%- endfor %} diff --git a/.github/workflows/test_0.yml b/.github/workflows/test_0.yml index fa885882afe..3c925712790 100644 --- a/.github/workflows/test_0.yml +++ b/.github/workflows/test_0.yml @@ -54,8 +54,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-api -- -ra py310-test-opentelemetry-api_ubuntu-latest: @@ -75,8 +73,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-api -- -ra py311-test-opentelemetry-api_ubuntu-latest: @@ -96,8 +92,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-api -- -ra py312-test-opentelemetry-api_ubuntu-latest: @@ -117,8 +111,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-api -- -ra py313-test-opentelemetry-api_ubuntu-latest: @@ -138,8 +130,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-api -- -ra py314-test-opentelemetry-api_ubuntu-latest: @@ -159,8 +149,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-api -- -ra py314t-test-opentelemetry-api_ubuntu-latest: @@ -180,8 +168,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-api -- -ra pypy3-test-opentelemetry-api_ubuntu-latest: @@ -201,8 +187,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-api -- -ra py39-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -222,8 +206,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-proto-gen-oldest -- -ra py39-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -243,8 +225,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-proto-gen-latest -- -ra py310-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -264,8 +244,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-proto-gen-oldest -- -ra py310-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -285,8 +263,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-proto-gen-latest -- -ra py311-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -306,8 +282,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-proto-gen-oldest -- -ra py311-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -327,8 +301,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-proto-gen-latest -- -ra py312-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -348,8 +320,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-proto-gen-oldest -- -ra py312-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -369,8 +339,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-proto-gen-latest -- -ra py313-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -390,8 +358,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-proto-gen-oldest -- -ra py313-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -411,8 +377,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-proto-gen-latest -- -ra py314-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -432,8 +396,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-proto-gen-oldest -- -ra py314-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -453,8 +415,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-proto-gen-latest -- -ra py314t-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -474,8 +434,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-proto-gen-oldest -- -ra py314t-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -495,8 +453,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-proto-gen-latest -- -ra pypy3-test-opentelemetry-proto-gen-oldest_ubuntu-latest: @@ -516,8 +472,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-proto-gen-oldest -- -ra pypy3-test-opentelemetry-proto-gen-latest_ubuntu-latest: @@ -537,8 +491,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-proto-gen-latest -- -ra py39-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -558,8 +510,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-protojson-gen-oldest -- -ra py39-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -579,8 +529,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-protojson-gen-latest -- -ra py310-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -600,8 +548,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-protojson-gen-oldest -- -ra py310-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -621,8 +567,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-protojson-gen-latest -- -ra py311-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -642,8 +586,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-protojson-gen-oldest -- -ra py311-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -663,8 +605,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-protojson-gen-latest -- -ra py312-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -684,8 +624,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-protojson-gen-oldest -- -ra py312-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -705,8 +643,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-protojson-gen-latest -- -ra py313-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -726,8 +662,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-protojson-gen-oldest -- -ra py313-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -747,8 +681,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-protojson-gen-latest -- -ra py314-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -768,8 +700,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-protojson-gen-oldest -- -ra py314-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -789,8 +719,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-protojson-gen-latest -- -ra py314t-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -810,8 +738,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-protojson-gen-oldest -- -ra py314t-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -831,8 +757,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-protojson-gen-latest -- -ra pypy3-test-opentelemetry-protojson-gen-oldest_ubuntu-latest: @@ -852,8 +776,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-protojson-gen-oldest -- -ra pypy3-test-opentelemetry-protojson-gen-latest_ubuntu-latest: @@ -873,8 +795,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-protojson-gen-latest -- -ra py39-test-opentelemetry-codegen-json_ubuntu-latest: @@ -894,8 +814,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-codegen-json -- -ra py310-test-opentelemetry-codegen-json_ubuntu-latest: @@ -915,8 +833,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-codegen-json -- -ra py311-test-opentelemetry-codegen-json_ubuntu-latest: @@ -936,8 +852,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-codegen-json -- -ra py312-test-opentelemetry-codegen-json_ubuntu-latest: @@ -957,8 +871,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-codegen-json -- -ra py313-test-opentelemetry-codegen-json_ubuntu-latest: @@ -978,8 +890,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-codegen-json -- -ra py314-test-opentelemetry-codegen-json_ubuntu-latest: @@ -999,8 +909,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-codegen-json -- -ra py314t-test-opentelemetry-codegen-json_ubuntu-latest: @@ -1020,8 +928,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-codegen-json -- -ra pypy3-test-opentelemetry-codegen-json_ubuntu-latest: @@ -1041,8 +947,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-codegen-json -- -ra py39-test-opentelemetry-sdk_ubuntu-latest: @@ -1062,8 +966,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-sdk -- -ra py310-test-opentelemetry-sdk_ubuntu-latest: @@ -1083,8 +985,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-sdk -- -ra py311-test-opentelemetry-sdk_ubuntu-latest: @@ -1104,8 +1004,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-sdk -- -ra py312-test-opentelemetry-sdk_ubuntu-latest: @@ -1125,8 +1023,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-sdk -- -ra py313-test-opentelemetry-sdk_ubuntu-latest: @@ -1146,8 +1042,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-sdk -- -ra py314-test-opentelemetry-sdk_ubuntu-latest: @@ -1167,8 +1061,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-sdk -- -ra py314t-test-opentelemetry-sdk_ubuntu-latest: @@ -1188,8 +1080,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-sdk -- -ra pypy3-test-opentelemetry-sdk_ubuntu-latest: @@ -1209,8 +1099,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-sdk -- -ra py39-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1230,8 +1118,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-semantic-conventions -- -ra py310-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1251,8 +1137,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-semantic-conventions -- -ra py311-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1272,8 +1156,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-semantic-conventions -- -ra py312-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1293,8 +1175,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-semantic-conventions -- -ra py313-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1314,8 +1194,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-semantic-conventions -- -ra py314-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1335,8 +1213,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-semantic-conventions -- -ra py314t-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1356,8 +1232,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-semantic-conventions -- -ra pypy3-test-opentelemetry-semantic-conventions_ubuntu-latest: @@ -1377,8 +1251,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-semantic-conventions -- -ra py39-test-opentelemetry-getting-started_ubuntu-latest: @@ -1405,8 +1277,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-getting-started -- -ra py310-test-opentelemetry-getting-started_ubuntu-latest: @@ -1433,8 +1303,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-getting-started -- -ra py311-test-opentelemetry-getting-started_ubuntu-latest: @@ -1461,8 +1329,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-getting-started -- -ra py312-test-opentelemetry-getting-started_ubuntu-latest: @@ -1489,8 +1355,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-getting-started -- -ra py313-test-opentelemetry-getting-started_ubuntu-latest: @@ -1517,8 +1381,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-getting-started -- -ra py314-test-opentelemetry-getting-started_ubuntu-latest: @@ -1545,8 +1407,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-getting-started -- -ra py39-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1566,8 +1426,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-opentracing-shim -- -ra py310-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1587,8 +1445,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-opentracing-shim -- -ra py311-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1608,8 +1464,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-opentracing-shim -- -ra py312-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1629,8 +1483,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-opentracing-shim -- -ra py313-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1650,8 +1502,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-opentracing-shim -- -ra py314-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1671,8 +1521,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-opentracing-shim -- -ra py314t-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1692,8 +1540,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-opentracing-shim -- -ra pypy3-test-opentelemetry-opentracing-shim_ubuntu-latest: @@ -1713,8 +1559,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-opentracing-shim -- -ra py39-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1734,8 +1578,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-opencensus-shim -- -ra py310-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1755,8 +1597,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-opencensus-shim -- -ra py311-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1776,8 +1616,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-opencensus-shim -- -ra py312-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1797,8 +1635,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-opencensus-shim -- -ra py313-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1818,8 +1654,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-opencensus-shim -- -ra py314-test-opentelemetry-opencensus-shim_ubuntu-latest: @@ -1839,8 +1673,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-opencensus-shim -- -ra py39-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1860,8 +1692,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-opencensus -- -ra py310-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1881,8 +1711,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-opencensus -- -ra py311-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1902,8 +1730,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-opencensus -- -ra py312-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1923,8 +1749,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-opencensus -- -ra py313-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1944,8 +1768,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-opencensus -- -ra py314-test-opentelemetry-exporter-opencensus_ubuntu-latest: @@ -1965,8 +1787,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-opencensus -- -ra py39-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -1986,8 +1806,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-common -- -ra py310-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -2007,8 +1825,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-common -- -ra py311-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -2028,8 +1844,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-common -- -ra py312-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -2049,8 +1863,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-common -- -ra py313-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -2070,8 +1882,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-common -- -ra py314-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -2091,8 +1901,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-common -- -ra py314t-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -2112,8 +1920,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-otlp-proto-common -- -ra pypy3-test-opentelemetry-exporter-otlp-proto-common_ubuntu-latest: @@ -2133,8 +1939,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-otlp-proto-common -- -ra py39-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -2154,8 +1958,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-combined -- -ra py310-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -2175,8 +1977,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-combined -- -ra py311-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -2196,8 +1996,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-combined -- -ra py312-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -2217,8 +2015,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-combined -- -ra py313-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -2238,8 +2034,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-combined -- -ra py314-test-opentelemetry-exporter-otlp-combined_ubuntu-latest: @@ -2259,8 +2053,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-combined -- -ra py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2280,8 +2072,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py39-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2301,8 +2091,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2322,8 +2110,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py310-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2343,8 +2129,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2364,8 +2148,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py311-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2385,8 +2167,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2406,8 +2186,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py312-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2427,8 +2205,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2448,8 +2224,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py313-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2469,8 +2243,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest_ubuntu-latest: @@ -2490,8 +2262,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py314-test-opentelemetry-exporter-otlp-proto-grpc-latest_ubuntu-latest: @@ -2511,8 +2281,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py39-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2532,8 +2300,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-http -- -ra py310-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2553,8 +2319,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-http -- -ra py311-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2574,8 +2338,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-http -- -ra py312-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2595,8 +2357,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-http -- -ra py313-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2616,8 +2376,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-http -- -ra py314-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2637,8 +2395,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-http -- -ra py314t-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2658,8 +2414,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-otlp-proto-http -- -ra pypy3-test-opentelemetry-exporter-otlp-proto-http_ubuntu-latest: @@ -2679,8 +2433,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-otlp-proto-http -- -ra py39-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2700,8 +2452,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-prometheus -- -ra py310-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2721,8 +2471,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-prometheus -- -ra py311-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2742,8 +2490,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-prometheus -- -ra py312-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2763,8 +2509,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-prometheus -- -ra py313-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2784,8 +2528,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-prometheus -- -ra py314-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2805,8 +2547,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-prometheus -- -ra py314t-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2826,8 +2566,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-prometheus -- -ra pypy3-test-opentelemetry-exporter-prometheus_ubuntu-latest: @@ -2847,8 +2585,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-prometheus -- -ra py39-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2868,8 +2604,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-combined -- -ra py310-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2889,8 +2623,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-combined -- -ra py311-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2910,8 +2642,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-combined -- -ra py312-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2931,8 +2661,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-combined -- -ra py313-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2952,8 +2680,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-combined -- -ra py314-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2973,8 +2699,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-combined -- -ra py314t-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -2994,8 +2718,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-combined -- -ra pypy3-test-opentelemetry-exporter-zipkin-combined_ubuntu-latest: @@ -3015,8 +2737,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-combined -- -ra py39-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -3036,8 +2756,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-proto-http -- -ra py310-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -3057,8 +2775,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-proto-http -- -ra py311-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -3078,8 +2794,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-proto-http -- -ra py312-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -3099,8 +2813,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-proto-http -- -ra py313-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -3120,8 +2832,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-proto-http -- -ra py314-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -3141,8 +2851,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-proto-http -- -ra py314t-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -3162,8 +2870,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-proto-http -- -ra pypy3-test-opentelemetry-exporter-zipkin-proto-http_ubuntu-latest: @@ -3183,8 +2889,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-proto-http -- -ra py39-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3204,8 +2908,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-json -- -ra py310-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3225,8 +2927,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-json -- -ra py311-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3246,8 +2946,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-json -- -ra py312-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3267,8 +2965,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-json -- -ra py313-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3288,8 +2984,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-json -- -ra py314-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3309,8 +3003,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-json -- -ra py314t-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3330,8 +3022,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-json -- -ra pypy3-test-opentelemetry-exporter-zipkin-json_ubuntu-latest: @@ -3351,8 +3041,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-json -- -ra py39-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3372,8 +3060,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-propagator-b3 -- -ra py310-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3393,8 +3079,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-propagator-b3 -- -ra py311-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3414,8 +3098,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-propagator-b3 -- -ra py312-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3435,8 +3117,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-propagator-b3 -- -ra py313-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3456,8 +3136,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-propagator-b3 -- -ra py314-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3477,8 +3155,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-propagator-b3 -- -ra py314t-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3498,8 +3174,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-propagator-b3 -- -ra pypy3-test-opentelemetry-propagator-b3_ubuntu-latest: @@ -3519,8 +3193,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-propagator-b3 -- -ra py39-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3540,8 +3212,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-propagator-jaeger -- -ra py310-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3561,8 +3231,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-propagator-jaeger -- -ra py311-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3582,8 +3250,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-propagator-jaeger -- -ra py312-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3603,8 +3269,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-propagator-jaeger -- -ra py313-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3624,8 +3288,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-propagator-jaeger -- -ra py314-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3645,8 +3307,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-propagator-jaeger -- -ra py314t-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3666,8 +3326,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-propagator-jaeger -- -ra pypy3-test-opentelemetry-propagator-jaeger_ubuntu-latest: @@ -3687,8 +3345,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-propagator-jaeger -- -ra py39-test-opentelemetry-test-utils_ubuntu-latest: @@ -3708,8 +3364,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-test-utils -- -ra py310-test-opentelemetry-test-utils_ubuntu-latest: @@ -3729,8 +3383,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-test-utils -- -ra py311-test-opentelemetry-test-utils_ubuntu-latest: @@ -3750,8 +3402,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-test-utils -- -ra py312-test-opentelemetry-test-utils_ubuntu-latest: @@ -3771,8 +3421,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-test-utils -- -ra py313-test-opentelemetry-test-utils_ubuntu-latest: @@ -3792,8 +3440,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-test-utils -- -ra py314-test-opentelemetry-test-utils_ubuntu-latest: @@ -3813,8 +3459,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-test-utils -- -ra py314t-test-opentelemetry-test-utils_ubuntu-latest: @@ -3834,8 +3478,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-test-utils -- -ra pypy3-test-opentelemetry-test-utils_ubuntu-latest: @@ -3855,8 +3497,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-test-utils -- -ra py39-test-opentelemetry-api_windows-latest: @@ -3878,8 +3518,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-api -- -ra py310-test-opentelemetry-api_windows-latest: @@ -3901,8 +3539,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-api -- -ra py311-test-opentelemetry-api_windows-latest: @@ -3924,8 +3560,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-api -- -ra py312-test-opentelemetry-api_windows-latest: @@ -3947,8 +3581,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-api -- -ra py313-test-opentelemetry-api_windows-latest: @@ -3970,8 +3602,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-api -- -ra py314-test-opentelemetry-api_windows-latest: @@ -3993,8 +3623,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-api -- -ra py314t-test-opentelemetry-api_windows-latest: @@ -4016,8 +3644,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-api -- -ra pypy3-test-opentelemetry-api_windows-latest: @@ -4039,8 +3665,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-api -- -ra py39-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -4062,8 +3686,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-proto-gen-oldest -- -ra py39-test-opentelemetry-proto-gen-latest_windows-latest: @@ -4085,8 +3707,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-proto-gen-latest -- -ra py310-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -4108,8 +3728,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-proto-gen-oldest -- -ra py310-test-opentelemetry-proto-gen-latest_windows-latest: @@ -4131,8 +3749,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-proto-gen-latest -- -ra py311-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -4154,8 +3770,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-proto-gen-oldest -- -ra py311-test-opentelemetry-proto-gen-latest_windows-latest: @@ -4177,8 +3791,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-proto-gen-latest -- -ra py312-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -4200,8 +3812,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-proto-gen-oldest -- -ra py312-test-opentelemetry-proto-gen-latest_windows-latest: @@ -4223,8 +3833,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-proto-gen-latest -- -ra py313-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -4246,8 +3854,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-proto-gen-oldest -- -ra py313-test-opentelemetry-proto-gen-latest_windows-latest: @@ -4269,8 +3875,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-proto-gen-latest -- -ra py314-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -4292,8 +3896,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-proto-gen-oldest -- -ra py314-test-opentelemetry-proto-gen-latest_windows-latest: @@ -4315,8 +3917,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-proto-gen-latest -- -ra py314t-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -4338,8 +3938,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-proto-gen-oldest -- -ra py314t-test-opentelemetry-proto-gen-latest_windows-latest: @@ -4361,8 +3959,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-proto-gen-latest -- -ra pypy3-test-opentelemetry-proto-gen-oldest_windows-latest: @@ -4384,8 +3980,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-proto-gen-oldest -- -ra pypy3-test-opentelemetry-proto-gen-latest_windows-latest: @@ -4407,8 +4001,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-proto-gen-latest -- -ra py39-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4430,8 +4022,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-protojson-gen-oldest -- -ra py39-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4453,8 +4043,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-protojson-gen-latest -- -ra py310-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4476,8 +4064,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-protojson-gen-oldest -- -ra py310-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4499,8 +4085,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-protojson-gen-latest -- -ra py311-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4522,8 +4106,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-protojson-gen-oldest -- -ra py311-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4545,8 +4127,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-protojson-gen-latest -- -ra py312-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4568,8 +4148,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-protojson-gen-oldest -- -ra py312-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4591,8 +4169,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-protojson-gen-latest -- -ra py313-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4614,8 +4190,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-protojson-gen-oldest -- -ra py313-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4637,8 +4211,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-protojson-gen-latest -- -ra py314-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4660,8 +4232,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-protojson-gen-oldest -- -ra py314-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4683,8 +4253,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-protojson-gen-latest -- -ra py314t-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4706,8 +4274,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-protojson-gen-oldest -- -ra py314t-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4729,8 +4295,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-protojson-gen-latest -- -ra pypy3-test-opentelemetry-protojson-gen-oldest_windows-latest: @@ -4752,8 +4316,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-protojson-gen-oldest -- -ra pypy3-test-opentelemetry-protojson-gen-latest_windows-latest: @@ -4775,8 +4337,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-protojson-gen-latest -- -ra py39-test-opentelemetry-codegen-json_windows-latest: @@ -4798,8 +4358,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-codegen-json -- -ra py310-test-opentelemetry-codegen-json_windows-latest: @@ -4821,8 +4379,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-codegen-json -- -ra py311-test-opentelemetry-codegen-json_windows-latest: @@ -4844,8 +4400,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-codegen-json -- -ra py312-test-opentelemetry-codegen-json_windows-latest: @@ -4867,8 +4421,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-codegen-json -- -ra py313-test-opentelemetry-codegen-json_windows-latest: @@ -4890,8 +4442,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-codegen-json -- -ra py314-test-opentelemetry-codegen-json_windows-latest: @@ -4913,8 +4463,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-codegen-json -- -ra py314t-test-opentelemetry-codegen-json_windows-latest: @@ -4936,8 +4484,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-codegen-json -- -ra pypy3-test-opentelemetry-codegen-json_windows-latest: @@ -4959,8 +4505,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-codegen-json -- -ra py39-test-opentelemetry-sdk_windows-latest: @@ -4982,8 +4526,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-sdk -- -ra py310-test-opentelemetry-sdk_windows-latest: @@ -5005,8 +4547,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-sdk -- -ra py311-test-opentelemetry-sdk_windows-latest: @@ -5028,8 +4568,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-sdk -- -ra py312-test-opentelemetry-sdk_windows-latest: @@ -5051,8 +4589,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-sdk -- -ra py313-test-opentelemetry-sdk_windows-latest: @@ -5074,8 +4610,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-sdk -- -ra py314-test-opentelemetry-sdk_windows-latest: @@ -5097,8 +4631,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-sdk -- -ra py314t-test-opentelemetry-sdk_windows-latest: @@ -5120,8 +4652,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-sdk -- -ra pypy3-test-opentelemetry-sdk_windows-latest: @@ -5143,8 +4673,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-sdk -- -ra py39-test-opentelemetry-semantic-conventions_windows-latest: @@ -5166,8 +4694,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-semantic-conventions -- -ra py310-test-opentelemetry-semantic-conventions_windows-latest: @@ -5189,8 +4715,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-semantic-conventions -- -ra py311-test-opentelemetry-semantic-conventions_windows-latest: @@ -5212,8 +4736,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-semantic-conventions -- -ra py312-test-opentelemetry-semantic-conventions_windows-latest: @@ -5235,8 +4757,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-semantic-conventions -- -ra py313-test-opentelemetry-semantic-conventions_windows-latest: @@ -5258,8 +4778,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-semantic-conventions -- -ra py314-test-opentelemetry-semantic-conventions_windows-latest: @@ -5281,8 +4799,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-semantic-conventions -- -ra py314t-test-opentelemetry-semantic-conventions_windows-latest: @@ -5304,8 +4820,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-semantic-conventions -- -ra pypy3-test-opentelemetry-semantic-conventions_windows-latest: @@ -5327,8 +4841,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-semantic-conventions -- -ra py39-test-opentelemetry-getting-started_windows-latest: @@ -5357,8 +4869,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-getting-started -- -ra py310-test-opentelemetry-getting-started_windows-latest: @@ -5387,8 +4897,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-getting-started -- -ra py311-test-opentelemetry-getting-started_windows-latest: @@ -5417,8 +4925,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-getting-started -- -ra py312-test-opentelemetry-getting-started_windows-latest: @@ -5447,8 +4953,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-getting-started -- -ra py313-test-opentelemetry-getting-started_windows-latest: @@ -5477,8 +4981,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-getting-started -- -ra py314-test-opentelemetry-getting-started_windows-latest: @@ -5507,6 +5009,4 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-getting-started -- -ra diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index a81543f1eda..bdf60184d8b 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -56,8 +56,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-opentracing-shim -- -ra py310-test-opentelemetry-opentracing-shim_windows-latest: @@ -79,8 +77,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-opentracing-shim -- -ra py311-test-opentelemetry-opentracing-shim_windows-latest: @@ -102,8 +98,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-opentracing-shim -- -ra py312-test-opentelemetry-opentracing-shim_windows-latest: @@ -125,8 +119,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-opentracing-shim -- -ra py313-test-opentelemetry-opentracing-shim_windows-latest: @@ -148,8 +140,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-opentracing-shim -- -ra py314-test-opentelemetry-opentracing-shim_windows-latest: @@ -171,8 +161,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-opentracing-shim -- -ra py314t-test-opentelemetry-opentracing-shim_windows-latest: @@ -194,8 +182,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-opentracing-shim -- -ra pypy3-test-opentelemetry-opentracing-shim_windows-latest: @@ -217,8 +203,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-opentracing-shim -- -ra py39-test-opentelemetry-opencensus-shim_windows-latest: @@ -240,8 +224,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-opencensus-shim -- -ra py310-test-opentelemetry-opencensus-shim_windows-latest: @@ -263,8 +245,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-opencensus-shim -- -ra py311-test-opentelemetry-opencensus-shim_windows-latest: @@ -286,8 +266,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-opencensus-shim -- -ra py312-test-opentelemetry-opencensus-shim_windows-latest: @@ -309,8 +287,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-opencensus-shim -- -ra py313-test-opentelemetry-opencensus-shim_windows-latest: @@ -332,8 +308,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-opencensus-shim -- -ra py314-test-opentelemetry-opencensus-shim_windows-latest: @@ -355,8 +329,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-opencensus-shim -- -ra py39-test-opentelemetry-exporter-opencensus_windows-latest: @@ -378,8 +350,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-opencensus -- -ra py310-test-opentelemetry-exporter-opencensus_windows-latest: @@ -401,8 +371,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-opencensus -- -ra py311-test-opentelemetry-exporter-opencensus_windows-latest: @@ -424,8 +392,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-opencensus -- -ra py312-test-opentelemetry-exporter-opencensus_windows-latest: @@ -447,8 +413,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-opencensus -- -ra py313-test-opentelemetry-exporter-opencensus_windows-latest: @@ -470,8 +434,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-opencensus -- -ra py314-test-opentelemetry-exporter-opencensus_windows-latest: @@ -493,8 +455,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-opencensus -- -ra py39-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -516,8 +476,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-common -- -ra py310-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -539,8 +497,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-common -- -ra py311-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -562,8 +518,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-common -- -ra py312-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -585,8 +539,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-common -- -ra py313-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -608,8 +560,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-common -- -ra py314-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -631,8 +581,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-common -- -ra py314t-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -654,8 +602,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-otlp-proto-common -- -ra pypy3-test-opentelemetry-exporter-otlp-proto-common_windows-latest: @@ -677,8 +623,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-otlp-proto-common -- -ra py39-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -700,8 +644,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-combined -- -ra py310-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -723,8 +665,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-combined -- -ra py311-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -746,8 +686,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-combined -- -ra py312-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -769,8 +707,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-combined -- -ra py313-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -792,8 +728,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-combined -- -ra py314-test-opentelemetry-exporter-otlp-combined_windows-latest: @@ -815,8 +749,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-combined -- -ra py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -838,8 +770,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py39-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -861,8 +791,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -884,8 +812,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py310-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -907,8 +833,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -930,8 +854,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py311-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -953,8 +875,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -976,8 +896,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py312-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -999,8 +917,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -1022,8 +938,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py313-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -1045,8 +959,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest_windows-latest: @@ -1068,8 +980,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-oldest -- -ra py314-test-opentelemetry-exporter-otlp-proto-grpc-latest_windows-latest: @@ -1091,8 +1001,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-grpc-latest -- -ra py39-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1114,8 +1022,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-otlp-proto-http -- -ra py310-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1137,8 +1043,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-otlp-proto-http -- -ra py311-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1160,8 +1064,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-otlp-proto-http -- -ra py312-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1183,8 +1085,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-otlp-proto-http -- -ra py313-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1206,8 +1106,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-otlp-proto-http -- -ra py314-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1229,8 +1127,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-otlp-proto-http -- -ra py314t-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1252,8 +1148,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-otlp-proto-http -- -ra pypy3-test-opentelemetry-exporter-otlp-proto-http_windows-latest: @@ -1275,8 +1169,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-otlp-proto-http -- -ra py39-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1298,8 +1190,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-prometheus -- -ra py310-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1321,8 +1211,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-prometheus -- -ra py311-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1344,8 +1232,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-prometheus -- -ra py312-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1367,8 +1253,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-prometheus -- -ra py313-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1390,8 +1274,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-prometheus -- -ra py314-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1413,8 +1295,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-prometheus -- -ra py314t-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1436,8 +1316,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-prometheus -- -ra pypy3-test-opentelemetry-exporter-prometheus_windows-latest: @@ -1459,8 +1337,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-prometheus -- -ra py39-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1482,8 +1358,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-combined -- -ra py310-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1505,8 +1379,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-combined -- -ra py311-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1528,8 +1400,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-combined -- -ra py312-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1551,8 +1421,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-combined -- -ra py313-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1574,8 +1442,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-combined -- -ra py314-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1597,8 +1463,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-combined -- -ra py314t-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1620,8 +1484,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-combined -- -ra pypy3-test-opentelemetry-exporter-zipkin-combined_windows-latest: @@ -1643,8 +1505,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-combined -- -ra py39-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1666,8 +1526,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-proto-http -- -ra py310-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1689,8 +1547,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-proto-http -- -ra py311-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1712,8 +1568,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-proto-http -- -ra py312-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1735,8 +1589,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-proto-http -- -ra py313-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1758,8 +1610,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-proto-http -- -ra py314-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1781,8 +1631,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-proto-http -- -ra py314t-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1804,8 +1652,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-proto-http -- -ra pypy3-test-opentelemetry-exporter-zipkin-proto-http_windows-latest: @@ -1827,8 +1673,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-proto-http -- -ra py39-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1850,8 +1694,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-exporter-zipkin-json -- -ra py310-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1873,8 +1715,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-exporter-zipkin-json -- -ra py311-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1896,8 +1736,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-exporter-zipkin-json -- -ra py312-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1919,8 +1757,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-exporter-zipkin-json -- -ra py313-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1942,8 +1778,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-exporter-zipkin-json -- -ra py314-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1965,8 +1799,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-exporter-zipkin-json -- -ra py314t-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -1988,8 +1820,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-exporter-zipkin-json -- -ra pypy3-test-opentelemetry-exporter-zipkin-json_windows-latest: @@ -2011,8 +1841,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-exporter-zipkin-json -- -ra py39-test-opentelemetry-propagator-b3_windows-latest: @@ -2034,8 +1862,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-propagator-b3 -- -ra py310-test-opentelemetry-propagator-b3_windows-latest: @@ -2057,8 +1883,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-propagator-b3 -- -ra py311-test-opentelemetry-propagator-b3_windows-latest: @@ -2080,8 +1904,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-propagator-b3 -- -ra py312-test-opentelemetry-propagator-b3_windows-latest: @@ -2103,8 +1925,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-propagator-b3 -- -ra py313-test-opentelemetry-propagator-b3_windows-latest: @@ -2126,8 +1946,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-propagator-b3 -- -ra py314-test-opentelemetry-propagator-b3_windows-latest: @@ -2149,8 +1967,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-propagator-b3 -- -ra py314t-test-opentelemetry-propagator-b3_windows-latest: @@ -2172,8 +1988,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-propagator-b3 -- -ra pypy3-test-opentelemetry-propagator-b3_windows-latest: @@ -2195,8 +2009,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-propagator-b3 -- -ra py39-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2218,8 +2030,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-propagator-jaeger -- -ra py310-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2241,8 +2051,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-propagator-jaeger -- -ra py311-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2264,8 +2072,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-propagator-jaeger -- -ra py312-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2287,8 +2093,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-propagator-jaeger -- -ra py313-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2310,8 +2114,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-propagator-jaeger -- -ra py314-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2333,8 +2135,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-propagator-jaeger -- -ra py314t-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2356,8 +2156,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-propagator-jaeger -- -ra pypy3-test-opentelemetry-propagator-jaeger_windows-latest: @@ -2379,8 +2177,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-propagator-jaeger -- -ra py39-test-opentelemetry-test-utils_windows-latest: @@ -2402,8 +2198,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py39-test-opentelemetry-test-utils -- -ra py310-test-opentelemetry-test-utils_windows-latest: @@ -2425,8 +2219,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py310-test-opentelemetry-test-utils -- -ra py311-test-opentelemetry-test-utils_windows-latest: @@ -2448,8 +2240,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py311-test-opentelemetry-test-utils -- -ra py312-test-opentelemetry-test-utils_windows-latest: @@ -2471,8 +2261,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py312-test-opentelemetry-test-utils -- -ra py313-test-opentelemetry-test-utils_windows-latest: @@ -2494,8 +2282,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py313-test-opentelemetry-test-utils -- -ra py314-test-opentelemetry-test-utils_windows-latest: @@ -2517,8 +2303,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314-test-opentelemetry-test-utils -- -ra py314t-test-opentelemetry-test-utils_windows-latest: @@ -2540,8 +2324,6 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e py314t-test-opentelemetry-test-utils -- -ra pypy3-test-opentelemetry-test-utils_windows-latest: @@ -2563,6 +2345,4 @@ jobs: run: pip install tox-uv - name: Run tests - env: - USERNAME: "runner" run: tox -e pypy3-test-opentelemetry-test-utils -- -ra diff --git a/codegen/opentelemetry-codegen-json/tests/conftest.py b/codegen/opentelemetry-codegen-json/tests/conftest.py index d349025bf45..768f15a90e7 100644 --- a/codegen/opentelemetry-codegen-json/tests/conftest.py +++ b/codegen/opentelemetry-codegen-json/tests/conftest.py @@ -15,6 +15,7 @@ # pylint: disable=redefined-outer-name import importlib +import os import subprocess import sys from pathlib import Path @@ -22,6 +23,8 @@ import pytest # type: ignore from _pytest.monkeypatch import MonkeyPatch # type: ignore +os.environ.setdefault("USERNAME", "runner") + PROTO_PATH = Path(__file__).parent / "proto" GEN_PATH = Path(__file__).parent / "generated" From ed1b8ae12bd9227d164b59a1effaa0d4ec2b1a8b Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Sun, 8 Mar 2026 16:25:01 -0400 Subject: [PATCH 12/15] update tox.ini --- .github/workflows/test_0.yml | 164 +++++++++--------- .github/workflows/test_1.yml | 84 --------- .../tests/conftest.py | 3 - tox.ini | 10 +- 4 files changed, 92 insertions(+), 169 deletions(-) diff --git a/.github/workflows/test_0.yml b/.github/workflows/test_0.yml index 3c925712790..4027490bbfa 100644 --- a/.github/workflows/test_0.yml +++ b/.github/workflows/test_0.yml @@ -911,44 +911,6 @@ jobs: - name: Run tests run: tox -e py314-test-opentelemetry-codegen-json -- -ra - py314t-test-opentelemetry-codegen-json_ubuntu-latest: - name: opentelemetry-codegen-json 3.14t Ubuntu - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.14t - uses: actions/setup-python@v5 - with: - python-version: "3.14t" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py314t-test-opentelemetry-codegen-json -- -ra - - pypy3-test-opentelemetry-codegen-json_ubuntu-latest: - name: opentelemetry-codegen-json pypy-3.9 Ubuntu - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python pypy-3.9 - uses: actions/setup-python@v5 - with: - python-version: "pypy-3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e pypy3-test-opentelemetry-codegen-json -- -ra - py39-test-opentelemetry-sdk_ubuntu-latest: name: opentelemetry-sdk 3.9 Ubuntu runs-on: ubuntu-latest @@ -4465,48 +4427,6 @@ jobs: - name: Run tests run: tox -e py314-test-opentelemetry-codegen-json -- -ra - py314t-test-opentelemetry-codegen-json_windows-latest: - name: opentelemetry-codegen-json 3.14t Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.14t - uses: actions/setup-python@v5 - with: - python-version: "3.14t" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py314t-test-opentelemetry-codegen-json -- -ra - - pypy3-test-opentelemetry-codegen-json_windows-latest: - name: opentelemetry-codegen-json pypy-3.9 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python pypy-3.9 - uses: actions/setup-python@v5 - with: - python-version: "pypy-3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e pypy3-test-opentelemetry-codegen-json -- -ra - py39-test-opentelemetry-sdk_windows-latest: name: opentelemetry-sdk 3.9 Windows runs-on: windows-latest @@ -5010,3 +4930,87 @@ jobs: - name: Run tests run: tox -e py314-test-opentelemetry-getting-started -- -ra + + py39-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.9 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py39-test-opentelemetry-opentracing-shim -- -ra + + py310-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.10 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py310-test-opentelemetry-opentracing-shim -- -ra + + py311-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.11 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py311-test-opentelemetry-opentracing-shim -- -ra + + py312-test-opentelemetry-opentracing-shim_windows-latest: + name: opentelemetry-opentracing-shim 3.12 Windows + runs-on: windows-latest + timeout-minutes: 30 + steps: + - name: Configure git to support long filenames + run: git config --system core.longpaths true + - name: Checkout repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install tox + run: pip install tox-uv + + - name: Run tests + run: tox -e py312-test-opentelemetry-opentracing-shim -- -ra diff --git a/.github/workflows/test_1.yml b/.github/workflows/test_1.yml index bdf60184d8b..5cc5960f214 100644 --- a/.github/workflows/test_1.yml +++ b/.github/workflows/test_1.yml @@ -37,90 +37,6 @@ env: jobs: - py39-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.9 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: "3.9" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py39-test-opentelemetry-opentracing-shim -- -ra - - py310-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.10 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py310-test-opentelemetry-opentracing-shim -- -ra - - py311-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.11 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py311-test-opentelemetry-opentracing-shim -- -ra - - py312-test-opentelemetry-opentracing-shim_windows-latest: - name: opentelemetry-opentracing-shim 3.12 Windows - runs-on: windows-latest - timeout-minutes: 30 - steps: - - name: Configure git to support long filenames - run: git config --system core.longpaths true - - name: Checkout repo @ SHA - ${{ github.sha }} - uses: actions/checkout@v4 - - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - - name: Install tox - run: pip install tox-uv - - - name: Run tests - run: tox -e py312-test-opentelemetry-opentracing-shim -- -ra - py313-test-opentelemetry-opentracing-shim_windows-latest: name: opentelemetry-opentracing-shim 3.13 Windows runs-on: windows-latest diff --git a/codegen/opentelemetry-codegen-json/tests/conftest.py b/codegen/opentelemetry-codegen-json/tests/conftest.py index 768f15a90e7..d349025bf45 100644 --- a/codegen/opentelemetry-codegen-json/tests/conftest.py +++ b/codegen/opentelemetry-codegen-json/tests/conftest.py @@ -15,7 +15,6 @@ # pylint: disable=redefined-outer-name import importlib -import os import subprocess import sys from pathlib import Path @@ -23,8 +22,6 @@ import pytest # type: ignore from _pytest.monkeypatch import MonkeyPatch # type: ignore -os.environ.setdefault("USERNAME", "runner") - PROTO_PATH = Path(__file__).parent / "proto" GEN_PATH = Path(__file__).parent / "generated" diff --git a/tox.ini b/tox.ini index d3cb9823b23..971ec6571d6 100644 --- a/tox.ini +++ b/tox.ini @@ -20,8 +20,8 @@ envlist = pypy3-test-opentelemetry-protojson-gen-{oldest,latest} lint-opentelemetry-protojson-gen-latest - py3{9,10,11,12,13,14,14t}-test-opentelemetry-codegen-json - pypy3-test-opentelemetry-codegen-json + py3{9,10,11,12,13,14}-test-opentelemetry-codegen-json + ; intentionally excluded from pypy3 lint-opentelemetry-codegen-json py3{9,10,11,12,13,14,14t}-test-opentelemetry-sdk @@ -168,6 +168,12 @@ deps = allowlist_externals = sh +passenv = + USERNAME + USER + LOGNAME + LNAME + setenv = ; override CONTRIB_REPO_SHA via env variable when testing other branches/commits than main ; i.e: CONTRIB_REPO_SHA=dde62cebffe519c35875af6d06fae053b3be65ec tox -e From c2de5b42d2414b0cf0bd7a7330af28a891a0ad9e Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Tue, 10 Mar 2026 15:35:27 -0400 Subject: [PATCH 13/15] update to use inheritence for common JSON serialization/deserialization methods --- .../opentelemetry/codegen/json/generator.py | 6 +-- .../codegen/json/runtime/json_codec.py | 33 ++++++++----- .../opentelemetry/proto_json/_json_codec.py | 41 ++++++++++------ .../collector/logs/v1/logs_service.py | 9 ++-- .../collector/metrics/v1/metrics_service.py | 9 ++-- .../v1development/profiles_service.py | 9 ++-- .../collector/trace/v1/trace_service.py | 9 ++-- .../proto_json/common/v1/common.py | 18 +++---- .../opentelemetry/proto_json/logs/v1/logs.py | 12 ++--- .../proto_json/metrics/v1/metrics.py | 48 +++++++------------ .../profiles/v1development/profiles.py | 42 ++++++---------- .../proto_json/resource/v1/resource.py | 3 +- .../proto_json/trace/v1/trace.py | 21 +++----- pyproject.toml | 1 + 14 files changed, 110 insertions(+), 151 deletions(-) diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py index b05cefd46f5..5893dbd4453 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py @@ -454,10 +454,8 @@ def _generate_message_class( codec = self._get_codec_module_path() with writer.dataclass( msg_desc.name, - decorators=( - "typing.final", - f"{codec}.json_serde", - ), + bases=(f"{codec}.JsonMessage",), + decorators=("typing.final",), decorator_name="_dataclass", ): if msg_desc.field or msg_desc.nested_type or msg_desc.enum_type: diff --git a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py index 5e9ec97cec5..da1f40b0484 100644 --- a/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py +++ b/codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/runtime/json_codec.py @@ -14,37 +14,46 @@ from __future__ import annotations +import abc import base64 import json import math import typing T = typing.TypeVar("T") +M = typing.TypeVar("M", bound="JsonMessage") -def json_serde(cls: type[T]) -> type[T]: +class JsonMessage(abc.ABC): """ - A decorator that adds "to_json" and "from_json" methods to a class. + Abstract base class for protobuf messages with JSON serialization. """ - def to_json(self: typing.Any) -> str: + @abc.abstractmethod + def to_dict(self) -> dict[str, typing.Any]: + """ + Convert this message to a dictionary. + """ + + @classmethod + @abc.abstractmethod + def from_dict(cls: type[M], data: dict[str, typing.Any]) -> M: + """ + Create an instance from a dictionary. + """ + + def to_json(self) -> str: """ Serialize this message to a JSON string. """ - # pylint: disable-next=no-member - return json.dumps(self.to_dict()) # type: ignore + return json.dumps(self.to_dict()) @classmethod - def from_json(cls_inner: type[T], data: typing.Union[str, bytes]) -> T: + def from_json(cls: type[M], data: typing.Union[str, bytes]) -> M: """ Deserialize from a JSON string or bytes. """ - # pylint: disable-next=no-member - return cls_inner.from_dict(json.loads(data)) # type: ignore - - cls.to_json = to_json # type: ignore[attr-defined] - cls.from_json = from_json # type: ignore[attr-defined] - return cls + return cls.from_dict(json.loads(data)) def encode_hex(value: typing.Optional[bytes]) -> str: diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py index c4cb1537758..da1f40b0484 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/_json_codec.py @@ -14,38 +14,49 @@ from __future__ import annotations +import abc import base64 import json import math import typing T = typing.TypeVar("T") +M = typing.TypeVar("M", bound="JsonMessage") -def json_serde(cls: type[T]) -> type[T]: +class JsonMessage(abc.ABC): """ - A decorator that adds "to_json" and "from_json" methods to a class. + Abstract base class for protobuf messages with JSON serialization. """ - def to_json(self: T) -> str: + @abc.abstractmethod + def to_dict(self) -> dict[str, typing.Any]: + """ + Convert this message to a dictionary. + """ + + @classmethod + @abc.abstractmethod + def from_dict(cls: type[M], data: dict[str, typing.Any]) -> M: + """ + Create an instance from a dictionary. + """ + + def to_json(self) -> str: """ Serialize this message to a JSON string. """ return json.dumps(self.to_dict()) @classmethod - def from_json(cls_inner: type[T], data: typing.Union[str, bytes]) -> T: + def from_json(cls: type[M], data: typing.Union[str, bytes]) -> M: """ Deserialize from a JSON string or bytes. """ - return cls_inner.from_dict(json.loads(data)) - - cls.to_json = to_json # type: ignore[attr-defined] - cls.from_json = from_json # type: ignore[attr-defined] - return cls + return cls.from_dict(json.loads(data)) -def encode_hex(value: bytes) -> str: +def encode_hex(value: typing.Optional[bytes]) -> str: """ Encode bytes as hex string. @@ -57,7 +68,7 @@ def encode_hex(value: bytes) -> str: return value.hex() if value else "" -def encode_base64(value: bytes) -> str: +def encode_base64(value: typing.Optional[bytes]) -> str: """ Encode bytes as base64 string. Standard Proto3 JSON mapping for bytes. @@ -130,9 +141,9 @@ def decode_hex(value: typing.Optional[str], field_name: str) -> bytes: validate_type(value, str, field_name) try: return bytes.fromhex(value) - except ValueError as e: + except ValueError as error: raise ValueError( - f"Invalid hex string for field '{field_name}': {e}" + f"Invalid hex string for field '{field_name}': {error}" ) from None @@ -151,9 +162,9 @@ def decode_base64(value: typing.Optional[str], field_name: str) -> bytes: validate_type(value, str, field_name) try: return base64.b64decode(value) - except Exception as e: + except Exception as error: raise ValueError( - f"Invalid base64 string for field '{field_name}': {e}" + f"Invalid base64 string for field '{field_name}': {error}" ) from None diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py index c4118b8d9ee..f668b94e02d 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/logs/v1/logs_service.py @@ -33,9 +33,8 @@ @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportLogsServiceRequest: +class ExportLogsServiceRequest(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportLogsServiceRequest """ @@ -75,9 +74,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogs @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportLogsServiceResponse: +class ExportLogsServiceResponse(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportLogsServiceResponse """ @@ -117,9 +115,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportLogs @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportLogsPartialSuccess: +class ExportLogsPartialSuccess(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportLogsPartialSuccess """ diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py index 5efc0797511..0ab6dd8fc90 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/metrics/v1/metrics_service.py @@ -33,9 +33,8 @@ @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportMetricsServiceRequest: +class ExportMetricsServiceRequest(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportMetricsServiceRequest """ @@ -75,9 +74,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetr @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportMetricsServiceResponse: +class ExportMetricsServiceResponse(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportMetricsServiceResponse """ @@ -117,9 +115,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportMetr @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportMetricsPartialSuccess: +class ExportMetricsPartialSuccess(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportMetricsPartialSuccess """ diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py index fab5a32c4b4..589b596b81a 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/profiles/v1development/profiles_service.py @@ -33,9 +33,8 @@ @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportProfilesServiceRequest: +class ExportProfilesServiceRequest(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportProfilesServiceRequest """ @@ -80,9 +79,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProf @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportProfilesServiceResponse: +class ExportProfilesServiceResponse(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportProfilesServiceResponse """ @@ -122,9 +120,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportProf @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportProfilesPartialSuccess: +class ExportProfilesPartialSuccess(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportProfilesPartialSuccess """ diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py index 6db2fcb3203..2c2224664bb 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/collector/trace/v1/trace_service.py @@ -33,9 +33,8 @@ @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportTraceServiceRequest: +class ExportTraceServiceRequest(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportTraceServiceRequest """ @@ -75,9 +74,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTrac @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportTraceServiceResponse: +class ExportTraceServiceResponse(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportTraceServiceResponse """ @@ -117,9 +115,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ExportTrac @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExportTracePartialSuccess: +class ExportTracePartialSuccess(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExportTracePartialSuccess """ diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py index 880a93343c3..784eb3d3137 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/common/v1/common.py @@ -32,9 +32,8 @@ @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class AnyValue: +class AnyValue(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message AnyValue """ @@ -106,9 +105,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "AnyValue": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ArrayValue: +class ArrayValue(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ArrayValue """ @@ -148,9 +146,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ArrayValue @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class KeyValueList: +class KeyValueList(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message KeyValueList """ @@ -190,9 +187,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValueLi @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class KeyValue: +class KeyValue(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message KeyValue """ @@ -238,9 +234,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "KeyValue": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class InstrumentationScope: +class InstrumentationScope(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message InstrumentationScope """ @@ -298,9 +293,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Instrument @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class EntityRef: +class EntityRef(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message EntityRef """ diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py index 85be190ec13..ca2e42c816d 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py @@ -76,9 +76,8 @@ class LogRecordFlags(enum.IntEnum): LOG_RECORD_FLAGS_TRACE_FLAGS_MASK = 255 @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class LogsData: +class LogsData(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message LogsData """ @@ -118,9 +117,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "LogsData": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ResourceLogs: +class ResourceLogs(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ResourceLogs """ @@ -171,9 +169,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceLo @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ScopeLogs: +class ScopeLogs(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ScopeLogs """ @@ -224,9 +221,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeLogs" @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class LogRecord: +class LogRecord(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message LogRecord """ diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py index ceb02129f07..fa9814334f2 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/metrics/v1/metrics.py @@ -54,9 +54,8 @@ class DataPointFlags(enum.IntEnum): DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK = 1 @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class MetricsData: +class MetricsData(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message MetricsData """ @@ -96,9 +95,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "MetricsDat @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ResourceMetrics: +class ResourceMetrics(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ResourceMetrics """ @@ -149,9 +147,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceMe @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ScopeMetrics: +class ScopeMetrics(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ScopeMetrics """ @@ -202,9 +199,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeMetri @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Metric: +class Metric(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Metric """ @@ -287,9 +283,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Metric": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Gauge: +class Gauge(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Gauge """ @@ -329,9 +324,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Gauge": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Sum: +class Sum(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Sum """ @@ -383,9 +377,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Sum": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Histogram: +class Histogram(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Histogram """ @@ -431,9 +424,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Histogram" @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExponentialHistogram: +class ExponentialHistogram(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExponentialHistogram """ @@ -479,9 +471,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Exponentia @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Summary: +class Summary(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Summary """ @@ -521,9 +512,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Summary": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class NumberDataPoint: +class NumberDataPoint(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message NumberDataPoint """ @@ -594,9 +584,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "NumberData @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class HistogramDataPoint: +class HistogramDataPoint(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message HistogramDataPoint """ @@ -687,17 +676,15 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "HistogramD @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ExponentialHistogramDataPoint: +class ExponentialHistogramDataPoint(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ExponentialHistogramDataPoint """ @typing.final - @opentelemetry.proto_json._json_codec.json_serde @_dataclass - class Buckets: + class Buckets(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Buckets """ @@ -843,17 +830,15 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Exponentia @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class SummaryDataPoint: +class SummaryDataPoint(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message SummaryDataPoint """ @typing.final - @opentelemetry.proto_json._json_codec.json_serde @_dataclass - class ValueAtQuantile: + class ValueAtQuantile(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ValueAtQuantile """ @@ -962,9 +947,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "SummaryDat @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Exemplar: +class Exemplar(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Exemplar """ diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py index 02fa2ad7044..6ad4eb56ac5 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/profiles/v1development/profiles.py @@ -34,9 +34,8 @@ @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ProfilesDictionary: +class ProfilesDictionary(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ProfilesDictionary """ @@ -106,9 +105,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ProfilesDi @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ProfilesData: +class ProfilesData(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ProfilesData """ @@ -153,9 +151,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ProfilesDa @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ResourceProfiles: +class ResourceProfiles(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ResourceProfiles """ @@ -206,9 +203,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourcePr @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ScopeProfiles: +class ScopeProfiles(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ScopeProfiles """ @@ -259,9 +255,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeProfi @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Profile: +class Profile(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Profile """ @@ -353,9 +348,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Profile": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Link: +class Link(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Link """ @@ -400,9 +394,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Link": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ValueType: +class ValueType(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ValueType """ @@ -449,9 +442,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ValueType" @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Sample: +class Sample(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Sample """ @@ -513,9 +505,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Sample": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Mapping: +class Mapping(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Mapping """ @@ -576,9 +567,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Mapping": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Stack: +class Stack(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Stack """ @@ -618,9 +608,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Stack": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Location: +class Location(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Location """ @@ -676,9 +665,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Location": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Line: +class Line(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Line """ @@ -729,9 +717,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Line": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Function: +class Function(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Function """ @@ -789,9 +776,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Function": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class KeyValueAndUnit: +class KeyValueAndUnit(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message KeyValueAndUnit """ diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py index e20f21e516b..3525242fe99 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/resource/v1/resource.py @@ -33,9 +33,8 @@ @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Resource: +class Resource(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Resource """ diff --git a/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py b/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py index dda9433d590..96b0867a32f 100644 --- a/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py +++ b/opentelemetry-proto-json/src/opentelemetry/proto_json/trace/v1/trace.py @@ -46,9 +46,8 @@ class SpanFlags(enum.IntEnum): SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 512 @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class TracesData: +class TracesData(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message TracesData """ @@ -88,9 +87,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "TracesData @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ResourceSpans: +class ResourceSpans(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ResourceSpans """ @@ -141,9 +139,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ResourceSp @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class ScopeSpans: +class ScopeSpans(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message ScopeSpans """ @@ -194,9 +191,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "ScopeSpans @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Span: +class Span(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Span """ @@ -215,9 +211,8 @@ class SpanKind(enum.IntEnum): SPAN_KIND_CONSUMER = 5 @typing.final - @opentelemetry.proto_json._json_codec.json_serde @_dataclass - class Event: + class Event(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Event """ @@ -273,9 +268,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span.Event return cls(**_args) @typing.final - @opentelemetry.proto_json._json_codec.json_serde @_dataclass - class Link: + class Link(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Link """ @@ -458,9 +452,8 @@ def from_dict(cls, data: builtins.dict[builtins.str, typing.Any]) -> "Span": @typing.final -@opentelemetry.proto_json._json_codec.json_serde @_dataclass -class Status: +class Status(opentelemetry.proto_json._json_codec.JsonMessage): """ Generated from protobuf message Status """ diff --git a/pyproject.toml b/pyproject.toml index a7228320562..820c142b69e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -113,6 +113,7 @@ include = [ "opentelemetry-semantic-conventions", "opentelemetry-api", "opentelemetry-sdk", + "opentelemetry-proto-json", "exporter/opentelemetry-exporter-otlp-proto-grpc", "codegen/opentelemetry-codegen-json" ] From 0511911c6f5bd9ed43cbf275f36fbee87f19372b Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Wed, 11 Mar 2026 21:20:05 -0400 Subject: [PATCH 14/15] fix link in opentelemetry-proto-json README --- opentelemetry-proto-json/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentelemetry-proto-json/README.rst b/opentelemetry-proto-json/README.rst index 748fed3bc5b..f5b0102ef74 100644 --- a/opentelemetry-proto-json/README.rst +++ b/opentelemetry-proto-json/README.rst @@ -28,7 +28,7 @@ update the ``PROTO_REPO_BRANCH_OR_COMMIT`` variable in ``../scripts/proto_codegen_json.sh``. Then run the script and commit the changes as well as any fixes needed in the OTLP exporter. -.. _opentelemetry-codegen-json: https://github.com/open-telemetry/codegen/opentelemetry-codegen-json +.. _opentelemetry-codegen-json: https://github.com/open-telemetry/opentelemetry-python/tree/main/codegen/opentelemetry-codegen-json .. _opentelemetry-proto: https://github.com/open-telemetry/opentelemetry-proto References From 18ed9ca38b1a0331c48177152743dc39399b37f2 Mon Sep 17 00:00:00 2001 From: Lukas Hering Date: Thu, 12 Mar 2026 21:48:06 -0400 Subject: [PATCH 15/15] add TODO to remove 'passenv' from tox.ini once fully upgraded to pytest 8.x.x --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 971ec6571d6..20609551021 100644 --- a/tox.ini +++ b/tox.ini @@ -168,6 +168,7 @@ deps = allowlist_externals = sh +; TODO: Remove once upgraded to pytest 8.x.x passenv = USERNAME USER