This is an automated email from the ASF dual-hosted git repository.
SvenO3 pushed a commit to branch
4633-move-dataset-count-display-into-dataset-overview
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to
refs/heads/4633-move-dataset-count-display-into-dataset-overview by this push:
new f7c84f6e95 Use latest event endpoint for metrics overview
f7c84f6e95 is described below
commit f7c84f6e951423631b67a0d5aead2fc816f01bbc
Author: Sven Oehler <[email protected]>
AuthorDate: Thu Jun 25 11:49:23 2026 +0200
Use latest event endpoint for metrics overview
---
.../dataset-details-metrics.component.ts | 39 +++-------------------
1 file changed, 4 insertions(+), 35 deletions(-)
diff --git
a/ui/src/app/dataset/components/dataset-details/dataset-details-metrics/dataset-details-metrics.component.ts
b/ui/src/app/dataset/components/dataset-details/dataset-details-metrics/dataset-details-metrics.component.ts
index b347cecb12..bac1c7dc2d 100644
---
a/ui/src/app/dataset/components/dataset-details/dataset-details-metrics/dataset-details-metrics.component.ts
+++
b/ui/src/app/dataset/components/dataset-details/dataset-details-metrics/dataset-details-metrics.component.ts
@@ -95,7 +95,7 @@ export class DatasetDetailsMetricsComponent
forkJoin({
totalEventCount: this.loadTotalEventCount(),
- latestEventTimestamp: this.loadLatestEventTimestamp(now),
+ latestEventTimestamp: this.loadLatestEventTimestamp(),
dailyEventCounts: this.loadDailyEventCounts(dayBuckets, now),
})
.pipe(
@@ -116,18 +116,11 @@ export class DatasetDetailsMetricsComponent
.pipe(catchError(() => of(0)));
}
- private loadLatestEventTimestamp(now: Date): Observable<number> {
+ private loadLatestEventTimestamp(): Observable<number> {
return this.datalakeRestService
- .getData(this.dataset.measureName, {
- endDate: now.getTime(),
- startDate: 0,
- limit: 1,
- order: 'DESC',
- missingValueBehaviour: 'empty',
- columns: this.getRuntimeNames().toString(),
- })
+ .getLatestMeasurementEvents([this.dataset.measureName])
.pipe(
- map(result => this.extractLatestTimestamp(result)),
+ map(result => result[this.dataset.measureName] ?? 0),
catchError(() => of(0)),
);
}
@@ -158,22 +151,6 @@ export class DatasetDetailsMetricsComponent
);
}
- private extractLatestTimestamp(result: SpQueryResult): number {
- const series = result?.allDataSeries?.find(
- dataSeries => dataSeries.rows?.length > 0,
- );
- const row = series?.rows?.[0];
- if (!row) {
- return 0;
- }
-
- const headers = result.headers?.length
- ? result.headers
- : series.headers;
- const timestampIndex = this.getHeaderIndex(headers, 'time', 0);
- return this.toTimestamp(row[timestampIndex]);
- }
-
private normalizeDailyCounts(
result: SpQueryResult,
dayBuckets: DayBucket[],
@@ -257,14 +234,6 @@ export class DatasetDetailsMetricsComponent
return countIndex >= 0 ? countIndex : Math.min(row.length - 1, 1);
}
- private toTimestamp(value: unknown): number {
- const timestamp =
- typeof value === 'number'
- ? value
- : new Date(String(value)).getTime();
- return Number.isNaN(timestamp) ? 0 : timestamp;
- }
-
private toCount(value: unknown): number {
const count = Number(value);
return Number.isFinite(count) ? count : 0;