From d57eb8f3215792decf0788d2bfac96ed1024768d Mon Sep 17 00:00:00 2001 From: Tamir David Date: Wed, 21 Aug 2024 12:19:13 +0300 Subject: [PATCH 1/3] feat: adding local pypi for debugging --- README.md | 16 +++++++++++++++- debug.Dockerfile | 17 +++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 debug.Dockerfile diff --git a/README.md b/README.md index 9b1eb94..445ba76 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,18 @@ Odigos initializer of OpenTelemetry for Python This package is utilized in the Odigos project to initialize OpenTelemetry components for automatic instrumentation of Python applications. -Note: This package is currently meant to be used in the odigos project with odigos OpAMP server. It cannot be used as a standalone package in arbitrary Python applications. \ No newline at end of file +Note: This package is currently meant to be used in the odigos project with odigos OpAMP server. It cannot be used as a standalone package in arbitrary Python applications. + + +## Local development of `odigos-opentelemetry-python` +1. Start the Local PyPI Server: +Build and run a local PyPI server with the following command: +```sh +docker build -t local-pypi-server -f debug.Dockerfile . && docker run --rm --name pypi-server -p 8080:8080 local-pypi-server +``` +- Note: You need to run the Docker build command each time you make changes to odigos-opentelemetry-python. + +2. Update the Development Configuration: +The setup.py / requirements.txt should point to the local pypi repo to pull the python package. +setup.py e.g: +`odigos-opentelemetry-python @ http://host.docker.internal:8080/packages/odigos_opentelemetry_python-0.1.1-py3-none-any.whl"` \ No newline at end of file diff --git a/debug.Dockerfile b/debug.Dockerfile new file mode 100644 index 0000000..1bef552 --- /dev/null +++ b/debug.Dockerfile @@ -0,0 +1,17 @@ +# Use Python image as the base +FROM python:3.11 + +# Install necessary tools +RUN pip install --no-cache-dir setuptools wheel pypiserver + +# Define working directory +WORKDIR /app + +# Copy the entire project directory to the container +COPY . /app/odigos-opentelemetry-python + +# Set the entry point to build the package and run the PyPI server using exec +ENTRYPOINT ["bash", "-c", "cd /app/odigos-opentelemetry-python && python setup.py sdist bdist_wheel && echo 'Serving python packages' && exec pypi-server run -p 8080 -P . -a . dist/"] + +# Expose the PyPI server port +EXPOSE 8080 From adf1470e27cefbf0eb66894b8bb03b33bc80fdfa Mon Sep 17 00:00:00 2001 From: Tamir David Date: Wed, 21 Aug 2024 12:23:15 +0300 Subject: [PATCH 2/3] docs: improve readme with examples --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 445ba76..17e09e7 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,15 @@ docker build -t local-pypi-server -f debug.Dockerfile . && docker run --rm --nam 2. Update the Development Configuration: The setup.py / requirements.txt should point to the local pypi repo to pull the python package. setup.py e.g: -`odigos-opentelemetry-python @ http://host.docker.internal:8080/packages/odigos_opentelemetry_python-0.1.1-py3-none-any.whl"` \ No newline at end of file +``` +install_requires = [ +odigos-opentelemetry-python @ http://localhost:8080/packages/odigos_opentelemetry_python-0.1.1-py3-none-any.whl +... +] +``` +requirements.txt e.g: +``` +.. +.. +odigos-opentelemetry-python @ http://localhost:8080/packages/odigos_opentelemetry_python-0.1.1-py3-none-any.whl +``` \ No newline at end of file From f2868a00e37d5d07be54185c4dfb5dc222a8c12b Mon Sep 17 00:00:00 2001 From: Tamir David Date: Wed, 21 Aug 2024 12:26:24 +0300 Subject: [PATCH 3/3] change function name --- initializer/components.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/initializer/components.py b/initializer/components.py index 80eafa1..8a19f07 100644 --- a/initializer/components.py +++ b/initializer/components.py @@ -21,7 +21,7 @@ MINIMUM_PYTHON_SUPPORTED_VERSION = (3, 8) -def _initialize_components(trace_exporters = None, metric_exporters = None, log_exporters = None , span_processor = None): +def initialize_components(trace_exporters = None, metric_exporters = None, log_exporters = None , span_processor = None): resource_attributes_event = threading.Event() client = None