-
Notifications
You must be signed in to change notification settings - Fork 47.1k
feat(core): Add Prometheus metrics for n8n Insights data #20689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(core): Add Prometheus metrics for n8n Insights data #20689
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 7 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/cli/src/metrics/prometheus-metrics.service.ts">
<violation number="1" location="packages/cli/src/metrics/prometheus-metrics.service.ts:345">
The insights metrics listener subscribes to MessageEventBus, but insights events are emitted via EventService. As a result, these gauges won’t update. Subscribe to the same event system used by the emitter (or relay the EventService event to the bus) before processing insights-metrics-calculated.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
}); | ||
|
||
// Set up event listener for insights metrics events | ||
this.eventBus.on('metrics.eventBus.event', (event) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The insights metrics listener subscribes to MessageEventBus, but insights events are emitted via EventService. As a result, these gauges won’t update. Subscribe to the same event system used by the emitter (or relay the EventService event to the bus) before processing insights-metrics-calculated.
Prompt for AI agents
Address the following comment on packages/cli/src/metrics/prometheus-metrics.service.ts at line 345:
<comment>The insights metrics listener subscribes to MessageEventBus, but insights events are emitted via EventService. As a result, these gauges won’t update. Subscribe to the same event system used by the emitter (or relay the EventService event to the bus) before processing insights-metrics-calculated.</comment>
<file context>
@@ -297,6 +299,75 @@ export class PrometheusMetricsService {
+ });
+
+ // Set up event listener for insights metrics events
+ this.eventBus.on('metrics.eventBus.event', (event) => {
+ if (event.eventName === 'insights-metrics-calculated') {
+ const { metricType, period, value, projectId } = event.payload;
</file context>
Hey @craftaholic, Thank you for your contribution. We appreciate the time and effort you’ve taken to submit this pull request. Before we can proceed, please ensure the following: Regarding new nodes: If your node integrates with an AI service that you own or represent, please email [email protected] and we will be happy to discuss the best approach. About review timelines: Thank you again for contributing to n8n. |
Summary
This PR adds Prometheus metrics integration for n8n Insights data, allowing workflow analytics to be exposed to external monitoring systems like Datadog and Grafana.
Key Features:
executions)
N8N_METRICS_INCLUDE_INSIGHTS_METRICS
environment variableHow to Test:
/metrics
endpoint for new insights metricsRelated Linear tickets, Github issues, and Community forum posts
Review / Merge checklist
release/backport
(if the PR is an urgent fix that needs to be backported)