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

Closed
opened 2026-02-21 20:52:14 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/30554

State: closed
Merged: Yes


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
**Original Pull Request:** https://github.com/langgenius/dify/pull/30554 **State:** closed **Merged:** Yes --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. Fixes #30544 ## Summary <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. --> 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:** ```bash # 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](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `make lint` and `make type-check` (backend) and `cd web && npx lint-staged` (frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:52:14 -05:00
yindo closed this issue 2026-02-21 20:52:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#32873