You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues/discussions — no feature request covers runtime metrics exposure for the plugin daemon.
Background
dify-plugin-daemon carries all LLM and tool invocations in self-hosted Dify (1.0+), yet exposes zero runtime metrics. Under high-concurrency workflow runs it is impossible to answer:
Is throughput limited by the daemon itself, a specific plugin, or the upstream model API?
How many invokes are queued vs executing, per plugin?
Which plugin is leaking processes or erroring silently?
We ended up correlating api-side outbound-latency alerts (which have no target-host dimension) with daemon pod restarts — a very lossy attribution path. A capacity incident is only confirmed after user-visible failures.
Requested metrics (Prometheus text format, /metrics endpoint)
Metric
Type
Labels
Purpose
plugin_daemon_invokes_in_flight
gauge
plugin
queued/executing invokes per plugin — the saturation signal
plugin_daemon_invoke_duration_seconds
histogram
plugin, outcome
latency distribution per plugin
plugin_daemon_plugin_processes
gauge
plugin
running plugin subprocesses (detect leaks)
plugin_daemon_invoke_errors_total
counter
plugin, error_class
failures by class (timeout, crash, plugin error)
Standard Go runtime metrics (goroutines, GC, FDs) and process metrics would be a welcome bonus.
Acceptance
A /metrics endpoint (server port or dedicated), standard Prometheus text format, scrape-friendly.
Why it matters
The daemon is the LLM-calling choke point of every self-hosted deployment. With per-plugin in-flight gauges and latency histograms, bottleneck attribution becomes a dashboard query instead of a forensic exercise.
Hi, I'd like to work on this, but I would like to confirm the first-PR scope before implementing it.
I propose an initial production-ready increment that adds:
a Prometheus-compatible /metrics endpoint;
invokes-in-flight by plugin;
invoke duration by plugin and bounded outcome;
invoke errors by plugin and a bounded error class;
concurrency-focused tests proving gauges are decremented on success, error, timeout, and cancellation.
I would keep plugin process counts out of the first PR unless there is already one authoritative lifecycle point that can expose the value without polling or duplicating process state.
Do the maintainers have a preferred Prometheus library, and should /metrics be served on the existing HTTP listener or a separately configurable listener?
Opened a PR that implements the metrics called out in this issue on top of the existing Prometheus endpoint (PROMETHEUS_ENABLED, default true in .env.example):
Invoke metrics are recorded from the SSE invoke path (baseSSEWithSession). GET /metrics is now registered in addition to /metrics/.
PR:#821 — will replace with actual PR number after create
Happy to iterate on label naming or process-count semantics if maintainers prefer live instance counts over desired replica count from scale callbacks.
Activity
jjj-n commentedon Sep 20, 2026
Hi, I'd like to work on this, but I would like to confirm the first-PR scope before implementing it.
I propose an initial production-ready increment that adds:
/metricsendpoint;I would keep plugin process counts out of the first PR unless there is already one authoritative lifecycle point that can expose the value without polling or duplicating process state.
Do the maintainers have a preferred Prometheus library, and should
/metricsbe served on the existing HTTP listener or a separately configurable listener?Souravrajvi0 commentedon Sep 20, 2026
Opened a PR that implements the metrics called out in this issue on top of the existing Prometheus endpoint (
PROMETHEUS_ENABLED, default true in.env.example):plugin_daemon_invokes_in_flight{plugin}plugin_daemon_invoke_duration_seconds{plugin,outcome}plugin_daemon_invoke_errors_total{plugin,error_class}plugin_daemon_plugin_processes{plugin}(local runtime scale events + remote debug 0/1)Invoke metrics are recorded from the SSE invoke path (
baseSSEWithSession).GET /metricsis now registered in addition to/metrics/.PR: #821 — will replace with actual PR number after create
Happy to iterate on label naming or process-count semantics if maintainers prefer live instance counts over desired replica count from scale callbacks.
feat(metrics): add plugin_daemon invoke and process Prometheus metrics (