This commit is contained in:
Roman Zabaluev 2021-07-14 11:08:42 +03:00 committed by GitHub
parent 587e08ab01
commit 9b6952c480
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 82 additions and 0 deletions

View file

@ -27,4 +27,5 @@ public class InternalClusterMetrics {
private final Map<Integer, InternalBrokerMetrics> internalBrokerMetrics; private final Map<Integer, InternalBrokerMetrics> internalBrokerMetrics;
private final List<Metric> metrics; private final List<Metric> metrics;
private final int zooKeeperStatus; private final int zooKeeperStatus;
private final String version;
} }

View file

@ -159,6 +159,7 @@ public class KafkaService {
.onlinePartitionCount(topicsMetrics.getOnlinePartitionCount()) .onlinePartitionCount(topicsMetrics.getOnlinePartitionCount())
.offlinePartitionCount(topicsMetrics.getOfflinePartitionCount()) .offlinePartitionCount(topicsMetrics.getOfflinePartitionCount())
.zooKeeperStatus(ClusterUtil.convertToIntServerStatus(zookeeperStatus)) .zooKeeperStatus(ClusterUtil.convertToIntServerStatus(zookeeperStatus))
.version(version)
.build(); .build();
return currentCluster.toBuilder() return currentCluster.toBuilder()

View file

@ -1417,6 +1417,8 @@ components:
type: array type: array
items: items:
$ref: '#/components/schemas/BrokerDiskUsage' $ref: '#/components/schemas/BrokerDiskUsage'
version:
type: string
BrokerDiskUsage: BrokerDiskUsage:
type: object type: object

View file

@ -27,6 +27,7 @@ const Brokers: React.FC<Props> = ({
diskUsage, diskUsage,
fetchClusterStats, fetchClusterStats,
fetchBrokers, fetchBrokers,
version,
}) => { }) => {
const { clusterName } = useParams<{ clusterName: ClusterName }>(); const { clusterName } = useParams<{ clusterName: ClusterName }>();
@ -56,6 +57,9 @@ const Brokers: React.FC<Props> = ({
{zkOnline ? 'Online' : 'Offline'} {zkOnline ? 'Online' : 'Offline'}
</span> </span>
</Indicator> </Indicator>
<Indicator className="is-one-third" label="Version">
{version}
</Indicator>
</MetricsWrapper> </MetricsWrapper>
<MetricsWrapper title="Partitions"> <MetricsWrapper title="Partitions">
<Indicator label="Online"> <Indicator label="Online">

View file

@ -12,6 +12,7 @@ import {
getOutOfSyncReplicasCount, getOutOfSyncReplicasCount,
getUnderReplicatedPartitionCount, getUnderReplicatedPartitionCount,
getDiskUsage, getDiskUsage,
getVersion,
} from 'redux/reducers/brokers/selectors'; } from 'redux/reducers/brokers/selectors';
import Brokers from 'components/Brokers/Brokers'; import Brokers from 'components/Brokers/Brokers';
@ -26,6 +27,7 @@ const mapStateToProps = (state: RootState) => ({
outOfSyncReplicasCount: getOutOfSyncReplicasCount(state), outOfSyncReplicasCount: getOutOfSyncReplicasCount(state),
underReplicatedPartitionCount: getUnderReplicatedPartitionCount(state), underReplicatedPartitionCount: getUnderReplicatedPartitionCount(state),
diskUsage: getDiskUsage(state), diskUsage: getDiskUsage(state),
version: getVersion(state),
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

View file

@ -26,6 +26,7 @@ describe('Brokers Component', () => {
inSyncReplicasCount={0} inSyncReplicasCount={0}
outOfSyncReplicasCount={0} outOfSyncReplicasCount={0}
underReplicatedPartitionCount={0} underReplicatedPartitionCount={0}
version="1"
fetchClusterStats={jest.fn()} fetchClusterStats={jest.fn()}
fetchBrokers={jest.fn()} fetchBrokers={jest.fn()}
diskUsage={undefined} diskUsage={undefined}
@ -61,6 +62,7 @@ describe('Brokers Component', () => {
inSyncReplicasCount={64} inSyncReplicasCount={64}
outOfSyncReplicasCount={0} outOfSyncReplicasCount={0}
underReplicatedPartitionCount={0} underReplicatedPartitionCount={0}
version="1"
fetchClusterStats={jest.fn()} fetchClusterStats={jest.fn()}
fetchBrokers={jest.fn()} fetchBrokers={jest.fn()}
diskUsage={[ diskUsage={[

View file

@ -69,6 +69,7 @@ exports[`Brokers Component Brokers Empty matches Brokers Empty snapshot 1`] = `
onlinePartitionCount={0} onlinePartitionCount={0}
outOfSyncReplicasCount={0} outOfSyncReplicasCount={0}
underReplicatedPartitionCount={0} underReplicatedPartitionCount={0}
version="1"
zooKeeperStatus={0} zooKeeperStatus={0}
> >
<div <div
@ -179,6 +180,29 @@ exports[`Brokers Component Brokers Empty matches Brokers Empty snapshot 1`] = `
</div> </div>
</div> </div>
</Indicator> </Indicator>
<Indicator
className="is-one-third"
label="Version"
>
<div
className="level-item is-one-third"
>
<div
title="Version"
>
<p
className="heading"
>
Version
</p>
<p
className="title has-text-centered"
>
1
</p>
</div>
</div>
</Indicator>
</div> </div>
</div> </div>
</MetricsWrapper> </MetricsWrapper>
@ -400,6 +424,7 @@ exports[`Brokers Component Brokers matches snapshot 1`] = `
onlinePartitionCount={64} onlinePartitionCount={64}
outOfSyncReplicasCount={0} outOfSyncReplicasCount={0}
underReplicatedPartitionCount={0} underReplicatedPartitionCount={0}
version="1"
zooKeeperStatus={1} zooKeeperStatus={1}
> >
<div <div
@ -510,6 +535,29 @@ exports[`Brokers Component Brokers matches snapshot 1`] = `
</div> </div>
</div> </div>
</Indicator> </Indicator>
<Indicator
className="is-one-third"
label="Version"
>
<div
className="level-item is-one-third"
>
<div
title="Version"
>
<p
className="heading"
>
Version
</p>
<p
className="title has-text-centered"
>
1
</p>
</div>
</div>
</Indicator>
</div> </div>
</div> </div>
</MetricsWrapper> </MetricsWrapper>

View file

@ -18,6 +18,7 @@ const ClusterWidget: React.FC<ClusterWidgetProps> = ({
bytesOutPerSec, bytesOutPerSec,
onlinePartitionCount, onlinePartitionCount,
readOnly, readOnly,
version,
}, },
}) => ( }) => (
<div className="column is-full-modile is-6"> <div className="column is-full-modile is-6">
@ -38,6 +39,10 @@ const ClusterWidget: React.FC<ClusterWidgetProps> = ({
<table className="table is-fullwidth"> <table className="table is-fullwidth">
<tbody> <tbody>
<tr>
<th>Version</th>
<td>{version}</td>
</tr>
<tr> <tr>
<th>Brokers</th> <th>Brokers</th>
<td> <td>

View file

@ -21,6 +21,12 @@ exports[`ClusterWidget when cluster is offline matches snapshot 1`] = `
className="table is-fullwidth" className="table is-fullwidth"
> >
<tbody> <tbody>
<tr>
<th>
Version
</th>
<td />
</tr>
<tr> <tr>
<th> <th>
Brokers Brokers
@ -100,6 +106,12 @@ exports[`ClusterWidget when cluster is online matches snapshot 1`] = `
className="table is-fullwidth" className="table is-fullwidth"
> >
<tbody> <tbody>
<tr>
<th>
Version
</th>
<td />
</tr>
<tr> <tr>
<th> <th>
Brokers Brokers

View file

@ -48,3 +48,8 @@ export const getDiskUsage = createSelector(
brokersState, brokersState,
({ diskUsage }) => diskUsage ({ diskUsage }) => diskUsage
); );
export const getVersion = createSelector(
brokersState,
({ version }) => version
);