Skip to content

feat(otel): Include opentelemetry-distro[otlp] in the otel extra - #2348

Closed
schloerke wants to merge 1 commit into
mainfrom
schloerke/otel-distro-2274
Closed

feat(otel): Include opentelemetry-distro[otlp] in the otel extra#2348
schloerke wants to merge 1 commit into
mainfrom
schloerke/otel-distro-2274

Conversation

@schloerke

@schloerke schloerke commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2274.

What

Adds opentelemetry-distro[otlp]>=0.45b0 to the shiny[otel] extra, so the standard OpenTelemetry zero-code auto-instrumentation workflow works out of the box:

pip install "shiny[otel]"
opentelemetry-instrument shiny run app.py
  • opentelemetry-distro provides the opentelemetry-instrument wrapper and the distro configuration logic that initializes the SDK before app code runs.
  • The [otlp] extra supplies the default (OTLP) exporter, and also makes it easy to switch between gRPC and HTTP transports.
  • 0.45b0 is the instrumentation release paired with opentelemetry-sdk 1.24.0 (the existing floor), so the lowest-supported-versions CI job resolves cleanly (verified with uv pip compile --python-version 3.10 --resolution lowest-direct --extra theme --extra otel).

Verification

Fresh venv with only this checkout's shiny[otel] installed:

  • opentelemetry-instrument --version works, opentelemetry.distro and the OTLP gRPC span exporter import cleanly.
  • OTEL_SERVICE_NAME=smoke-test opentelemetry-instrument --traces_exporter console shiny run app.py, then connecting a session, exports session_start, reactive_update, and session_end spans to the console with service.name: smoke-test — no code changes in the app.

Companion

posit-dev/py-shiny-site#380 documents this workflow in the OpenTelemetry Quick Start; it targets the site's rc-shiny-v1.7.0 staging branch, which merges to main when this change is released.

Installing shiny[otel] now provides the opentelemetry-instrument wrapper
and the OTLP exporter, so zero-code auto-instrumentation
(opentelemetry-instrument shiny run app.py) works without additional
installs.

Fixes #2274
@schloerke

schloerke commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #2349 (merged), which includes the identical pyproject.toml change (opentelemetry-distro[otlp]>=0.45b0 in the shiny[otel] extra) plus the docs/example overhaul making opentelemetry-instrument the documented standard setup. Noting for the record from this PR's verification: the >=0.45b0 floor was confirmed to resolve cleanly in the lowest-supported-versions CI job (uv pip compile --python-version 3.10 --resolution lowest-direct --extra theme --extra otel). The docs companion posit-dev/py-shiny-site#380 targets the site's rc-shiny-v1.7.0 staging branch, which merges to main when the release ships.

@schloerke schloerke closed this Jul 9, 2026
@schloerke
schloerke deleted the schloerke/otel-distro-2274 branch July 9, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shiny[otel] should include opentelemetry-distro for auto-instrumentation support

1 participant