Skip to content

Commit

Permalink
explicitly import/export usage data types for telemetry_check
Browse files Browse the repository at this point in the history
  • Loading branch information
rudolf committed Oct 4, 2020
1 parent a1f476a commit 949e6a5
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
12 changes: 9 additions & 3 deletions src/core/server/core_usage_data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
export {
CoreUsageDataStart,
export { CoreUsageDataStart } from './types';
export { CoreUsageDataService } from './core_usage_data_service';

// Because of #79265 we need to explicity import, then export these types for
// scripts/telemetry_check.js to work as expected
import {
CoreUsageData,
CoreConfigUsageData,
CoreEnvironmentUsageData,
CoreServicesUsageData,
} from './types';
export { CoreUsageDataService } from './core_usage_data_service';

export { CoreUsageData, CoreConfigUsageData, CoreEnvironmentUsageData, CoreServicesUsageData };
12 changes: 10 additions & 2 deletions src/core/server/core_usage_data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,20 @@ export interface CoreConfigUsageData {
}

/**
* Internal API for getting Core's usage data payload
* Internal API for getting Core's usage data payload.
*
* @note This API should never be used to drive application logic and is only
* intended for telemetry purposes.
*
* @internal
*/
export interface CoreUsageDataStart {
/**
* Internal API for collecting Core usage data
* Internal API for getting Core's usage data payload.
*
* @note This API should never be used to drive application logic and is only
* intended for telemetry purposes.
*
* @internal
* */
getCoreUsageData(): Promise<CoreUsageData>;
Expand Down
13 changes: 12 additions & 1 deletion src/core/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ import { Auditor, AuditTrailSetup, AuditTrailStart } from './audit_trail';
import { AppenderConfigType, appendersSchema, LoggingServiceSetup } from './logging';
import { CoreUsageDataStart } from './core_usage_data';

// Because of #79265 we need to explicity import, then export these types for
// scripts/telemetry_check.js to work as expected
import {
CoreUsageData,
CoreConfigUsageData,
CoreEnvironmentUsageData,
CoreServicesUsageData,
} from './core_usage_data';

export { CoreUsageData, CoreConfigUsageData, CoreEnvironmentUsageData, CoreServicesUsageData };

export { AuditableEvent, Auditor, AuditorFactory, AuditTrailSetup } from './audit_trail';
export { bootstrap } from './bootstrap';
export { Capabilities, CapabilitiesProvider, CapabilitiesSwitcher } from './capabilities';
Expand Down Expand Up @@ -350,7 +361,7 @@ export {
StatusServiceSetup,
} from './status';

export { CoreUsageDataStart, CoreUsageData } from './core_usage_data';
export { CoreUsageDataStart } from './core_usage_data';

/**
* Plugin specific context passed to a route handler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@
*/

import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import {
CoreUsageData,
CoreUsageDataStart,
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '../../../../../core/server/core_usage_data/types';
// telemetry_check is unable to check types which are re-exported, it only
// works when pointed to the typescript file where the type was defined.
import { CoreUsageData, CoreUsageDataStart } from '../../../../../core/server';

export function getCoreUsageCollector(
usageCollection: UsageCollectionSetup,
Expand Down

0 comments on commit 949e6a5

Please sign in to comment.