langfuse_client/metrics
GET /api/public/v2/metrics — server-side aggregations over Langfuse
score data. Build a query with score_count_query and pass it to
list_score_counts(client, query).
The Langfuse v2 metrics endpoint is BETA. This module exposes only
score-count queries grouped by (name, dataType, source); broader
surface (other measures, views, dimensions) will follow the same
shape once the endpoint stabilises.
Types
Filters for list_score_counts. Build with score_count_query and
pass to list_score_counts. Window is [from_timestamp, to_timestamp)
in ISO 8601.
pub type ScoreCountQuery {
ScoreCountQuery(
view: ScoreView,
from_timestamp: String,
to_timestamp: String,
)
}
Constructors
-
ScoreCountQuery( view: ScoreView, from_timestamp: String, to_timestamp: String, )
One row of the data array: the count of scores grouped by the
(name, data_type, source) triple. count is the sum_count measure
decoded from its string representation.
pub type ScoreCountRow {
ScoreCountRow(
name: String,
data_type: String,
source: String,
count: Int,
)
}
Constructors
-
ScoreCountRow( name: String, data_type: String, source: String, count: Int, )
Values
pub fn decode(
body: String,
) -> Result(List(ScoreCountRow), json.DecodeError)
Parse a GET /api/public/v2/metrics response body for a score-count
query. Useful if you already have the raw body in hand (e.g. from a
cached/recorded response).
pub fn list_score_counts(
c: client.Client,
q: ScoreCountQuery,
) -> Result(List(ScoreCountRow), client.Error)
Aggregate score counts for the query. Returns one row per distinct
(name, data_type, source) combination present in the window.
Erlang-only — see langfuse_client/client module docs.
pub fn score_count_query(
view view: ScoreView,
from from_timestamp: String,
to to_timestamp: String,
) -> ScoreCountQuery
Build a query for counts of scores grouped by (name, data_type, source) in the given window.