Skip to content

Commit

Permalink
Fix typings
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline committed Sep 23, 2020
1 parent 11e1077 commit b01ed4d
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { CallCluster } from 'src/legacy/core_plugins/elasticsearch';
import { LegacyAPICaller } from 'src/core/server';
import { MonitoringConfig } from '../../config';
import { fetchAvailableCcs } from '../../lib/alerts/fetch_available_ccs';
import { getStackProductsUsage } from './lib/get_stack_products_usage';
Expand All @@ -18,7 +18,7 @@ import { fetchClusters } from '../../lib/alerts/fetch_clusters';
export function getMonitoringUsageCollector(
usageCollection: UsageCollectionSetup,
config: MonitoringConfig,
callCluster: CallCluster
callCluster: LegacyAPICaller
) {
return usageCollection.makeUsageCollector<MonitoringUsage>({
type: 'monitoring',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { CallCluster } from 'src/legacy/core_plugins/elasticsearch';
import { LegacyAPICaller } from 'src/core/server';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { getSettingsCollector } from './get_settings_collector';
import { getMonitoringUsageCollector } from './get_usage_collector';
Expand All @@ -15,7 +15,7 @@ export { KibanaSettingsCollector } from './get_settings_collector';
export function registerCollectors(
usageCollection: UsageCollectionSetup,
config: MonitoringConfig,
callCluster: CallCluster
callCluster: LegacyAPICaller
) {
usageCollection.registerCollector(getSettingsCollector(usageCollection, config));
usageCollection.registerCollector(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { CallCluster } from 'src/legacy/core_plugins/elasticsearch';
import { LegacyAPICaller } from 'src/core/server';
import { get } from 'lodash';
import { MonitoringConfig } from '../../../config';
import { StackProductUsage } from '../types';
Expand Down Expand Up @@ -41,7 +41,7 @@ interface ClusterStats {

export async function fetchESUsage(
config: MonitoringConfig,
callCluster: CallCluster,
callCluster: LegacyAPICaller,
clusterUuid: string,
index: string
): Promise<StackProductUsage> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
*/

import { get } from 'lodash';
import { LegacyAPICaller } from 'src/core/server';
import { INDEX_PATTERN_ELASTICSEARCH } from '../../../../common/constants';
import { getCcsIndexPattern } from '../../../lib/alerts/get_ccs_index_pattern';

export async function fetchLicenseType(
callCluster: any,
callCluster: LegacyAPICaller,
availableCcs: string[],
clusterUuid: string
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { CallCluster } from 'src/legacy/core_plugins/elasticsearch';
import { get } from 'lodash';
import { LegacyAPICaller } from 'src/core/server';
import { MonitoringConfig } from '../../../config';
// @ts-ignore
import { prefixIndexPattern } from '../../../lib/ccs_utils';
Expand All @@ -32,7 +32,7 @@ interface KeyBucket {

export async function fetchStackProductUsage(
config: MonitoringConfig,
callCluster: CallCluster,
callCluster: LegacyAPICaller,
clusterUuid: string,
index: string,
type: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { CallCluster } from 'src/legacy/core_plugins/elasticsearch';
import { LegacyAPICaller } from 'src/core/server';
import { MonitoringClusterStackProductUsage } from '../types';
import { fetchESUsage } from './fetch_es_usage';
import { MonitoringConfig } from '../../../config';
Expand All @@ -23,7 +23,7 @@ import { getCcsIndexPattern } from '../../../lib/alerts/get_ccs_index_pattern';

export const getStackProductsUsage = async (
config: MonitoringConfig,
callCluster: CallCluster,
callCluster: LegacyAPICaller,
availableCcs: string[],
clusterUuid: string
): Promise<
Expand Down Expand Up @@ -60,15 +60,15 @@ export const getStackProductsUsage = async (
clusterUuid,
beatsIndex,
'beats_stats',
'beats_stats.beats.uuid'
'beats_stats.beat.uuid'
),
fetchStackProductUsage(
config,
callCluster,
clusterUuid,
beatsIndex,
'beats_stats',
'beats_stats.beats.uuid',
'beats_stats.beat.uuid',
[{ term: { 'beats_stats.beat.type': 'apm-server' } }]
),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export type FetchData<T extends FetchDataResponse = FetchDataResponse> = (

export type HasData = () => Promise<boolean>;

export type ObservabilityFetchDataPlugins = Exclude<ObservabilityApp, 'observability'>;
export type ObservabilityFetchDataPlugins = Exclude<
ObservabilityApp,
'observability' | 'stack_monitoring'
>;

export interface DataHandler<
T extends ObservabilityFetchDataPlugins = ObservabilityFetchDataPlugins
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/observability/typings/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type ObservabilityApp =
| 'infra_logs'
| 'apm'
| 'uptime'
| 'observability'
| 'stack_monitoring';

export type PromiseReturnType<Func> = Func extends (...args: any[]) => Promise<infer Value>
Expand Down

0 comments on commit b01ed4d

Please sign in to comment.