mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Snapshot telemetry] Report to v3 (#159406)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
736252e5ef
commit
1d22dcce75
7 changed files with 27 additions and 17 deletions
|
@ -42,7 +42,7 @@ export const PAYLOAD_CONTENT_ENCODING = 'aes256gcm';
|
|||
/**
|
||||
* The endpoint version when hitting the remote telemetry service
|
||||
*/
|
||||
export const ENDPOINT_VERSION = 'v2';
|
||||
export const ENDPOINT_VERSION = 'v3';
|
||||
|
||||
/**
|
||||
* The staging telemetry endpoint for the remote telemetry service.
|
||||
|
@ -60,6 +60,6 @@ export const ENDPOINT_PROD = 'https://telemetry.elastic.co/';
|
|||
* The telemetry channels for the remote telemetry service.
|
||||
*/
|
||||
export const TELEMETRY_CHANNELS = {
|
||||
SNAPSHOT_CHANNEL: 'xpack',
|
||||
OPT_IN_STATUS_CHANNEL: 'opt_in_status',
|
||||
SNAPSHOT_CHANNEL: 'kibana-snapshot',
|
||||
OPT_IN_STATUS_CHANNEL: 'kibana-opt-in-reports',
|
||||
};
|
||||
|
|
|
@ -41,12 +41,12 @@ describe('getChannel', () => {
|
|||
|
||||
it('returns correct snapshot channel name', () => {
|
||||
const channelName = getChannel('snapshot');
|
||||
expect(channelName).toMatchInlineSnapshot(`"xpack"`);
|
||||
expect(channelName).toMatchInlineSnapshot(`"kibana-snapshot"`);
|
||||
});
|
||||
|
||||
it('returns correct optInStatus channel name', () => {
|
||||
const channelName = getChannel('optInStatus');
|
||||
expect(channelName).toMatchInlineSnapshot(`"opt_in_status"`);
|
||||
expect(channelName).toMatchInlineSnapshot(`"kibana-opt-in-reports"`);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -68,12 +68,14 @@ describe('getTelemetryChannelEndpoint', () => {
|
|||
describe('snapshot channel', () => {
|
||||
it('returns correct prod endpoint', () => {
|
||||
const endpoint = getTelemetryChannelEndpoint({ env: 'prod', channelName: 'snapshot' });
|
||||
expect(endpoint).toMatchInlineSnapshot(`"https://telemetry.elastic.co/xpack/v2/send"`);
|
||||
expect(endpoint).toMatchInlineSnapshot(
|
||||
`"https://telemetry.elastic.co/v3/send/kibana-snapshot"`
|
||||
);
|
||||
});
|
||||
it('returns correct staging endpoint', () => {
|
||||
const endpoint = getTelemetryChannelEndpoint({ env: 'staging', channelName: 'snapshot' });
|
||||
expect(endpoint).toMatchInlineSnapshot(
|
||||
`"https://telemetry-staging.elastic.co/xpack/v2/send"`
|
||||
`"https://telemetry-staging.elastic.co/v3/send/kibana-snapshot"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -82,13 +84,13 @@ describe('getTelemetryChannelEndpoint', () => {
|
|||
it('returns correct prod endpoint', () => {
|
||||
const endpoint = getTelemetryChannelEndpoint({ env: 'prod', channelName: 'optInStatus' });
|
||||
expect(endpoint).toMatchInlineSnapshot(
|
||||
`"https://telemetry.elastic.co/opt_in_status/v2/send"`
|
||||
`"https://telemetry.elastic.co/v3/send/kibana-opt-in-reports"`
|
||||
);
|
||||
});
|
||||
it('returns correct staging endpoint', () => {
|
||||
const endpoint = getTelemetryChannelEndpoint({ env: 'staging', channelName: 'optInStatus' });
|
||||
expect(endpoint).toMatchInlineSnapshot(
|
||||
`"https://telemetry-staging.elastic.co/opt_in_status/v2/send"`
|
||||
`"https://telemetry-staging.elastic.co/v3/send/kibana-opt-in-reports"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -49,5 +49,5 @@ export function getTelemetryChannelEndpoint({
|
|||
const baseUrl = getBaseUrl(env);
|
||||
const channelPath = getChannel(channelName);
|
||||
|
||||
return `${baseUrl}${channelPath}/${ENDPOINT_VERSION}/send`;
|
||||
return `${baseUrl}${ENDPOINT_VERSION}/send/${channelPath}`;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
|
|||
import type { IBasePath } from '@kbn/core-http-browser';
|
||||
import type { TelemetryService } from '../services';
|
||||
import type { TelemetryConstants } from '..';
|
||||
import { PATH_TO_ADVANCED_SETTINGS } from '../../common/constants';
|
||||
|
||||
export interface OptInMessageProps {
|
||||
telemetryConstants: TelemetryConstants;
|
||||
|
@ -94,7 +95,7 @@ function renderTelemetryEnabledOrDisabledText(
|
|||
|
||||
return (
|
||||
/* eslint-disable-next-line @elastic/eui/href-or-on-click */
|
||||
<EuiLink href={addBasePath('management/kibana/settings')} onClick={onClick}>
|
||||
<EuiLink href={addBasePath(PATH_TO_ADVANCED_SETTINGS)} onClick={onClick}>
|
||||
{actionMessage}
|
||||
</EuiLink>
|
||||
);
|
||||
|
|
|
@ -146,7 +146,7 @@ describe('TelemetryService', () => {
|
|||
});
|
||||
|
||||
expect(telemetryService.getTelemetryUrl()).toMatchInlineSnapshot(
|
||||
`"https://telemetry-staging.elastic.co/xpack/v2/send"`
|
||||
`"https://telemetry-staging.elastic.co/v3/send/kibana-snapshot"`
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -156,7 +156,7 @@ describe('TelemetryService', () => {
|
|||
});
|
||||
|
||||
expect(telemetryService.getTelemetryUrl()).toMatchInlineSnapshot(
|
||||
`"https://telemetry.elastic.co/xpack/v2/send"`
|
||||
`"https://telemetry.elastic.co/v3/send/kibana-snapshot"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -168,7 +168,7 @@ describe('TelemetryService', () => {
|
|||
});
|
||||
|
||||
expect(telemetryService.getOptInStatusUrl()).toMatchInlineSnapshot(
|
||||
`"https://telemetry-staging.elastic.co/opt_in_status/v2/send"`
|
||||
`"https://telemetry-staging.elastic.co/v3/send/kibana-opt-in-reports"`
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -178,7 +178,7 @@ describe('TelemetryService', () => {
|
|||
});
|
||||
|
||||
expect(telemetryService.getOptInStatusUrl()).toMatchInlineSnapshot(
|
||||
`"https://telemetry.elastic.co/opt_in_status/v2/send"`
|
||||
`"https://telemetry.elastic.co/v3/send/kibana-opt-in-reports"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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/opt_in_status/v2/send",
|
||||
"https://telemetry.elastic.co/v3/send/kibana-opt-in-reports",
|
||||
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/opt_in_status/v2/send",
|
||||
"https://telemetry-staging.elastic.co/v3/send/kibana-opt-in-reports",
|
||||
Object {
|
||||
"body": "mock_opt_in_hashed_value",
|
||||
"headers": Object {
|
||||
|
|
|
@ -558,6 +558,13 @@ describe('getV3UrlFromV2', () => {
|
|||
).toBe('https://telemetry.elastic.co/v3/send/alerts-endpoint');
|
||||
});
|
||||
|
||||
it('should work when receiving a V3 URL', () => {
|
||||
const sender = new TelemetryEventsSender(logger);
|
||||
expect(
|
||||
sender.getV3UrlFromV2('https://telemetry.elastic.co/v3/send/channel', 'alerts-endpoint')
|
||||
).toBe('https://telemetry.elastic.co/v3/send/alerts-endpoint');
|
||||
});
|
||||
|
||||
it('should return staging url', () => {
|
||||
const sender = new TelemetryEventsSender(logger);
|
||||
expect(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue