Skip to content

Commit 8e43d60

Browse files
committed
use route context for notify feature usage route
1 parent 49e01e1 commit 8e43d60

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

x-pack/plugins/licensing/server/routes/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ export function registerRoutes(
1919
registerInfoRoute(router);
2020
registerFeatureUsageRoute(router, getStartServices);
2121
registerRegisterFeatureRoute(router, featureUsageSetup);
22-
registerNotifyFeatureUsageRoute(router, getStartServices);
22+
registerNotifyFeatureUsageRoute(router);
2323
}

x-pack/plugins/licensing/server/routes/internal/notify_feature_usage.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66
import { schema } from '@kbn/config-schema';
7-
import { IRouter, StartServicesAccessor } from 'src/core/server';
8-
import { LicensingPluginStart } from '../../types';
7+
import { IRouter } from 'src/core/server';
98

10-
export function registerNotifyFeatureUsageRoute(
11-
router: IRouter,
12-
getStartServices: StartServicesAccessor<{}, LicensingPluginStart>
13-
) {
9+
export function registerNotifyFeatureUsageRoute(router: IRouter) {
1410
router.post(
1511
{
1612
path: '/internal/licensing/feature_usage/notify',
@@ -22,10 +18,9 @@ export function registerNotifyFeatureUsageRoute(
2218
},
2319
},
2420
async (context, request, response) => {
25-
const [, , { featureUsage }] = await getStartServices();
2621
const { featureName, lastUsed } = request.body;
2722

28-
featureUsage.notifyUsage(featureName, lastUsed);
23+
context.licensing.featureUsage.notifyUsage(featureName, lastUsed);
2924

3025
return response.ok({
3126
body: {

0 commit comments

Comments
 (0)