Files
langflow/docs
Arek Mateusiak 919724523c fix: resolve ghosting issues in preload optimization (#12587)
* fix: enable preload_app option in LangflowApplication configuration

* feat: Integrate Sentry and Prometheus support in worker lifespan

- Initialize Sentry SDK in the worker lifespan if a DSN is provided, allowing for better error tracking.
- Start Prometheus HTTP server if enabled in settings, enhancing monitoring capabilities.
- Added logging for both Sentry initialization and Prometheus server startup to aid in debugging and monitoring.

Refactor existing code to defer Sentry initialization to avoid issues with process forking. This change improves the overall observability of the application.

* fix: Correct Prometheus port validation logic in create_app function

- Updated the condition for validating the Prometheus port to use 'and' instead of 'or', ensuring that the port is both greater than 0 and less than MAX_PORT. This change enhances the reliability of the Prometheus server configuration.

* test: Add unit tests for LangflowApplication.pre_fork method

- Introduced a new test suite for the pre_fork method in LangflowApplication, covering various scenarios including warnings for non-main threads and non-LISTEN TCP connections.
- Implemented tests to ensure proper handling of psutil import errors and unexpected exceptions.
- Verified that garbage collection is always executed during the pre_fork process.
- Added a fake server mock to facilitate testing without requiring a real server instance.

* refactor: Move telemetry service initialization to lifespan context

- Removed the initialization of the telemetry service from the beginning of the `get_lifespan` function and added it within the lifespan context. This change ensures that the telemetry service is only initialized when needed, improving resource management and application performance.

* fix: Enhance Sentry integration with error handling and import checks

- Added error handling for Sentry SDK initialization to log warnings if the SDK is not installed or if initialization fails.
- Updated the `setup_sentry` function to conditionally import `SentryAsgiMiddleware`, logging a warning if the import fails.
- This improves the robustness of the application by preventing crashes related to missing Sentry dependencies and providing clearer logging for debugging.

* fix: Improve Prometheus server error handling in lifespan context

- Enhanced error handling for starting the Prometheus server by adding specific checks for ImportError and OSError.
- Added logging for cases where the Prometheus client is not installed or when the port is already in use, improving clarity for debugging and operational monitoring.
- This change aims to provide more informative feedback during server startup, enhancing the overall robustness of the application.

* refactor: Rename and enhance Sentry middleware integration

- Changed the function name from `setup_sentry` to `add_sentry_middleware` for clarity.
- Updated the middleware setup to ensure Sentry is attached at request time, deferring SDK initialization to the worker lifespan to avoid ghost transactions.
- Adjusted unit tests to mock the new middleware function name, ensuring continued test coverage and functionality.

* feat: Enhance pre_fork method to identify benign threads before forking

- Introduced a new class-level constant `_BENIGN_THREAD_PREFIXES` to define known benign thread prefixes.
- Added a class method `_is_benign_thread` to check if a thread is benign based on its name.
- Updated the `pre_fork` method to log warnings for non-benign threads, improving thread management during the forking process.
- Added a unit test to ensure no warnings are emitted for benign threads, enhancing test coverage for the `pre_fork` method.

* fix: Improve logging for psutil import error handling

- Added a debug log statement to indicate when the psutil library is not installed, enhancing visibility into the application's behavior during TCP connection checks.
- This change aims to provide clearer feedback for debugging and operational monitoring when the psutil dependency is missing.

* fix: Enhance garbage collection handling in pre_fork method

- Wrapped the gc.collect() call in a try-except block to prevent crashes if an exception is raised during garbage collection.
- Added logging to capture any warnings when gc.collect() fails, improving error visibility during the pre-fork process.
- Introduced a new unit test to ensure that the pre_fork method handles gc.collect() exceptions gracefully while still calling gc.freeze().

* docs: LANGFLOW_GUNICORN_PRELOAD environment variable introduced

* refactor: Update application setup for Windows and non-Windows environments

- Introduced conditional logic to handle application setup differently based on the operating system.
- Added a factory pattern for creating the FastAPI application, improving flexibility for non-Windows systems.
- Enhanced error handling to provide clear runtime messages when the application cannot be initialized correctly.

* refactor: move test_server.py to correct unit/base location

The test file exercises langflow.server which belongs to the base package
(src/backend/base/). Moving it to src/backend/tests/unit/base/ follows the
project convention and aligns with the path expected by CI ruff checks.

Made-with: Cursor

* feat: Enhance config loading by applying GUNICORN_CMD_ARGS before programmatic options (#12313)

* feat: Enhance config loading by applying GUNICORN_CMD_ARGS before programmatic options

* docs: Add Gunicorn configuration details to environment variables documentation

* Update src/backend/base/langflow/server.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/backend/base/langflow/server.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* add unit test

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@logspace.ai>
Co-authored-by: Jordan Frazier <122494242+jordanrfrazier@users.noreply.github.com>
Co-authored-by: Jordan Frazier <jordan.frazier@datastax.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@logspace.ai>
Co-authored-by: Jordan Frazier <122494242+jordanrfrazier@users.noreply.github.com>
Co-authored-by: Jordan Frazier <jordan.frazier@datastax.com>
2026-04-17 16:53:26 +00:00
..
2026-04-13 23:23:37 +00:00
2026-03-18 20:03:49 +00:00
2026-04-14 02:07:01 +00:00
2026-04-14 02:07:01 +00:00

Website

This website is built using Docusaurus 3, a modern static website generator.

Installation

$ npm install

Local Development

$ npm run start

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

Build

$ npm run build

This command generates static content into the build directory and can be served using any static contents hosting service, including npm run serve.

Import code snippets from the repo with a line range

To pull a slice of a file into the docs, source the content with raw-loader and present the code with the CodeSnippet component. For a working example, see the Components overview.

import CodeSnippet from "@site/src/components/CodeSnippet";
import customComponent from "!!raw-loader!@langflow/src/lfx/src/lfx/custom/custom_component/custom_component.py";

<CodeSnippet
  source={customComponent}
  startLine={41}
  endLine={74}
  language="python"
  title="CustomComponent metadata (from codebase)"
  showLineNumbers
/>

Docusaurus Versioning

The versioning configuration is found in docusaurus.config.js.

Versioning example for release version 1.9.x on top of 1.8.x:

  1. Before release, the docs in the active release branch should already be set to 1.8.x, the current version.
  2. When ready to release 1.9.x, create a branch and run npm run docs:version -- 1.9.0 to snapshot the current docs.
  3. After creating a new version, update docusaurus.config.js to include the 1.9.0 release:
docs: {
  lastVersion: '1.9.0',
  versions: {
    '1.9.0': {
      label: '1.9.x',
      path: '1.9.0',
    },
    '1.8.0': {
      label: '1.8.x',
      path: '1.8.0',
    },
  },
},
  1. Test the deployment locally:
npm run build
npm run serve
  1. Create a pull request to main, and merge to create your new release.
  2. To create version 2.0.x, repeat the process: update the active release branch docs to 2.0.x when you begin working on it, then when ready to release, run npm run docs:version -- 2.0.0, update docusaurus.config.js with labels using .x notation, and merge to main.
  • lastVersion = the most recent released version (shown as "latest" in the UI).

See the Docusaurus docs for more info.

Disable versioning

  1. Remove the versions configuration from docusaurus.config.js.
  2. Delete the docs/versioned_docs/ and docs/versioned_sidebars/ directories.
  3. Delete docs/versions.json.

References

Deployment

Using SSH:

$ USE_SSH=true npm run deploy

Not using SSH:

$ GIT_USER=<Your GitHub username> npm run deploy

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the gh-pages branch.