Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
056fdfd
Replace opentelemetry-proto with a pure-Python protobuf implementation
ocelotl Aug 3, 2026
a898f72
Make pure-Python proto transparent to downstream OTLP encoders
ocelotl Aug 20, 2026
ed4ea27
Add opentelemetry-codegen-pyproto protoc plugin (first milestone)
ocelotl Aug 22, 2026
449adf9
Add protobuf-backed opentelemetry.proto._test reference set for tests
ocelotl Sep 2, 2026
562f9f0
Point http exporter decode tests at the protobuf reference set
ocelotl Sep 2, 2026
499a489
Fix grpc exporter tests against the pure-Python proto
ocelotl Sep 2, 2026
e0ff2db
Generate the pure-Python proto message classes from the OTLP protos
ocelotl Sep 3, 2026
8695e59
Add license headers, changelog fragment, and codespell exception
ocelotl Sep 3, 2026
dedb7c0
Move proto benchmarks out of the normal test path
ocelotl Sep 3, 2026
c242f10
Apply ruff lint and format to the pure-Python proto changes
ocelotl Sep 3, 2026
9853c31
Lock the opentelemetry-proto test extra
ocelotl Sep 3, 2026
13ceb9e
Decode json-common compatibility fixtures with the protobuf reference…
ocelotl Sep 3, 2026
8f8f662
Exclude generated protobuf modules from pylint
ocelotl Sep 3, 2026
97f96b2
Give the pure-Python message base an abstract serializer for pylint
ocelotl Sep 3, 2026
3bcabb6
Ship type stubs for the proto reference set so lint resolves test imp…
ocelotl Sep 3, 2026
671c73f
Ignore the _proto class references in the docs nitpick check
ocelotl Sep 3, 2026
a0999fa
Decode OTLP test-server requests with the protobuf reference set
ocelotl Sep 4, 2026
4fdce3d
Let pylint resolve protobuf descriptor_pb2 dynamic members
ocelotl Sep 4, 2026
8d75d5a
Resolve reference-set type stubs in the proto lint env
ocelotl Sep 4, 2026
af9fa7b
Point the OTLP benchmark at the protobuf reference set
ocelotl Sep 4, 2026
d029da3
Use descriptive names in the proto tests and benchmark for pylint
ocelotl Sep 4, 2026
cca352a
Replace otlp-proto-common encoding with the pure-Python protobuf backend
ocelotl Sep 4, 2026
51ac3a6
Point the patched name and the docs nitpick target at the private enc…
ocelotl Sep 4, 2026
4d967cb
Add the changelog fragment for the otlp-proto-common move
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
1 change: 1 addition & 0 deletions .changelog/5504.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`opentelemetry-exporter-otlp-proto-common`: move the OTLP encoders into a private `opentelemetry.exporter.otlp._proto.common` package, re-exported from the unchanged public `opentelemetry.exporter.otlp.proto.common` API
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