Skip to content

Commit

Permalink
Use the mlCapabilities API to ensure the required license is active f…
Browse files Browse the repository at this point in the history
…or ml queries
  • Loading branch information
ogupte committed Jun 13, 2020
1 parent 2524b40 commit 02949d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('getAnomalySeries', () => {
ml: {
mlSystem: {
mlAnomalySearch: clientSpy,
mlCapabilities: async () => ({ isPlatinumOrTrialLicense: true }),
},
} as any,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ export async function getAnomalySeries({
return;
}

// don't fetch anomalies if the ML plugin is not setup
if (!setup.ml) {
return;
}

// don't fetch anomalies if required license is not satisfied
const mlCapabilities = await setup.ml.mlSystem.mlCapabilities();
if (!mlCapabilities.isPlatinumOrTrialLicense) {
return;
}

const mlBucketSize = await getMlBucketSize({
serviceName,
transactionType,
Expand Down

0 comments on commit 02949d9

Please sign in to comment.