[Telemetry] revert to v2 endpoint (#118682) (#118707)

Co-authored-by: Ahmad Bamieh <ahmadbamieh@gmail.com>
This commit is contained in:
Kibana Machine 2021-11-16 15:53:03 -05:00 committed by GitHub
parent 850766a8e8
commit 1c55a2dc1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 18 deletions

View file

@ -35,7 +35,7 @@ export const PAYLOAD_CONTENT_ENCODING = 'aes256gcm';
/**
* The endpoint version when hitting the remote telemetry service
*/
export const ENDPOINT_VERSION = 'v3';
export const ENDPOINT_VERSION = 'v2';
/**
* The staging telemetry endpoint for the remote telemetry service.
@ -53,6 +53,6 @@ export const ENDPOINT_PROD = 'https://telemetry.elastic.co/';
* The telemetry channels for the remote telemetry service.
*/
export const TELEMETRY_CHANNELS = {
SNAPSHOT_CHANNEL: 'kibana-snapshot',
OPT_IN_STATUS_CHANNEL: 'kibana-opt_in_status',
SNAPSHOT_CHANNEL: 'xpack',
OPT_IN_STATUS_CHANNEL: 'opt_in_status',
};

View file

@ -41,12 +41,12 @@ describe('getChannel', () => {
it('returns correct snapshot channel name', () => {
const channelName = getChannel('snapshot');
expect(channelName).toMatchInlineSnapshot(`"kibana-snapshot"`);
expect(channelName).toMatchInlineSnapshot(`"xpack"`);
});
it('returns correct optInStatus channel name', () => {
const channelName = getChannel('optInStatus');
expect(channelName).toMatchInlineSnapshot(`"kibana-opt_in_status"`);
expect(channelName).toMatchInlineSnapshot(`"opt_in_status"`);
});
});
@ -68,14 +68,12 @@ describe('getTelemetryChannelEndpoint', () => {
describe('snapshot channel', () => {
it('returns correct prod endpoint', () => {
const endpoint = getTelemetryChannelEndpoint({ env: 'prod', channelName: 'snapshot' });
expect(endpoint).toMatchInlineSnapshot(
`"https://telemetry.elastic.co/v3/send/kibana-snapshot"`
);
expect(endpoint).toMatchInlineSnapshot(`"https://telemetry.elastic.co/xpack/v2/send"`);
});
it('returns correct staging endpoint', () => {
const endpoint = getTelemetryChannelEndpoint({ env: 'staging', channelName: 'snapshot' });
expect(endpoint).toMatchInlineSnapshot(
`"https://telemetry-staging.elastic.co/v3/send/kibana-snapshot"`
`"https://telemetry-staging.elastic.co/xpack/v2/send"`
);
});
});
@ -84,13 +82,13 @@ describe('getTelemetryChannelEndpoint', () => {
it('returns correct prod endpoint', () => {
const endpoint = getTelemetryChannelEndpoint({ env: 'prod', channelName: 'optInStatus' });
expect(endpoint).toMatchInlineSnapshot(
`"https://telemetry.elastic.co/v3/send/kibana-opt_in_status"`
`"https://telemetry.elastic.co/opt_in_status/v2/send"`
);
});
it('returns correct staging endpoint', () => {
const endpoint = getTelemetryChannelEndpoint({ env: 'staging', channelName: 'optInStatus' });
expect(endpoint).toMatchInlineSnapshot(
`"https://telemetry-staging.elastic.co/v3/send/kibana-opt_in_status"`
`"https://telemetry-staging.elastic.co/opt_in_status/v2/send"`
);
});
});

View file

@ -49,5 +49,5 @@ export function getTelemetryChannelEndpoint({
const baseUrl = getBaseUrl(env);
const channelPath = getChannel(channelName);
return `${baseUrl}${ENDPOINT_VERSION}/send/${channelPath}`;
return `${baseUrl}${channelPath}/${ENDPOINT_VERSION}/send`;
}

View file

@ -143,7 +143,7 @@ describe('TelemetryService', () => {
});
expect(telemetryService.getTelemetryUrl()).toMatchInlineSnapshot(
`"https://telemetry-staging.elastic.co/v3/send/kibana-snapshot"`
`"https://telemetry-staging.elastic.co/xpack/v2/send"`
);
});
@ -153,7 +153,7 @@ describe('TelemetryService', () => {
});
expect(telemetryService.getTelemetryUrl()).toMatchInlineSnapshot(
`"https://telemetry.elastic.co/v3/send/kibana-snapshot"`
`"https://telemetry.elastic.co/xpack/v2/send"`
);
});
});
@ -165,7 +165,7 @@ describe('TelemetryService', () => {
});
expect(telemetryService.getOptInStatusUrl()).toMatchInlineSnapshot(
`"https://telemetry-staging.elastic.co/v3/send/kibana-opt_in_status"`
`"https://telemetry-staging.elastic.co/opt_in_status/v2/send"`
);
});
@ -175,7 +175,7 @@ describe('TelemetryService', () => {
});
expect(telemetryService.getOptInStatusUrl()).toMatchInlineSnapshot(
`"https://telemetry.elastic.co/v3/send/kibana-opt_in_status"`
`"https://telemetry.elastic.co/opt_in_status/v2/send"`
);
});
});

View file

@ -40,7 +40,7 @@ describe('sendTelemetryOptInStatus', () => {
expect(fetch).toBeCalledTimes(1);
expect((fetch as jest.MockedFunction<typeof fetch>).mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://telemetry.elastic.co/v3/send/kibana-opt_in_status",
"https://telemetry.elastic.co/opt_in_status/v2/send",
Object {
"body": "mock_opt_in_hashed_value",
"headers": Object {
@ -71,7 +71,7 @@ describe('sendTelemetryOptInStatus', () => {
expect(fetch).toBeCalledTimes(1);
expect((fetch as jest.MockedFunction<typeof fetch>).mock.calls[0]).toMatchInlineSnapshot(`
Array [
"https://telemetry-staging.elastic.co/v3/send/kibana-opt_in_status",
"https://telemetry-staging.elastic.co/opt_in_status/v2/send",
Object {
"body": "mock_opt_in_hashed_value",
"headers": Object {