Skip to main content

Function: enableMetrics()

function enableMetrics(options: object): Promise<LocalMetricConfig[]>;
Defined in: src/utils/log-streams.ts:89 Enable metrics for a log stream. Supports explicit parameters or environment variables (GALILEO_PROJECT/GALILEO_LOG_STREAM).

Parameters

options

Configuration options

logStreamName?

string Log stream name (overrides env var)

metrics

( | string | Metric | LocalMetricConfig)[] Metrics to enable. Accepts:
  • GalileoScorers enum (e.g., GalileoScorers.Correctness)
  • String names (e.g., ‘toxicity’)
  • Metric objects (e.g., { name: ‘custom’, version: 2 })
  • LocalMetricConfig objects with scorerFn for client-side scoring

projectName?

string Project name (overrides env var)

Returns

Promise<LocalMetricConfig[]> LocalMetricConfig[] - Client-side metrics that need local processing. Server-side metrics are automatically registered.

Throws

Error if project/log stream not found or metrics don’t exist

Example

const localMetrics = await enableMetrics({
  projectName: "My Project",
  logStreamName: "Production",
  metrics: [GalileoScorers.Correctness, "toxicity"],
});
I