@@ -105,7 +105,7 @@ export async function fetchJob(ns: string, name: string): Promise<JobKind> {
105105}
106106
107107export async function populateAdddionalInfo ( app : Application ) : Promise < Application > {
108- return populateCpu ( app ) . then ( populateCpuMetrics ) . then ( populateMem ) . then ( populateMemMetrics ) . then ( populateExchangesTotal ) ;
108+ return populateCpu ( app ) . then ( populateCpuMetrics ) . then ( populateMem ) . then ( populateMemMetrics ) . then ( populateCamelExchangesTotal ) . then ( populateCamelRouteExchanges ) ;
109109}
110110
111111async function populateCpu ( app : Application ) : Promise < Application > {
@@ -243,9 +243,25 @@ export async function populateGCOverheadMetrics(app: Application): Promise<Appli
243243 } ) ;
244244}
245245
246- async function populateExchangesTotal ( app : Application ) : Promise < Application > {
246+ // metrics generated from camel-micrometer
247+ async function populateCamelExchangesTotal ( app : Application ) : Promise < Application > {
247248 const ns = 'namespace="' + app . metadata . namespace + '"' ;
248- const query = 'query=avg(camel_exchanges_total{' + ns + ',service="' + app . metadata . name + '"})' ;
249+ const query = 'query=sum(camel_exchanges_total{' + ns + ',service="' + app . metadata . name + '"})' ;
250+ const queryUrl = PROMETHEUS_API_QUERY_PATH + '?' + query + '&' + ns ;
251+
252+ return consoleFetchJSON ( queryUrl ) . then ( ( res ) => {
253+ let newApp : Application = { ...app } ;
254+ 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 ) {
255+ newApp . exchangesTotal = sprintf ( '%.0f' , res . data . result [ 0 ] . value [ 1 ] ) ;
256+ }
257+ return newApp ;
258+ } ) ;
259+ }
260+
261+ // metrics generated from the opentelemetry-jmx instrumentation
262+ async function populateCamelRouteExchanges ( app : Application ) : Promise < Application > {
263+ const ns = 'namespace="' + app . metadata . namespace + '"' ;
264+ const query = 'query=sum(camel_route_exchange{k8s_namespace_name="' + app . metadata . namespace + '",k8s_deployment_name="' + app . metadata . name + '"})' ;
249265 const queryUrl = PROMETHEUS_API_QUERY_PATH + '?' + query + '&' + ns ;
250266
251267 return consoleFetchJSON ( queryUrl ) . then ( ( res ) => {
0 commit comments