MetricsConfigLoader

org.llm4s.config.MetricsConfigLoader

Loads the Prometheus metrics backend from llm4s.metrics: a org.llm4s.metrics.MetricsCollector, plus the org.llm4s.metrics.PrometheusEndpoint serving it when one was started.

This replaces Llm4sConfig.metrics(), which left core with Prometheus (#1133): MetricsConfigLoader.default() is the same call against the same keys.

Configuration keys, with their defaults in this module's reference.conf:

  • llm4s.metrics.enabled: enable metrics collection (default: false)
  • llm4s.metrics.prometheus.enabled: use the Prometheus backend when metrics are enabled (default: true)
  • llm4s.metrics.prometheus.port: port for the /metrics HTTP endpoint (default: 9090)

Example application.conf:

llm4s {
 metrics {
   enabled = true
   prometheus {
     enabled = true
     port = 9090
   }
 }
}

When enabled, loading starts the HTTP endpoint; stop it with PrometheusEndpoint.stop(). Other code should receive the MetricsCollector by dependency injection rather than read these keys itself.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

load against the current environment: system properties, application.conf and every reference.conf.

load against the current environment: system properties, application.conf and every reference.conf.

Attributes

def load(source: ConfigSource): Result[(MetricsCollector, Option[PrometheusEndpoint])]

Load metrics configuration and construct collector with optional endpoint.

Load metrics configuration and construct collector with optional endpoint.

Value parameters

source

Configuration source; it must contain an llm4s block

Attributes

Returns

Result containing (MetricsCollector, Option[PrometheusEndpoint])