Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
203 changes: 172 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@
"dependencies": {
"@opentelemetry/api": "^1.9.0",
"@opentelemetry/core": "^2.0.1",
"@opentelemetry/exporter-metrics-otlp-http": "^0.208.0",
"@opentelemetry/otlp-transformer": "^0.211.0",
"@opentelemetry/resources": "^2.0.1",
"@opentelemetry/sdk-metrics": "^2.0.1",
"@opentelemetry/sdk-trace-base": "^2.0.1",
"@traceloop/node-server-sdk": "^0.22.5",
"axios": "^1.13.4",
Expand Down
19 changes: 16 additions & 3 deletions src/api/dashboard/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ChartType,
Dimension,
FilterConfig,
Measure,
Metrics,
QueryDataParams,
QueryResponse,
Expand Down Expand Up @@ -204,12 +205,24 @@ async getSessionStats(
}

private isValidMetrics(metrics: any): metrics is Metrics {
return (
const hasBaseShape =
metrics &&
typeof metrics === "object" &&
"measure" in metrics &&
"aggregation" in metrics
);
"aggregation" in metrics;

if (!hasBaseShape) {
return false;
}

if (metrics.measure === Measure.CUSTOM) {
return (
typeof metrics.metricName === "string" &&
metrics.metricName.trim().length > 0
);
}

return true;
}

private isValidFilterConfig(filter: any): filter is FilterConfig {
Expand Down
1 change: 1 addition & 0 deletions src/api/dashboard/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class DashboardHttpClient extends NetraHttpClient {
metrics: {
measure: metrics.measure,
aggregation: metrics.aggregation,
...(metrics.metricName ? { metricName: metrics.metricName } : {}),
},
};

Expand Down
2 changes: 2 additions & 0 deletions src/api/dashboard/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export enum Measure {
TOTAL_TOKENS = "Total Tokens",
AUDIO_DURATION = "Audio Duration",
CHARACTER_COUNT = "Character Count",
CUSTOM = "Custom",
}

export enum Aggregation {
Expand Down Expand Up @@ -133,6 +134,7 @@ export interface Filter {
export interface Metrics {
measure: Measure;
aggregation: Aggregation;
metricName?: string;
}

export interface Dimension {
Expand Down
Loading