洞察环境变量(Insights environment variables)#
File-based configuration
You can add _FILE to individual variables to provide their configuration in a separate file. Refer to Keeping sensitive data in separate files for more details.
Insights 为实例所有者和管理员提供工作流随时间表现的可视化。详情请参阅 Insights。
🌐 Insights gives instance owners and admins visibility into how workflows perform over time. Refer to Insights for details.
存储和压缩阈值
N8N_INSIGHTS_COMPACTION_HOURLY_TO_DAILY_THRESHOLD_DAYS 和 N8N_INSIGHTS_COMPACTION_DAILY_TO_WEEKLY_THRESHOLD_DAYS 设置 n8n 在每次压缩步骤之前(从小时桶压缩到天桶,再从天桶压缩到周桶)保留高分辨率洞察(按小时存储的指标)的天数。你可以在你的实例上配置这些天数。
提高这些数值会延迟压缩。这会向 insights_by_period 添加更多行并增加数据库的使用量。有关这与保留期的关系,请参见 Insights。
如果在压缩过程中遇到数据库负载问题,请调整压缩运行的频率以及 n8n 每次运行所处理的工作量:
🌐 If you encounter database load issues during compaction, tune how often compaction runs and how much work n8n does in each run:
- 减小
N8N_INSIGHTS_COMPACTION_INTERVAL_MINUTES以更频繁地运行压缩。这可以减少运行之间积累的数据量。 - 增加
N8N_INSIGHTS_COMPACTION_BATCH_DELAY_MILLISECONDS以延长批次之间的等待时间。 - 减少
N8N_INSIGHTS_COMPACTION_MAX_BATCHES_PER_RUN以在每次运行中处理更少的批次。 - 降低
N8N_INSIGHTS_COMPACTION_MAX_RUNTIME_SECONDS以更早停止每次运行。
这些设置仅控制压缩工作量和调度。它们不会改变保留策略或每个压缩步骤的年龄阈值。
🌐 These settings only control compaction workload and scheduling. They don't change retention or the age thresholds for each compaction step.
| Variable | Type | Default | Description |
|---|---|---|---|
N8N_DISABLED_MODULES |
String | - | Set to insights to disable the feature and metrics collection for an instance. |
N8N_INSIGHTS_COMPACTION_BATCH_SIZE |
Number | 500 | The number of raw insights data to compact in a single batch. |
N8N_INSIGHTS_COMPACTION_BATCH_DELAY_MILLISECONDS |
Number | 100 | Delay in milliseconds between full compaction batches. Increase this to wait longer between batches. Set to 0 to skip the delay. |
N8N_INSIGHTS_COMPACTION_DAILY_TO_WEEKLY_THRESHOLD_DAYS |
Number | 180 | Age in days after which n8n compacts daily insights rows to weekly. |
N8N_INSIGHTS_COMPACTION_HOURLY_TO_DAILY_THRESHOLD_DAYS |
Number | 90 | Age in days after which n8n compacts hourly insights rows to daily. |
N8N_INSIGHTS_COMPACTION_INTERVAL_MINUTES |
Number | 60 | Interval (in minutes) at which compaction should run. Decrease this to run compaction more often and reduce how much data builds up between runs. |
N8N_INSIGHTS_COMPACTION_MAX_BATCHES_PER_RUN |
Number | 1000 | Maximum number of compaction batches to process in one run. Decrease this to process fewer batches per run. Set to 0 to disable this limit. |
N8N_INSIGHTS_COMPACTION_MAX_RUNTIME_SECONDS |
Number | 300 | Maximum runtime in seconds for one compaction run. Decrease this to stop each run sooner. Set to 0 to disable this limit. |
N8N_INSIGHTS_FLUSH_BATCH_SIZE |
Number | 1000 | The maximum number of insights data to keep in the buffer before flushing. |
N8N_INSIGHTS_FLUSH_INTERVAL_SECONDS |
Number | 30 | The interval (in seconds) at which n8n flushes insights data to the database. |
N8N_INSIGHTS_MAX_AGE_DAYS |
Number | 365 | Number of days n8n keeps compacted insights data before pruning. The maximum value is 730 (two years). |
N8N_INSIGHTS_PRUNE_CHECK_INTERVAL_HOURS |
Number | 24 | How often (in hours) the instance checks for insights data older than the effective max age and deletes it. |