Skip to content

Commit c12dd26

Browse files
authored
[metrics]: Allow EPP to register metrics from extention (#1787)
The motivation is llm-d/llm-d-inference-scheduler#386 that we would like to have more metrics from llm-d inference scheduler plugin. The current metrics implementation is bundled in the runner of EPP, so this PR extends the runner to allow extention to register prometheus metrics collector. See llm-d/llm-d-inference-scheduler#405 for a draft PR of how metrics are going to be implemented in the plugin. I have tested locally that both EPP and inference scheduler metrics can be exported through the pod /metrics endpoint.
1 parent 80320ce commit c12dd26

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/epp/runner/runner.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ func NewRunner() *Runner {
143143
type Runner struct {
144144
requestControlConfig *requestcontrol.Config
145145
schedulerConfig *scheduling.SchedulerConfig
146+
customCollectors []prometheus.Collector
146147
}
147148

148149
func (r *Runner) WithRequestControlConfig(requestControlConfig *requestcontrol.Config) *Runner {
@@ -155,6 +156,11 @@ func (r *Runner) WithSchedulerConfig(schedulerConfig *scheduling.SchedulerConfig
155156
return r
156157
}
157158

159+
func (r *Runner) WithCustomCollectors(collectors ...prometheus.Collector) *Runner {
160+
r.customCollectors = collectors
161+
return r
162+
}
163+
158164
func (r *Runner) Run(ctx context.Context) error {
159165
opts := zap.Options{
160166
Development: true,
@@ -205,6 +211,9 @@ func (r *Runner) Run(ctx context.Context) error {
205211

206212
// --- Setup Metrics Server ---
207213
customCollectors := []prometheus.Collector{collectors.NewInferencePoolMetricsCollector(datastore)}
214+
if r.customCollectors != nil {
215+
customCollectors = append(customCollectors, r.customCollectors...)
216+
}
208217
metrics.Register(customCollectors...)
209218
metrics.RecordInferenceExtensionInfo(version.CommitSHA, version.BuildRef)
210219
// Register metrics handler.

0 commit comments

Comments
 (0)