Skip to content

Commit 472c5ab

Browse files
committed
refactor: store normalizeModelMetricLabel result in local variable to avoid redundant call
1 parent 3e9d5fc commit 472c5ab

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

apps/server/src/observability/Metrics.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ export const providerTurnMetricAttributes = (input: {
155155
readonly provider: string;
156156
readonly model: string | null | undefined;
157157
readonly extra?: Readonly<Record<string, unknown>>;
158-
}) =>
159-
compactMetricAttributes({
158+
}) => {
159+
const modelFamily = normalizeModelMetricLabel(input.model);
160+
return compactMetricAttributes({
160161
provider: input.provider,
161-
...(normalizeModelMetricLabel(input.model)
162-
? { modelFamily: normalizeModelMetricLabel(input.model) }
163-
: {}),
162+
...(modelFamily ? { modelFamily } : {}),
164163
...input.extra,
165164
});
165+
};

0 commit comments

Comments
 (0)