langgenius / langgenius/dify-plugin-daemon

[Feature]: expose Prometheus /metrics — concurrent invokes, plugin process count, invoke latency

Open
#812 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
459
Forks
313
Avg merge
5h 17m
Merged PRs (30d)
5

Description

Self Checks

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the daemon's HTTP server or server-port entry point and the code handling invokes and plugin subprocesses. Determine where queued, executing, completed, failed, and process-count events can be observed, then verify that a scrape of /metrics uses standard Prometheus text format and exposes the requested labels and metric types.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, prometheus
Domain
api, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.