Skip to content

Commit

Permalink
Merge pull request #4 from mykolaharmash/162958-infra-ui-implement-ng…
Browse files Browse the repository at this point in the history
…inx-section

Nginx "Requests Per Connection" chart
  • Loading branch information
jennypavlova authored Aug 31, 2023
2 parents a319b1d + ea82c42 commit e237ef6
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
memoryCache,
nginxActiveConnections,
nginxRequestRate,
nginxRequestsPerConnection,
rx,
tx,
hostCount,
Expand Down Expand Up @@ -67,6 +68,7 @@ export const hostLensFormulas = {
memoryCache,
nginxActiveConnections,
nginxRequestRate,
nginxRequestsPerConnection,
rx,
tx,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { nginxActiveConnections, nginxRequestRate } from '../metric_charts/nginx';
import {
nginxActiveConnections,
nginxRequestRate,
nginxRequestsPerConnection,
} from '../metric_charts/nginx';
import type { XYConfig } from '../metric_charts/types';

export const nginxStubstatusMetrics: XYConfig[] = [nginxActiveConnections, nginxRequestRate];
export const nginxStubstatusMetrics: XYConfig[] = [
nginxActiveConnections,
nginxRequestRate,
nginxRequestsPerConnection,
];

export const nginxAccessMetrics: XYConfig[] = []; // TODO
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,18 @@ export const nginxActiveConnections: XYConfig = {
axisLeft: XY_OVERRIDES.axisLeft,
},
};

export const nginxRequestsPerConnection: XYConfig = {
id: 'RequestsPerConnection',
title: i18n.translate('xpack.infra.assetDetails.metricsCharts.nginx.requestsPerConnection', {
defaultMessage: 'Requests Per Connection',
}),

layers: [
{
data: [hostLensFormulas.nginxRequestsPerConnection],
type: 'visualization',
},
],
dataViewOrigin: 'metrics',
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ export { memoryFreeExcludingCache } from './memory_free_excluding_cache';
export { memoryCache } from './memory_cache';
export { nginxRequestRate } from './nginx_request_rate';
export { nginxActiveConnections } from './nginx_active_connections';
export { nginxRequestsPerConnection } from './nginx_requests_per_connection';
export { rx } from './rx';
export { tx } from './tx';
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import type { FormulaValueConfig } from '@kbn/lens-embeddable-utils';

export const nginxRequestsPerConnection: FormulaValueConfig = {
label: 'Requests Per Connection',
value: 'max(nginx.stubstatus.requests) / max(nginx.stubstatus.handled)',
format: {
id: 'number',
params: {
decimals: 0,
},
},
};

0 comments on commit e237ef6

Please sign in to comment.