Skip to content

Commit

Permalink
Fix client type value in statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
puzpuzpuz committed Jan 20, 2021
1 parent e635cba commit e1786f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/network/ClientConnectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ import {AddressProvider} from '../connection/AddressProvider';
const CONNECTION_REMOVED_EVENT_NAME = 'connectionRemoved';
const CONNECTION_ADDED_EVENT_NAME = 'connectionAdded';

const CLIENT_TYPE = 'NJS';
/** @internal */
export const CLIENT_TYPE = 'NJS';
const SERIALIZATION_VERSION = 1;
const SET_TIMEOUT_MAX_DELAY = 2147483647;
const BINARY_PROTOCOL_VERSION = Buffer.from('CP2');
Expand Down
3 changes: 2 additions & 1 deletion src/statistics/Statistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import {HazelcastClient} from '../HazelcastClient';
import {ClientConnection} from '../network/ClientConnection';
import {CLIENT_TYPE} from '../network/ClientConnectionManager';
import {Properties} from '../config/Properties';
import {ClientStatisticsCodec} from '../codec/ClientStatisticsCodec';
import {
Expand Down Expand Up @@ -238,7 +239,7 @@ export class Statistics {
connection: ClientConnection): void {
this.addAttribute(stats, 'lastStatisticsCollectionTime', Date.now());
this.addAttribute(stats, 'enterprise', 'false');
this.addAttribute(stats, 'clientType', this.client.getClusterService().getLocalClient().type);
this.addAttribute(stats, 'clientType', CLIENT_TYPE);
this.addAttribute(stats, 'clientVersion', BuildInfo.getClientVersion());
this.addAttribute(stats, 'clusterConnectionTimestamp', connection.getStartTime());
this.addAttribute(stats, 'clientAddress', connection.getLocalAddress().toString());
Expand Down
2 changes: 1 addition & 1 deletion test/integration/statistics/StatisticsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe('StatisticsTest (default period)', function () {
expect(extractIntStatValue(stats, 'lastStatisticsCollectionTime')).to.be
.within(Date.now() - Statistics.PERIOD_SECONDS_DEFAULT_VALUE * 2000, Date.now());
expect(extractBooleanStatValue(stats, 'enterprise')).to.be.false;
expect(extractStringStatValue(stats, 'clientType')).to.equal('NodeJS');
expect(extractStringStatValue(stats, 'clientType')).to.equal('NJS');
expect(extractStringStatValue(stats, 'clientVersion')).to.equal(BuildInfo.getClientVersion());
const connection = client.getConnectionManager().getRandomConnection();
expect(extractIntStatValue(stats, 'clusterConnectionTimestamp')).to.equal(connection.getStartTime());
Expand Down

0 comments on commit e1786f3

Please sign in to comment.