Skip to content

feat(metrics): expose plugin_daemon invoke and process Prometheus metrics - #821

Merged
fatelei merged 1 commit into
langgenius:mainfrom
Souravrajvi0:feat/prometheus-invoke-metrics-a900
Sep 21, 2026
Merged

fatelei merged 1 commit into
langgenius:mainfrom
Souravrajvi0:feat/prometheus-invoke-metrics-a900

Conversation

@Souravrajvi0

Copy link
Copy Markdown
Contributor

Fixes #812

Summary

The daemon already served Prometheus at /metrics when PROMETHEUS_ENABLED=true; this PR adds the operational metrics requested in #812 and wires them through the main SSE invoke path.

New metrics

Metric Labels Notes
plugin_daemon_invokes_in_flight plugin Inc/dec around each plugin invoke
plugin_daemon_invoke_duration_seconds plugin, outcome success, error, timeout, client_disconnect, session_error
plugin_daemon_invoke_errors_total plugin, error_class plugin_error, timeout, canceled, daemon_error, other
plugin_daemon_plugin_processes plugin From local runtime scale up/down; remote debug runtime uses 0/1

Also registers GET /metrics (in addition to /metrics/) for scrape configs that expect the standard path.

Existing metrics (plugin_invocations_*, HTTP metrics, runtime status gauges) are unchanged.

Tests

  • pkg/utils/metrics/invoke_daemon_test.go — in-flight lifecycle and outcome/error-class mapping
  • Hardened pluginIDFromRuntime for typed-nil runtimes in scale callbacks

Checklist

  • Tests added for invoke metric lifecycle
  • /metrics scrape path documented via standard route

Expose issue langgenius#812 metrics on the existing /metrics endpoint: in-flight
invokes, invoke duration by outcome, invoke errors by class, and per-plugin
process counts from runtime scale events. Wire invoke metrics through the SSE
invoke path and register GET /metrics alongside /metrics/.
@fatelei
fatelei merged commit 3b18b6b into langgenius:main Sep 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants