🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(api): add countObservations to metrics endpoint, model nullable (#1779)
Marc Klingen3f18e42fef8c
diff --git a/fern/apis/server/definition/metrics.yml b/fern/apis/server/definition/metrics.ymlindex 38757314c3..f51fcc7ded 100644--- a/fern/apis/server/definition/metrics.yml+++ b/fern/apis/server/definition/metrics.yml@@ -47,12 +47,13 @@ types:properties:date: datecountTraces: integer+ countObservations: integertotalCost: doubleusage: list<UsageByModel>UsageByModel:docs: Daily usage of a given model. Usage corresponds to the unit set for the specific model (e.g. tokens).properties:- model: string+ model: optional<string>inputUsage: integeroutputUsage: integertotalUsage: integerdiff --git a/web/generated/openapi-server/openapi.yml b/web/generated/openapi-server/openapi.ymlindex 82d5cbbef9..32575df62f 100644--- a/web/generated/openapi-server/openapi.yml+++ b/web/generated/openapi-server/openapi.yml@@ -2397,6 +2397,8 @@ components:type: stringcountTraces:type: integer+ countObservations:+ type: integertotalCost:type: numberformat: double@@ -2407,6 +2409,7 @@ components:required:- date- countTraces+ - countObservations- totalCost- usageUsageByModel:@@ -2418,6 +2421,7 @@ components:properties:model:type: string+ nullable: trueinputUsage:type: integeroutputUsage:@@ -2425,7 +2429,6 @@ components:totalUsage:type: integerrequired:- - model- inputUsage- outputUsage- totalUsagediff --git a/web/src/pages/api/public/metrics/daily.ts b/web/src/pages/api/public/metrics/daily.tsindex db7508a40f..a022d5123a 100644--- a/web/src/pages/api/public/metrics/daily.ts+++ b/web/src/pages/api/public/metrics/daily.ts@@ -108,6 +108,7 @@ export default async function handler(SELECTDATE_TRUNC('DAY', t.timestamp) "date",count(distinct t.id)::integer count_traces,+ count(distinct o.id)::integer count_observations,SUM(o.calculated_total_cost)::DOUBLE PRECISION total_costFROM traces tLEFT JOIN observations_view o ON o.project_id = t.project_id AND t.id = o.trace_id@@ -122,6 +123,7 @@ export default async function handler(SELECTTO_CHAR(COALESCE(ds.date, daily_model_usage.date), 'YYYY-MM-DD') AS "date",COALESCE(count_traces, 0) "countTraces",+ COALESCE(count_observations, 0) "countObservations",COALESCE(total_cost, 0) "totalCost",COALESCE(daily_usage_json, '[]'::JSON) usageFROM