From 90c167e9942ba803721ab1790f2c6832471490a3 Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Wed, 6 Dec 2023 16:17:52 -0600 Subject: [PATCH] Add doc --- prototypes/python/README.rst | 45 ++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/prototypes/python/README.rst b/prototypes/python/README.rst index e2bc0f6..8a73327 100644 --- a/prototypes/python/README.rst +++ b/prototypes/python/README.rst @@ -1,19 +1,40 @@ -OpenTelemetry Python SDK -============================================================================ +OpenTelemetry Python Configuration Prototype +============================================ -|pypi| +This prototype first needs the ``src/opentelemetry/configuration/_interna/path_function.py`` +to be generated with the ``opentelemetry.configuration.render_schema`` function. -.. |pypi| image:: https://badge.fury.io/py/opentelemetry-sdk.svg - :target: https://pypi.org/project/opentelemetry-sdk/ +Once this file is generated, implement the functions defined there. -Installation ------------- +To create any provider object first create a ``Resource`` object: -:: +.. code-block:: python - pip install opentelemetry-sdk + from opentelemetry.configuration._internal.path_function import set_resource + from opentelemetry.configuration import ( + resolve_schema, + process_schema, + create_object, + validate_configuration, + ) + from pathlib import Path -References ----------- + data_path = Path(__file__).parent.joinpath("data") -* `OpenTelemetry Project `_ + configuration = validate_configuration( + data_path.joinpath("kitchen-sink.yaml") + ) + + processed_schema = process_schema( + resolve_schema( + data_path.joinpath("opentelemetry_configuration.json") + ) + ) + + set_resource( + create_object(configuration, processed_schema, "resource") + ) + + tracer_provider = create_object( + configuration, processed_schema, "tracer_provider" + )