### Install Dependencies Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/flask_sample/README.md Installs all required Python dependencies for the Flask sample application from the requirements.txt file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Dependencies Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/db_sample/README.md Installs all project dependencies locally using pip. Ensure you have a requirements.txt file in the specified directory. ```python pip install -r azure_monitor/db_sample/requirements.txt ``` -------------------------------- ### Install Dependencies Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/http_sample/README.md Installs all project dependencies locally using pip. Ensure you have a requirements.txt file in the specified directory. ```python pip install -r requirements.txt ``` -------------------------------- ### Start Django Application Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/http_sample/README.md Starts the Django development server. The application will be accessible on port 8000. ```python python manage.py runserver ``` -------------------------------- ### Install Dependencies Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/http_sample/requirements.txt Installs the necessary Python packages for Azure Monitor OpenTelemetry integration, including Django and Requests instrumentation. ```bash pip install django>=3.2.7 \ azure-monitor-opentelemetry-exporter~=1.0.0 \ opentelemetry-instrumentation-django==0.24b0 \ opentelemetry-instrumentation-requests==0.24b0 ``` -------------------------------- ### Install Project Requirements Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/db_sample/README.md Installs the necessary Python libraries for the project using pip. This command assumes a 'requirements.txt' file is present in the current directory. ```python pip install -r requirements.txt ``` -------------------------------- ### Start Local HTTP Webserver Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/http_sample/README.md Starts a local HTTP webserver on port 8080, likely used as a target for tracing requests. ```python python third.py ``` -------------------------------- ### Run Endpoint Application Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/flask_sample/README.md Starts a secondary Flask application via a WSGI server, usually on http://localhost:5001, for features like 'Save to File'. ```bash python endpoint.py ``` -------------------------------- ### Initiate Trace Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/http_sample/README.md Starts the initial request in the distributed tracing scenario. This script acts as the entry point, triggering calls to the Django app and then to the local webserver. ```python python first.py ``` -------------------------------- ### Flask "To-Do" Sample Application Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/README.md Sample application demonstrating the use of OpenTelemetry Azure Monitor exporters with a Flask application. It shows how to instrument a web framework and track telemetry. ```python # This is a placeholder for the Flask "To-Do" Sample Application code. # Refer to the README for detailed instructions and code examples. # Link: ./azure_monitor/flask_sample/README.md ``` -------------------------------- ### Run Flask Application Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/flask_sample/README.md Executes the main Flask application sample.py, typically running on http://localhost:5000. ```bash python sample.py ``` -------------------------------- ### Todo App List Display Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/flask_sample/app/templates/index.html Displays incomplete and completed todo items. It iterates through the lists and shows the text of each todo item. ```html Incomplete Items ---------------- {% for todo in incomplete %}* {{todo.text}} {% endfor %} Completed Items --------------- {% for todo in complete %}* {{ todo.text }} {% endfor %} ``` -------------------------------- ### Python Dependencies for Azure Monitor OpenTelemetry Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/flask_sample/requirements.txt Lists the required Python packages for integrating Azure Monitor with OpenTelemetry in a Flask application. This includes Flask, Flask-SQLAlchemy, Flask-WTF, the Azure Monitor exporter, and specific OpenTelemetry instrumentation packages for Flask, Requests, and SQLAlchemy. ```python flask >= 2.01 flask-sqlalchemy >= 2.4.1 flask-wtf >= 0.14.3 azure-monitor-opentelemetry-exporter ~= 1.0.0 opentelemetry-instrumentation-flask == 0.24b0 opentelemetry-instrumentation-requests == 0.24b0 opentelemetry-instrumentation-sqlalchemy == 0.24b0 ``` -------------------------------- ### Todo App Form Rendering Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/flask_sample/app/templates/index.html Renders the submit button and input field for the Todo application form. It also handles displaying flashed messages. ```html {{ form.valid_submit(class_="save-button") }} {% with messages = get_flashed_messages() %} {% if messages %} {% for message in messages %} {{ message }} {% endfor %} {% endif %} {% endwith %} {{ form.add_input(class_="new-todo", placeholder="Enter a new task..." ) }} ``` -------------------------------- ### Python Logger Class using OpenCensus Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/README.md Sample application showcasing a Python logger class that utilizes OpenCensus for telemetry tracking. It demonstrates integration with Azure Monitor. ```python # This is a placeholder for the Python Logger class using OpenCensus Sample Application code. # Refer to the README for detailed instructions and code examples. # Link: ./azure_monitor/python_logger_opencensus_azure/README.md ``` -------------------------------- ### Configure Connection String Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/flask_sample/README.md Specifies the connection string for sending telemetry data to Azure Monitor. This can be set in config.py or as an environment variable. ```python CONNECTION_STRING = ``` -------------------------------- ### Configure Database URI Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/flask_sample/README.md Sets the database connection URI for the Flask application. The default is a local sqlite database. ```python SQLALCHEMY_DATABASE_URI = ``` -------------------------------- ### Todo App - Blacklisted URL Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/azure_monitor/flask_sample/app/templates/blacklist.html This snippet demonstrates how to configure Azure Monitor OpenTelemetry to exclude specific URLs from tracing telemetry. The 'Todo Page' URL is blacklisted, ensuring no tracing data is sent for requests to this endpoint. ```python # Assuming configuration is done elsewhere, this represents the concept: # from opentelemetry.sdk.resources import Resource # from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter # from opentelemetry.sdk.trace import TracerProvider # from opentelemetry.sdk.trace.export import BatchSpanProcessor # tracer_provider = TracerProvider( # resource=Resource.create({"service.name": "my-todo-app"}) # ) # tracer_provider.add_span_processor(BatchSpanProcessor(AzureMonitorTraceExporter())) # To blacklist a URL, you would typically configure this at the instrumentation level # or through environment variables/configuration files depending on the specific # OpenTelemetry SDK setup and any web framework integrations used. # Example conceptual configuration for excluding a URL pattern: # excluded_urls = ["/todo"] # This would be passed to the relevant instrumentation or exporter configuration. print("Todo App - Blacklisted URL example") print("The URL '/todo' is configured to not send tracing telemetry.") ``` -------------------------------- ### Information Required for Vulnerability Reports Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/SECURITY.md This section lists the essential details needed to effectively report a security vulnerability, aiding in faster triage and understanding of the issue. ```APIDOC Required Information for Vulnerability Reports: - Type of issue (e.g., buffer overflow, SQL injection, cross-site scripting) - Full paths of source file(s) related to the manifestation of the issue - Location of the affected source code (tag/branch/commit or direct URL) - Any special configuration required to reproduce the issue - Step-by-step instructions to reproduce the issue - Proof-of-concept or exploit code (if possible) - Impact of the issue, including how an attacker might exploit the issue ``` -------------------------------- ### Reporting Security Vulnerabilities to MSRC Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/SECURITY.md This section details the preferred method for reporting security vulnerabilities. It explicitly states not to use public GitHub issues and provides alternative channels for reporting. ```APIDOC Reporting Security Issues: Do not report security vulnerabilities through public GitHub issues. Preferred Method: Report to Microsoft Security Response Center (MSRC) at https://msrc.microsoft.com/create-report Alternative Method (without login): Send email to secure@microsoft.com Encrypt message with PGP key from https://www.microsoft.com/en-us/msrc/pgp-key-msrc Response Time: Expect a response within 24 hours. Follow-up: If no response, follow up via email. Additional Information: Available at microsoft.com/msrc ``` -------------------------------- ### Microsoft Bug Bounty Program Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/SECURITY.md Information regarding the Microsoft Bug Bounty Program, encouraging detailed reports for potentially higher bounty awards. ```APIDOC Microsoft Bug Bounty Program: Visit https://microsoft.com/msrc/bounty for more details about active programs. More complete reports can contribute to a higher bounty award. ``` -------------------------------- ### Microsoft Security Policy Source: https://github.com/azure-samples/azure-monitor-opentelemetry-python/blob/master/SECURITY.md Outlines Microsoft's adherence to the principle of Coordinated Vulnerability Disclosure. ```APIDOC Microsoft Security Policy: Microsoft follows the principle of Coordinated Vulnerability Disclosure (CVD). Reference: https://www.microsoft.com/en-us/msrc/cvd ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.