Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Uptime] Use dynamic index pattern in Uptime #55446

Merged
2 changes: 2 additions & 0 deletions x-pack/legacy/plugins/uptime/common/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
*/

export const UNNAMED_LOCATION = 'Unnamed-location';

export const UPTIME_INDEX_PATTERN = 'heartbeat-8*';
shahzad31 marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
*/

import { UMSavedObjectsAdapter } from './types';
import uptimeIndexPattern from './heartbeat_index_pattern.json';
import { UPTIME_INDEX_PATTERN } from '../../../../common/constants';

export const savedObjectsAdapter: UMSavedObjectsAdapter = {
getUptimeIndexPattern: async client => {
try {
return await client.get('index-pattern', uptimeIndexPattern.id);
return await client.get('index-pattern', UPTIME_INDEX_PATTERN);
} catch (error) {
return await client.create(
'index-pattern',
{
...uptimeIndexPattern.attributes,
title: 'UptimeIndexPattern',
timeFieldName: '@timestamp',
title: 'heartbeat-8*',
fields: '[]',
},
{ id: uptimeIndexPattern.id, overwrite: false }
{ id: UPTIME_INDEX_PATTERN, overwrite: false }
);
}
},
Expand Down