Skip to content

Commit 48992cb

Browse files
committed
Display exchangeTotal metric in the application list. Remove service proxy k8s manifests.
1 parent 2bb43d6 commit 48992cb

11 files changed

+22
-192
lines changed

charts/openshift-console-plugin/templates/consoleplugin.yaml

+1-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
{{- include "openshift-console-plugin.labels" . | nindent 4 }}
88
spec:
99
displayName: {{ default (printf "%s Plugin" (include "openshift-console-plugin.name" .)) .Values.plugin.description }}
10-
i18n:
10+
i18n:
1111
loadType: Preload
1212
backend:
1313
type: Service
@@ -16,12 +16,3 @@ spec:
1616
namespace: {{ .Release.Namespace }}
1717
port: {{ .Values.plugin.port }}
1818
basePath: {{ .Values.plugin.basePath }}
19-
proxy:
20-
- type: Service
21-
alias: {{ .Values.serviceProxy.alias }}
22-
endpoint:
23-
type: Service
24-
service:
25-
name: {{ .Values.serviceProxy.name }}
26-
namespace: {{ .Release.Namespace }}
27-
port: 443

charts/openshift-console-plugin/templates/proxy-buildconfig.yaml

-26
This file was deleted.

charts/openshift-console-plugin/templates/proxy-deploymentconfig.yaml

-74
This file was deleted.

charts/openshift-console-plugin/templates/proxy-imagestream.yaml

-29
This file was deleted.

charts/openshift-console-plugin/templates/proxy-rolebinding.yaml

-15
This file was deleted.

charts/openshift-console-plugin/templates/proxy-service.yaml

-22
This file was deleted.

charts/openshift-console-plugin/templates/proxy-serviceaccount.yaml

-14
This file was deleted.

plugin/src/components/ApplicationList.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const ApplicationList: React.FC<ApplicationListProps> = ({ apps }) => {
1818
namespace: 'Namespace',
1919
status: 'Status',
2020
runtime: 'Runtime',
21+
exchangesTotal: 'Exchanges',
2122
cpu: 'CPU',
2223
memory: 'Memory',
2324
};
@@ -213,6 +214,7 @@ export const ApplicationList: React.FC<ApplicationListProps> = ({ apps }) => {
213214
<span className="sort-icon">{sortDirection === "asc" ? "▲" : "▼"}</span>
214215
)}
215216
</Th>
217+
<Th>{columnNames.exchangesTotal}</Th>
216218
<Th
217219
onClick={() => toggleSort("cpu")}
218220
className={sortColumn === "cpu" ? `sorted ${sortDirection}` : ""}
@@ -252,6 +254,7 @@ export const ApplicationList: React.FC<ApplicationListProps> = ({ apps }) => {
252254
<Status title={`${app.cronStatus.lastSuccessfulTime}`} status={app.cronStatus.lastSuccessfulTime ? "Succeeded" : "Failed"}/>
253255
}
254256
</Td>
257+
<Td dataLabel={columnNames.exchangesTotal}>{app.exchangesTotal}</Td>
255258
<Td dataLabel={columnNames.cpu}>{app.cpu}</Td>
256259
<Td dataLabel={columnNames.memory}>{app.memory}</Td>
257260
<Td dataLabel={columnNames.runtime}>Camel: {app.metadata.annotations['camel/camel-core-version']}</Td>

plugin/src/components/ApplicationLoggingCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ const ApplicationLoggingCard: React.FC<{application: Application, active?: boole
143143
</ToolbarToggleGroup>
144144
</ToolbarContent>
145145
</Toolbar>
146-
<Table>
146+
<Table aria-label="Log Level">
147147
<Thead>
148148
<Tr>
149149
<Th>Name</Th>

plugin/src/services/CamelService.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export async function fetchJob(ns: string, name: string): Promise<JobKind> {
105105
}
106106

107107
export async function populateAdddionalInfo(app: Application): Promise<Application> {
108-
return populateCpu(app).then(populateCpuMetrics).then(populateMem).then(populateMemMetrics);
108+
return populateCpu(app).then(populateCpuMetrics).then(populateMem).then(populateMemMetrics).then(populateExchangesTotal);
109109
}
110110

111111
async function populateCpu(app: Application): Promise<Application> {
@@ -243,6 +243,20 @@ export async function populateGCOverheadMetrics(app: Application): Promise<Appli
243243
});
244244
}
245245

246+
async function populateExchangesTotal(app: Application): Promise<Application> {
247+
const ns = 'namespace="' + app.metadata.namespace + '"';
248+
const query = 'query=avg(camel_exchanges_total{' + ns + ',service="' + app.metadata.name + '"})';
249+
const queryUrl = PROMETHEUS_API_QUERY_PATH + '?' + query + '&' + ns;
250+
251+
return consoleFetchJSON(queryUrl).then((res) => {
252+
let newApp: Application = { ...app };
253+
if (res && res.data && res.data && res.data.result && res.data.result.length > 0 && res.data.result[0].value && res.data.result[0].value.length > 1) {
254+
newApp.exchangesTotal = sprintf('%.0f', res.data.result[0].value[1]);
255+
}
256+
return newApp;
257+
});
258+
}
259+
246260
/* export async function populateRoute(app: Application): Promise<Application> {
247261
return consoleFetchJSON('/api/kubernetes/apis/route.openshift.io/v1/namespaces/' + app.metadata.namespace + '/routes/' + app.metadata.name).then((route: RouteKind) => {
248262
let newApp: Application = { ...app };
@@ -312,6 +326,7 @@ export async function fetchApplication(kind: string, ns: string, name: string):
312326
}
313327

314328
export async function fetchApplicationWithMetrics(kind: string, ns: string, name: string): Promise<Application> {
329+
console.log("> fetchApplicationWithMetrics ns: " + ns + ", name: " + name);
315330
let app: Promise<Application>;
316331
switch (kind) {
317332
case 'Deployment':

plugin/src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export type Application = {
1919
kind? : string;
2020
cpu?: string;
2121
memory?: string;
22+
exchangesTotal?: string;
2223
url?: string;
2324
metrics?: Metrics;
2425
spec?: PodSpec;

0 commit comments

Comments
 (0)