Ibahagi sa


Databricks Apps system environment

The following describes the system environment in which your Databricks app runs:

  • Operating system: Ubuntu 22.04 LTS
  • Python environment: Python 3.11, running in a dedicated virtual environment. All dependencies are isolated within this environment, including libraries defined in requirements.txt and pre-installed libraries.
  • Node.js environment: Node.js version 22.16. Manage dependencies using npm and package.json.
  • System resources: By default, each app can use up to 2 virtual CPUs (vCPUs) and 6 GB of memory. Configure the compute size to adjust CPU and memory allocation based on your workload requirements. See Configure the compute size for a Databricks app.

View environment details

To view the environment for a specific app, including environment variables and installed packages, go to the Environment tab on the details page for the app. See View the details for a Databricks app.

Default environment variables

The following environment variables are available in every app:

Variable Description
DATABRICKS_APP_NAME The name of the running app.
DATABRICKS_WORKSPACE_ID The unique ID for the Databricks workspace the app belongs to.
DATABRICKS_HOST The URL of the Databricks workspace to which the app belongs.
DATABRICKS_APP_PORT The network port the app should listen on.
DATABRICKS_CLIENT_ID The client ID for the Databricks service principal assigned to the app.
DATABRICKS_CLIENT_SECRET The OAuth secret for the Databricks service principal assigned to the app.

App telemetry environment variables

When you enable telemetry for your app, Azure Databricks automatically configures the following environment variables in the app runtime:

Variable Value Description
OTEL_EXPORTER_OTLP_ENDPOINT http://localhost:4314 The OTLP collector endpoint
OTEL_EXPORTER_OTLP_PROTOCOL grpc The export protocol
OTEL_RESOURCE_ATTRIBUTES workspace.id=<id>,app.name=<name> Resource attributes for trace context
OTEL_SERVICE_NAME <your_app_name> The service name for telemetry data
OTEL_BSP_MAX_QUEUE_SIZE 10000 Maximum span queue size
OTEL_BLRP_MAX_QUEUE_SIZE 10000 Maximum log queue size
OTEL_BSP_MAX_EXPORT_BATCH_SIZE 512 Batch size for span exports
OTEL_BLRP_MAX_EXPORT_BATCH_SIZE 512 Batch size for log exports
OTEL_BSP_SCHEDULE_DELAY 1000 Span export interval (ms)
OTEL_BLRP_SCHEDULE_DELAY 1000 Log export interval (ms)

To learn more about configuring app telemetry, see Configure telemetry for Databricks Apps.

Default environment variables for Streamlit

If you use the Streamlit framework, the Databricks Apps environment pre-configures several Streamlit-specific environment variables:

Variable Description
STREAMLIT_SERVER_ADDRESS The server address for use by Streamlit. This value is set to 0.0.0.0 and must not be overridden.
STREAMLIT_SERVER_PORT The port for use by Streamlit. This value is set to DATABRICKS_APP_PORT and must not be overridden.
STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION Because the Databricks Apps reverse proxy protects against Cross-Site Request Forgery (XSRF), this is set to false.
STREAMLIT_SERVER_ENABLE_CORS Because the Databricks Apps reverse proxy protects against Cross-Origin Resource Sharing (CORS), This is set to false.
STREAMLIT_SERVER_HEADLESS This is set to true so Streamlit runs without opening a browser window when starting.
STREAMLIT_BROWSER_GATHER_USAGE_STATS This is set to false to prevent sending user stats to Streamlit.

Pre-installed Python libraries

The following Python libraries are pre-installed in the Databricks Apps environment. You don’t need to include them in your app unless you require a different version.

Library Version
databricks-sql-connector 3.4.0
databricks-sdk 0.33.0
mlflow-skinny 2.16.2
gradio 4.44.0
streamlit 1.38.0
shiny 1.1.0
dash 2.18.1
flask 3.0.3
fastapi 0.115.0
uvicorn[standard] 0.30.6
gunicorn 23.0.0
huggingface-hub 0.35.3
dash-ag-grid 31.2.0
dash-mantine-components 0.14.4
dash-bootstrap-components 1.6.0
plotly 5.24.1
plotly-resampler 0.10.0

No Node.js libraries are pre-installed in the Databricks Apps environment. For Node.js apps, you must explicitly list all dependencies in your package.json file to ensure they are installed at runtime.