Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding debuging instructions #11

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,29 @@ 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.
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:
```
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
```
17 changes: 17 additions & 0 deletions debug.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion initializer/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading