Skip to content

Commit b59757b

Browse files
committed
fix: improve pipeline failure message handling and formatting.
1 parent b84bbc5 commit b59757b

File tree

4 files changed

+109
-11
lines changed

4 files changed

+109
-11
lines changed

frontend/src/app/logstash/logstash-filters/logstash-filters.component.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ <h6 class="font-weight-semibold m-0">Pipeline filters</h6>
66
</button>
77
</div>
88

9-
<div class="alert alert-danger alert-styled-right mb-3 mt-3" *ngIf="pipeline.pipelineStatus!=='up'">
10-
Pipeline start failing at <b>{{pipeline.reloads.lastFailureTimestamp | date}}</b> with error message:<br>
11-
<code [innerHTML]="pipeline.reloads.lastError.message | safe:'html'"></code>
9+
<div class="alert alert-danger alert-styled-right mb-3 mt-3" *ngIf="pipeline.pipelineStatus !== 'up'">
10+
<ng-container *ngIf="pipeline && pipeline.reloads && pipeline.reloads.lastFailureTimestamp; else unknownPipelineFailure">
11+
Pipeline start failing at <b>{{pipeline.reloads.lastFailureTimestamp | date}}</b> with error message:<br>
12+
<code [innerHTML]="pipeline.reloads.lastError.message | safe:'html'"></code>
13+
</ng-container>
14+
15+
<ng-template #unknownPipelineFailure>
16+
{{ 'The pipeline has experienced an unexpected failure.' }}
17+
</ng-template>
1218
</div>
1319

1420
<div class="row w-100 m-0 mt-3 d-flex justify-content-center align-items-center container-pipeline flex-column"

frontend/src/app/shared/chart/types/visualization.type.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class VisualizationType {
2020
userModified?: number;
2121
aggregationType?: MetricDataType;
2222
chartAction?: any;
23-
systemOwner: boolean;
23+
systemOwner?: boolean;
2424

2525
}
2626

frontend/src/app/shared/components/utm/logstash/logstash-stats/logstash-stats.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ <h6 class="text-blue-800 d-flex align-content-center justify-content-start">
1616

1717
<div class="d-flex justify-content-between align-items-center mt-3">
1818
<span class="medium-icon"><i
19-
class="icon-meter2 mr-1"></i>Workers: {{logstashPipelines.general.pipeline.workers}}</span>
19+
class="icon-meter2 mr-1"></i>Workers: {{workers}}</span>
2020
<span class="medium-icon"><i
21-
class="icon-database-menu mr-1"></i>Batch size: {{logstashPipelines.general.pipeline.batchSize}}</span>
21+
class="icon-database-menu mr-1"></i>Batch size: {{batchSize}}</span>
2222
<span class="medium-icon"><i
23-
class="icon-database-time2 mr-1"></i>Batch delay: {{logstashPipelines.general.pipeline.batchDelay}}</span>
23+
class="icon-database-time2 mr-1"></i>Batch delay: {{batchDelay}}</span>
2424
</div>
2525

2626
<div class="w-100 d-inline-block mt-3">
@@ -40,6 +40,6 @@ <h6 class="text-blue-800 d-flex align-content-center justify-content-start">
4040
<span>Heap usage ({{heapUsed + 'GB'
4141
+ ' used of ' + heapTotal + 'GB'}})</span>
4242
</div>
43-
<app-utm-progressbar [value]="logstashPipelines.general.jvm.mem.heapUsedPercent"></app-utm-progressbar>
43+
<app-utm-progressbar [value]="percentHeapUsed"></app-utm-progressbar>
4444
</div>
4545
</div>

frontend/src/app/shared/components/utm/logstash/logstash-stats/logstash-stats.component.ts

Lines changed: 95 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,118 @@ export class LogstashStatsComponent implements OnInit {
1717
}
1818

1919
get memoryPercentage(): number {
20+
if (
21+
!this.logstashPipelines ||
22+
!this.logstashPipelines.general ||
23+
!this.logstashPipelines.general.jvm ||
24+
!this.logstashPipelines.general.jvm.mem
25+
) {
26+
return 0;
27+
}
28+
2029
const part = this.logstashPipelines.general.jvm.mem.nonHeapUsedInBytes;
21-
const total = this.logstashPipelines.general.jvm.mem.nonHeapCommittedInBytes;
22-
const percentage = (part / total) * 100;
23-
return parseFloat(percentage.toFixed(2));
30+
const total = this.logstashPipelines.general.jvm.mem.nonHeapCommittedInBytes || 1; // Evita división por 0
31+
return parseFloat(((part / total) * 100).toFixed(2));
2432
}
2533

2634
get memoryUsed(): number {
35+
if (
36+
!this.logstashPipelines ||
37+
!this.logstashPipelines.general ||
38+
!this.logstashPipelines.general.jvm ||
39+
!this.logstashPipelines.general.jvm.mem
40+
) {
41+
return 0;
42+
}
43+
2744
return convertBytesToGB(this.logstashPipelines.general.jvm.mem.nonHeapUsedInBytes);
2845
}
2946

3047
get memoryTotal(): number {
48+
if (
49+
!this.logstashPipelines ||
50+
!this.logstashPipelines.general ||
51+
!this.logstashPipelines.general.jvm ||
52+
!this.logstashPipelines.general.jvm.mem
53+
) {
54+
return 0;
55+
}
56+
3157
return convertBytesToGB(this.logstashPipelines.general.jvm.mem.nonHeapCommittedInBytes);
3258
}
3359

3460
get heapUsed(): number {
61+
if (
62+
!this.logstashPipelines ||
63+
!this.logstashPipelines.general ||
64+
!this.logstashPipelines.general.jvm ||
65+
!this.logstashPipelines.general.jvm.mem
66+
) {
67+
return 0;
68+
}
69+
3570
return convertBytesToGB(this.logstashPipelines.general.jvm.mem.heapUsedInBytes);
3671
}
3772

73+
get percentHeapUsed(): number {
74+
if (
75+
!this.logstashPipelines ||
76+
!this.logstashPipelines.general ||
77+
!this.logstashPipelines.general.jvm ||
78+
!this.logstashPipelines.general.jvm.mem
79+
) {
80+
return 0;
81+
}
82+
83+
return this.logstashPipelines.general.jvm.mem.heapUsedPercent;
84+
}
85+
3886
get heapTotal(): number {
87+
if (
88+
!this.logstashPipelines ||
89+
!this.logstashPipelines.general ||
90+
!this.logstashPipelines.general.jvm ||
91+
!this.logstashPipelines.general.jvm.mem
92+
) {
93+
return 0;
94+
}
95+
3996
return convertBytesToGB(this.logstashPipelines.general.jvm.mem.heapMaxInBytes);
4097
}
4198

99+
get workers(): number {
100+
if (
101+
!this.logstashPipelines ||
102+
!this.logstashPipelines.general ||
103+
!this.logstashPipelines.general.pipeline
104+
) {
105+
return 0;
106+
}
107+
return this.logstashPipelines.general.pipeline.workers;
108+
}
109+
110+
get batchSize(): number {
111+
if (
112+
!this.logstashPipelines ||
113+
!this.logstashPipelines.general ||
114+
!this.logstashPipelines.general.pipeline
115+
) {
116+
return 0;
117+
}
118+
return this.logstashPipelines.general.pipeline.batchSize;
119+
}
120+
121+
get batchDelay(): number {
122+
if (
123+
!this.logstashPipelines ||
124+
!this.logstashPipelines.general ||
125+
!this.logstashPipelines.general.pipeline
126+
) {
127+
return 0;
128+
}
129+
return this.logstashPipelines.general.pipeline.batchDelay;
130+
}
131+
132+
133+
42134
}

0 commit comments

Comments
 (0)