Skip to content

feat(python): expose OTLP log and metric APIs - #781

Draft
bbednarski9 wants to merge 13 commits into
mainfrom
bbednarski/otel-signals-python
Draft

feat(python): expose OTLP log and metric APIs#781
bbednarski9 wants to merge 13 commits into
mainfrom
bbednarski/otel-signals-python

Conversation

@bbednarski9

@bbednarski9 bbednarski9 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Overview

Expose the core OTLP log and metric contracts through the Python and PyO3 APIs.

This is stack PR 2 of 5.

Stack navigation
  1. #780 — Core runtime, shared event model, config v4, and CLI
  2. #781 — Python and PyO3 bindings — this PR
  3. #782 — Node.js and N-API bindings
  4. #783 — C FFI and Go bindings
  5. #779 — Dynamic native/gRPC plugins and consolidated docs

Position: 2 of 5 · GitHub base: main · Logical predecessor: #780 · Layer-only diff: compare branches · Next: #782

All five PRs target main. Their branches are cumulative: this PR includes every preceding layer until those PRs merge and this branch is rebased onto the updated main. The GitHub Files changed tab therefore shows the cumulative diff. Use the layer-only comparison above to review only the code introduced by this layer.

Review and merge in order: #780#781#782#783#779. After each merge, rebase the next branch onto the updated main; its PR remains targeted at main and its cumulative diff contracts to the remaining layers.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Add Python severity, metric measurement, metric kind, and metric value-type surfaces.
  • Add optional data_schema and severity arguments to mark and pending-mark APIs.
  • Add metric() and direct OpenTelemetryLogSubscriber and OpenTelemetryMetricSubscriber lifecycle APIs.
  • Add version 4 observability log and metric configuration helpers.
  • Update exports, stubs, package guidance, and Python parity tests.

Validation:

  • cargo check -p nemo-relay-python --all-targets
  • Ruff lint and formatting checks passed.
  • Focused Python binding suite: 163 passed.
  • Full Python suite on the complete stack: 660 passed.

Breaking changes: none.

Where should the reviewer start?

Start with crates/python/src/py_types/observability.rs for native subscriber bindings and python/nemo_relay/scope.py for the public mark and metric helpers.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@github-actions github-actions Bot added size:XL PR is extra large Feature a new feature lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code labels Aug 13, 2026
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 440c15b3-f31f-46ef-927f-756de9c6a964

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@bbednarski9
bbednarski9 force-pushed the bbednarski/otel-signals-python branch from 6ff9a0f to 913e647 Compare August 13, 2026 19:16
@bbednarski9
bbednarski9 changed the base branch from bbednarski/otel-signals-core to main August 13, 2026 20:01
@github-actions github-actions Bot added size:XXL PR is very large and removed size:XL PR is extra large labels Aug 13, 2026
@bbednarski9
bbednarski9 force-pushed the bbednarski/otel-signals-python branch from 913e647 to bc658ea Compare August 13, 2026 20:05
@github-actions

Copy link
Copy Markdown

License Diff

Compared against origin/main.

Lockfile license changes

Lockfile License Changes

Rust

Added

  • None

Removed

  • None

Updated/Changed

  • None

Node

Added

  • None

Removed

  • None

Updated/Changed

  • None

Python

Added

  • None

Removed

  • None

Updated/Changed

  • None
Status output
[license-diff] selected languages: rust, node, python
[license-diff] generating current inventory
[license-diff] current: generating Rust inventory
[license-diff] current: Rust inventory complete (448 packages)
[license-diff] current: generating Node inventory
[license-diff] current: Node inventory complete (367 packages)
[license-diff] current: generating Python inventory
[license-diff] current: Python inventory complete (105 packages)
[license-diff] current inventory complete
[license-diff] checking out base ref origin/main into a temporary worktree
[license-diff] base: generating Rust inventory
[license-diff] base: Rust inventory complete (448 packages)
[license-diff] base: generating Node inventory
[license-diff] base: Node inventory complete (367 packages)
[license-diff] base: generating Python inventory
[license-diff] base: Python inventory complete (105 packages)
[license-diff] base inventory complete
[license-diff] removing temporary base worktree
[license-diff] comparing inventories
[license-diff] rendering Markdown output
[license-diff] done

Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@bbednarski9
bbednarski9 force-pushed the bbednarski/otel-signals-python branch from 70dd0f4 to dde269c Compare August 13, 2026 21:36
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@bbednarski9
bbednarski9 force-pushed the bbednarski/otel-signals-python branch from dde269c to 696e906 Compare August 13, 2026 21:52
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@bbednarski9
bbednarski9 force-pushed the bbednarski/otel-signals-python branch from 696e906 to 63bfdcc Compare August 13, 2026 22:17
@bbednarski9

Copy link
Copy Markdown
Contributor Author

Stack handoff from #780: this PR owns the Python pending-mark parity for data_schema and severity. I verified the current branch adds both constructor arguments, getters, and PendingMarkSpec conversion. Please double-check the accompanying tests preserve both fields through middleware pending-mark emission before merge.

Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@bbednarski9
bbednarski9 force-pushed the bbednarski/otel-signals-python branch from 63bfdcc to 4267ba4 Compare August 13, 2026 22:55
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
Signed-off-by: Bryan Bednarski <bbednarski@nvidia.com>
@bbednarski9
bbednarski9 force-pushed the bbednarski/otel-signals-python branch from 4267ba4 to 5c58cb3 Compare August 13, 2026 23:05
@bbednarski9

Copy link
Copy Markdown
Contributor Author

Follow-up for Observability V4: please update Python's typed helper surface with the new logs and metrics sections and make helper-created configs default to version: 4.\n\nToday ObservabilityConfig still emits v3, while core rejects v3 configs that contain logs or metrics. Please add regression coverage for creating a V4 logs/metrics config through the typed helpers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature a new feature lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code size:XXL PR is very large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant