Skip to content

Commit cd8719b

Browse files
#RI-2998-add useSNI to add db telemetry event (#765)
* #RI-2998-add useSNI to add db telemetry event
1 parent 1fb1a3c commit cd8719b

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

redisinsight/api/src/__mocks__/redis-databases.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const mockStandaloneDatabaseEntity: DatabaseInstanceEntity = {
2727
provider: HostingProvider.LOCALHOST,
2828
modules: '[]',
2929
encryption: null,
30+
tlsServername: 'server-name',
3031
};
3132

3233
export const mockOSSClusterDatabaseEntity: DatabaseInstanceEntity = {

redisinsight/api/src/modules/core/services/redis/redis.service.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jest.mock('ioredis');
2525

2626
const mockTlsConfigResult: ConnectionOptions = {
2727
rejectUnauthorized: true,
28+
servername: mockStandaloneDatabaseEntity.tlsServername,
2829
checkServerIdentity: () => undefined,
2930
ca: [mockCaCertDto.cert],
3031
key: mockClientCertDto.key,

redisinsight/api/src/modules/shared/services/instances-business/instances-analytics.service.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const mockDatabaseInstanceDto: DatabaseInstanceResponse = {
2626
verifyServerCert: true,
2727
caCertId: mockCaCertEntity.id,
2828
clientCertPairId: mockClientCertEntity.id,
29+
servername: mockStandaloneDatabaseEntity.tlsServername,
2930
},
3031
modules: [],
3132
};
@@ -100,7 +101,7 @@ describe('InstancesAnalytics', () => {
100101
});
101102

102103
describe('sendInstanceAddedEvent', () => {
103-
it('should emit event with enabled tls', () => {
104+
it('should emit event with enabled tls and sni', () => {
104105
const instance = mockDatabaseInstanceDto;
105106
service.sendInstanceAddedEvent(instance, mockRedisGeneralInfo);
106107

@@ -113,6 +114,7 @@ describe('InstancesAnalytics', () => {
113114
useTLS: 'enabled',
114115
verifyTLSCertificate: 'enabled',
115116
useTLSAuthClients: 'enabled',
117+
useSNI: 'enabled',
116118
version: mockRedisGeneralInfo.version,
117119
numberOfKeys: mockRedisGeneralInfo.totalKeys,
118120
numberOfKeysRange: '0 - 500 000',
@@ -123,7 +125,7 @@ describe('InstancesAnalytics', () => {
123125
},
124126
);
125127
});
126-
it('should emit event with disabled tls', () => {
128+
it('should emit event with disabled tls and sni', () => {
127129
const instance = {
128130
...mockDatabaseInstanceDto,
129131
tls: undefined,
@@ -139,6 +141,7 @@ describe('InstancesAnalytics', () => {
139141
useTLS: 'disabled',
140142
verifyTLSCertificate: 'disabled',
141143
useTLSAuthClients: 'disabled',
144+
useSNI: 'disabled',
142145
version: mockRedisGeneralInfo.version,
143146
numberOfKeys: mockRedisGeneralInfo.totalKeys,
144147
numberOfKeysRange: '0 - 500 000',
@@ -167,6 +170,7 @@ describe('InstancesAnalytics', () => {
167170
useTLS: 'enabled',
168171
verifyTLSCertificate: 'enabled',
169172
useTLSAuthClients: 'enabled',
173+
useSNI: 'enabled',
170174
version: mockRedisGeneralInfo.version,
171175
numberOfKeys: undefined,
172176
numberOfKeysRange: undefined,

redisinsight/api/src/modules/shared/services/instances-business/instances-analytics.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ export class InstancesAnalyticsService extends TelemetryBaseService {
4949
useTLSAuthClients: instance?.tls?.clientCertPairId
5050
? 'enabled'
5151
: 'disabled',
52+
useSNI: instance?.tls?.servername
53+
? 'enabled'
54+
: 'disabled',
5255
version: additionalInfo.version,
5356
numberOfKeys: additionalInfo.totalKeys,
5457
numberOfKeysRange: getRangeForNumber(additionalInfo.totalKeys, TOTAL_KEYS_BREAKPOINTS),

redisinsight/api/src/modules/shared/services/instances-business/instances-business.service.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const addDatabaseDto: AddDatabaseInstanceDto = {
7171
verifyServerCert: true,
7272
caCertId: mockCaCertEntity.id,
7373
clientCertPairId: mockClientCertEntity.id,
74+
servername: mockStandaloneDatabaseEntity.tlsServername,
7475
},
7576
};
7677

0 commit comments

Comments
 (0)