Python: First pass at updating `getting-started.md` to use the newer declarative, file based configuration #12639
<a href="https://easycla.lfx.linuxfoundation.org/#/?version=2"><img src="https://s3.amazonaws.com/cla-project-logo-prod/cla-signed.svg?v=2" alt="CLA Signed" align="left" height="28" width="328" ></a><br >The committers listed above are authorized under a signed CLA.<ul><li>:white_check_mark: login: s-sajid-ali / name: Sajid Ali (8ad5ae30f1d6d5781c575bb889a2ac1857cfce35)</li></ul>
Welcome, contributor! Thank you for your contribution to opentelemetry.io.
Important reminders:
<!-- pull-request-dashboard-status -->
<!-- pull-request-dashboard-status-revision:25 -->
Pull request dashboard status
Waiting on reviewers · refreshed 2026-12-03 01:12 UTC
Review the latest changes.
<details>
<summary>Status above doesn't look right?</summary>
<br>
/dashboard route:author to route it back.</details>
I'm so glad you followed through on this PR, @s-sajid-ali!
@open-telemetry/python-approvers, this comes from one of our Contribfest participants at KubeCon NA. PTAL!
Thanks for the contribution! I believe the declarative configuration for Python SDK deserves a dedicated page instead of mixing it with getting-started. Also, please refer to the package: opentelemetry-configuration in pip commands. The opentelemetry-sdk[file-configuration] is a deprecated alias.
Thanks @s-sajid-ali ! I agree with above comment; please could you give a dedicated page a try. It will still be great to point to Declarative Config from the existing Getting Started page, so maybe pare those edits down to some concise context then a link to the dedicated page.
<!-- pull-request-dashboard-author-nudge:08ee24576fd3451d871ae2e02021b665 -->
Hi @s-sajid-ali — just a friendly reminder that this pull request is waiting on you. The dashboard status comment has the open items and is kept current.
/dashboard route:reviewers.<!-- pull-request-dashboard-author-nudge-completed:08ee24576fd3451d871ae2e02021b665 -->
_Outdated as of 2026-11-27 02:33 UTC: this reminder no longer reflects the current dashboard state. Check the dashboard status comment to see whether action is needed._
Thanks for the feedback @emdneto & @tammy-baylis-swi : I've added a new page on declarative configuration that cross references the existing language neutral overview for it and the opentelemetry-python docs overview. The getting started page gets an admonition that lets readers know that a page describing this feature is available should they be interested with a link to it.
Things I'm still unsure about:
v1.43.0 is the first one to support this since it is the first release to honor OTEL_CONFIG_FILE which this example can use, though support for this has been gradually rolling in. opentelemetry.sdk.configuration.configure_sdk(...) API, yet I don't see that API documented at https://opentelemetry-python.readthedocs.io/en/latest/sdk/index.html as of this writing so that might best be addressed in a follow up PR later.Thanks again to @tiffany76 for facilitating this!
Good call on mentioning that this is experimental. Could you add a few more cautionary words to this intro paragraph? The declarative config file spec is stable, but we want to additionally warn that there could be breaking changes across minor releases.
Here would be a good place to highlight some benefits of using opentelemetry-configuration instead of the kwargs in the Getting Started page, or regular env vars like OTEL_TRACES_EXPORTER.
Thanks for another pass @s-sajid-ali !
I'm stating that thev1.43.0is the first one to support this since it is the first release to honorOTEL_CONFIG_FILEwhich this example can use, though support for this has been gradually rolling in.
Yes this version works.
[[python] Document declarative (file-based) configuration #10475](https://github.com/open-telemetry/opentelemetry.io/issues/10475) pointed out that the configuration can be done via the opentelemetry.sdk.configuration.configure_sdk(...) API, yet I don't see that API documented at https://opentelemetry-python.readthedocs.io/en/latest/sdk/index.html as of this writing so that might best be addressed in a follow up PR later.
Yes it's totally fine to follow up later 😃 Feel free to update any Python-side docs if you're interested and notice what could be better!
We have two existing similar pages that I had to dig to find! OpenTelemetry Python SDK > Declarative Configuration is sourced from this RST. Examples > Declarative Configuration is sourced from this RST. Both are similar to your new page but a little tucked away.
configure_sdk is documented here but I don't think it's set up to render out to readthedocs.
Added a paragraph above.
Added as requested. Just to confirm, did you mean that the schema for the spec can change or that the way opentelemerty-python processes this can change?
This just means that the opentelemetry-configuration Python package is not yet stable. That is, its public API methods or behavior may change in a non-SemVer compatible way across minor releases.
Thanks for the explanation, I've clarified that in the most recent commit.
emdneto
s-sajid-ali
[Exception](#exception).
Summary
This PR introduces the declarative configuration method within the
getting-started.mdpage and refreshes the sample outputs from the examples with the most current release of the Python SDK.Note that the required version is now Python 3.10+ because that is the minimum version supported by the latest SDK: https://github.com/open-telemetry/opentelemetry-python/blob/v1.45.2/pyproject.toml#L4 . The default version on MacOS is
3.9.6necessitating the note on asking users to install a newer version of Python.Exception
While all writing was done by me, I disclose that I ran into https://github.com/open-telemetry/opentelemetry-python/issues/5803. In evaluating the root cause of failure and potential fixes, the following config block:
was used as a hint from a suggestion that I did not come up with directly. I verified that it was a valid schema block by referring to https://opentelemetry.io/docs/specs/otel/configuration/types/#type-propagator and removed the spurious
baggage: {}configuration as it was not entirely necessary on a getting started page where no custom baggage was added.That block will obsolete (becoming a harmless no-op) once the SDK issue itself is resolved in https://github.com/open-telemetry/opentelemetry-python/pull/5804. This error does not show up when running the example from the SDK docs: https://opentelemetry-python.readthedocs.io/en/latest/examples/declarative-config/README.html so it would be good to have in the documentation for now and can be removed later.
Let me know if this is the right place for this concept to be introduced! I could have duplicated the split (file config vs cli) at every location, but the explicit nature of the declarative configuration clarifies some of the magic that occurs behind the scenes with the CLI options.
Partially addresses https://github.com/open-telemetry/opentelemetry.io/issues/10475, except for the demonstration of
opentelemetry.sdk.configuration.configure_sdk(...)API which will be addressed based on feedback on this PR.