Skip to content

feat(logstore): make graph field optional via env variable LOGSTORE…#30554

Merged
crazywoola merged 2 commits intolanggenius:mainfrom
scdeng:main
Jan 5, 2026
Merged

feat(logstore): make graph field optional via env variable LOGSTORE…#30554
crazywoola merged 2 commits intolanggenius:mainfrom
scdeng:main

Conversation

@scdeng
Copy link
Contributor

@scdeng scdeng commented Jan 5, 2026

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Fixes #30544

Summary

This PR introduces a new environment variable LOGSTORE_ENABLE_PUT_GRAPH_FIELD (default: "true")
to control whether the full workflow graph field is written to Aliyun LogStore.

Motivation:

  • The graph field contains the entire workflow configuration, which can be large and potentially sensitive.
  • Writing it to LogStore for every workflow execution increases log storage size and may expose internal config data.
  • In many cases, execution logs only need run-time data, and the workflow configuration can be retrieved separately when needed.

Changes:

  • Added self._enable_put_graph_field flag initialized from LOGSTORE_ENABLE_PUT_GRAPH_FIELD in LogstoreWorkflowExecutionRepository.__init__.
  • Updated _to_logstore_model to write graph only if both domain_model.graph and _enable_put_graph_field are true.
  • Default behavior remains unchanged — graph is written unless LOGSTORE_ENABLE_PUT_GRAPH_FIELD is explicitly set to "false".

Usage Example:

# disable graph field LOGSTORE_ENABLE_PUT_GRAPH_FIELD=false

With this setting, the graph field stored in LogStore will be "{}", reducing storage size.

No new dependencies were introduced.

Screenshots

Before After
LogStore always contains full graph JSON in every execution log graph JSON is omitted (as {}) when LOGSTORE_ENABLE_PUT_GRAPH_FIELD=false

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods
@scdeng scdeng requested a review from QuantumGhost as a code owner January 5, 2026 06:10
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jan 5, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @scdeng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances control over data logging by introducing an environment variable that allows users to determine whether the full workflow graph field is stored in Aliyun LogStore. This change addresses concerns regarding log storage size and the potential exposure of sensitive workflow configurations, providing flexibility to omit the graph data when only runtime execution details are required. The default setting ensures that graph data continues to be logged unless explicitly disabled.

Highlights

  • Conditional Graph Logging: Introduced a new environment variable, LOGSTORE_ENABLE_PUT_GRAPH_FIELD, to control the inclusion of workflow graph data in Aliyun LogStore.
  • Storage and Privacy Optimization: Enabled conditional writing of the graph field to LogStore, allowing it to be omitted to save storage and protect sensitive workflow configurations.
  • Backward Compatibility: Maintained the default behavior of writing the graph field, ensuring existing setups are unaffected unless the new variable is explicitly set to "false".

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dosubot dosubot bot added the 💪 enhancement New feature or request label Jan 5, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new environment variable, LOGSTORE_ENABLE_PUT_GRAPH_FIELD, to optionally control the logging of the workflow graph field. This is a valuable addition for reducing log storage and preventing sensitive configuration data from being exposed. The implementation is straightforward and correct. I have one suggestion to improve maintainability by refactoring the duplicated logic for parsing boolean values from environment variables.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 5, 2026
Copy link
Member

@crazywoola crazywoola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOGSTORE_ENABLE_PUT_GRAPH_FIELD should be added to docker/.env.example and other files as well.

Image
@dosubot dosubot bot removed the lgtm This PR has been approved by a maintainer label Jan 5, 2026
…ples, docker/middleware.env.example and docker/docker-compose.yaml
@scdeng scdeng requested a review from laipz8200 as a code owner January 5, 2026 07:56
@scdeng
Copy link
Contributor Author

scdeng commented Jan 5, 2026

✅ Updates completed and verified:

  • Added LOGSTORE_ENABLE_PUT_GRAPH_FIELD to:
    • docker/.env.example
    • docker/docker-compose.yaml
    • docker/middleware.env.example
  • Ensured the variable is passed to backend service in Docker deployments.
  • Verified locally by running:
    uv run --project api dev/pytest/pytest_config_tests.py
    → All tests passed successfully.

Thank you very much for the valuable feedback and guidance during the review — it really helped improve the quality of the changes! 🙏
Please help to re-review when convenient.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 5, 2026
@crazywoola crazywoola merged commit 591ca05 into langgenius:main Jan 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💪 enhancement New feature or request lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

2 participants