### Setting Up Project Environment (Shell) Source: https://github.com/hyperdxio/fastapi-opentelemetry-example/blob/main/README.md This snippet provides shell commands to clone the repository, navigate into the project directory, create and activate a Python virtual environment, and install project dependencies using pip. These steps are essential for initial project setup and preparing the environment for running the application. ```Shell git clone https://github.com/hyperdxio/fastapi-opentelemetry-example.git cd fastapi-opentelemetry-example # Create virtualenv virtualenv -p python3 venv source venv/bin/activate # Install Dependencies pip install -r requirements.txt ``` -------------------------------- ### Running Instrumented FastAPI App with HyperDX (Shell) Source: https://github.com/hyperdxio/fastapi-opentelemetry-example/blob/main/README.md This command runs the FastAPI application (`main:app`) with OpenTelemetry auto-instrumentation, configured to send telemetry data to HyperDX cloud. It requires setting the `HYPERDX_API_KEY` and `OTEL_SERVICE_NAME` environment variables for proper authentication and service identification. ```Shell HYPERDX_API_KEY='' \ OTEL_SERVICE_NAME='' \ opentelemetry-instrument uvicorn main:app ``` -------------------------------- ### Running Instrumented FastAPI App with OTLP Collector (Shell) Source: https://github.com/hyperdxio/fastapi-opentelemetry-example/blob/main/README.md This command runs the FastAPI application with OpenTelemetry auto-instrumentation, directing telemetry to a generic OTLP compatible collector. It configures the OTLP endpoint, enables Python logging auto-instrumentation, and sets the service name for the exported telemetry. ```Shell OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 \ OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true \ OTEL_SERVICE_NAME='' \ opentelemetry-instrument uvicorn main:app ``` -------------------------------- ### Jinja2 Template for To-Do List Display Source: https://github.com/hyperdxio/fastapi-opentelemetry-example/blob/main/templates/index.html This Jinja2 template snippet iterates over a `todo_list` to render each To-Do item's details, including its ID, title, and completion status. It dynamically displays 'In progress' or 'Completed' based on the `todo.complete` boolean and generates update/delete links for each item. This template is designed to be rendered by a FastAPI backend. ```Jinja2 {% for todo in todo_list %} {{ todo.id }} {{ todo.title }} {% if todo.complete == False %} In progress {% else %} Completed {% endif %} [Update](/update/{{ todo.id }}) [Delete](/delete/{{ todo.id }}) {% endfor %} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.