Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d1d9097
Replace opentelemetry-proto with a pure-Python protobuf implementation
ocelotl Aug 3, 2026
372f6e9
Make pure-Python proto transparent to downstream OTLP encoders
ocelotl Aug 20, 2026
e394ce9
Add opentelemetry-codegen-pyproto protoc plugin (first milestone)
ocelotl Aug 22, 2026
6b7858f
Add protobuf-backed opentelemetry.proto._test reference set for tests
ocelotl Sep 2, 2026
01e204f
Point http exporter decode tests at the protobuf reference set
ocelotl Sep 2, 2026
43024e9
Fix grpc exporter tests against the pure-Python proto
ocelotl Sep 2, 2026
a80087f
Generate the pure-Python proto message classes from the OTLP protos
ocelotl Sep 3, 2026
0169d20
Add license headers, changelog fragment, and codespell exception
ocelotl Sep 3, 2026
3aca5be
Move proto benchmarks out of the normal test path
ocelotl Sep 3, 2026
edfbffc
Apply ruff lint and format to the pure-Python proto changes
ocelotl Sep 3, 2026
e3a33dc
Lock the opentelemetry-proto test extra
ocelotl Sep 3, 2026
286ad0d
Decode json-common compatibility fixtures with the protobuf reference…
ocelotl Sep 3, 2026
80d4b6a
Exclude generated protobuf modules from pylint
ocelotl Sep 3, 2026
bc6e20d
Give the pure-Python message base an abstract serializer for pylint
ocelotl Sep 3, 2026
2446143
Ship type stubs for the proto reference set so lint resolves test imp…
ocelotl Sep 3, 2026
54cbe2f
Ignore the _proto class references in the docs nitpick check
ocelotl Sep 3, 2026
9fc9bdf
Decode OTLP test-server requests with the protobuf reference set
ocelotl Sep 4, 2026
4cd75c6
Let pylint resolve protobuf descriptor_pb2 dynamic members
ocelotl Sep 4, 2026
6635aea
Resolve reference-set type stubs in the proto lint env
ocelotl Sep 4, 2026
be0af7f
Point the OTLP benchmark at the protobuf reference set
ocelotl Sep 4, 2026
abbba5e
Use descriptive names in the proto tests and benchmark for pylint
ocelotl Sep 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changelog/5503.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`opentelemetry-proto`: replace the protobuf dependency with a pure-Python wire-format implementation, so opentelemetry-proto and the OTLP exporters no longer require the protobuf package
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[codespell]
# skipping auto generated folders
skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,.git,./opentelemetry-semantic-conventions,*-requirements*.txt
ignore-words-list = ans,ue,ot,hist,ro,astroid
ignore-words-list = ans,ue,ot,hist,ro,astroid,nd
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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.
ignore-patterns=^models\.py$
ignore-patterns=^models\.py$,.*_pb2.*\.py$

# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
Expand Down Expand Up @@ -174,7 +174,7 @@ contextmanager-decorators=contextlib.contextmanager, _agnosticcontextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=zipkin_pb2.*
generated-members=zipkin_pb2.*,descriptor_pb2.*,google.protobuf.descriptor_pb2.*

# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
Expand Down
21 changes: 21 additions & 0 deletions codegen/opentelemetry-codegen-pyproto/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
opentelemetry-codegen-pyproto
=============================

A ``protoc`` plugin that generates pure-Python, encode-only protobuf-wire
message classes for the OpenTelemetry proto definitions.

The generated classes reproduce the behaviour of the hand-written
``opentelemetry._proto.*_pb2`` modules: every message inherits the
``Message`` base from ``opentelemetry._proto._pyprotobuf.message`` and
implements ``SerializeToString`` using the field helpers in
``opentelemetry._proto._pyprotobuf.fields``.

Usage
-----

Install the plugin so ``protoc-gen-pyproto`` is on ``PATH``, then run::

python -m grpc_tools.protoc \
-I /path/to/opentelemetry-proto \
--pyproto_out=OUTPUT_DIR \
/path/to/opentelemetry-proto/opentelemetry/proto/common/v1/common.proto
49 changes: 49 additions & 0 deletions codegen/opentelemetry-codegen-pyproto/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "opentelemetry-codegen-pyproto"
version = "0.0.0" # Not published to PyPI
description = "Protobuf plugin to generate pure-Python encode-only wire serializers for OpenTelemetry protobuf messages"
readme = "README.rst"
license = "Apache-2.0"
requires-python = ">=3.10"
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.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Private :: Do Not Upload",
]
dependencies = [
"protobuf>=4.25.3",
"types-protobuf>=4.24",
]

[project.scripts]
protoc-gen-pyproto = "opentelemetry.codegen.pyproto.plugin:main"

[project.urls]
Homepage = "https://github.com/open-telemetry/opentelemetry-python/tree/main/codegen/opentelemetry-codegen-pyproto"
Repository = "https://github.com/open-telemetry/opentelemetry-python"

[tool.hatch.version]
path = "src/opentelemetry/codegen/pyproto/version/__init__.py"

[tool.hatch.build.targets.sdist]
include = [
"/src",
]

[tool.hatch.build.targets.wheel]
packages = ["src/opentelemetry"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
Loading
Loading