-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[LaunchDarkly] Add Deployment Metadata #143002
Changes from all commits
4aa4a95
ba4f6ee
f5782b5
46cf643
ee3d3ee
48eaafc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,23 +9,35 @@ import { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; | |
|
||
interface Config { | ||
isCloudEnabled: boolean; | ||
trialEndDate?: string; | ||
isElasticStaffOwned?: boolean; | ||
} | ||
|
||
interface CloudUsage { | ||
isCloudEnabled: boolean; | ||
trialEndDate?: string; | ||
inTrial?: boolean; | ||
isElasticStaffOwned?: boolean; | ||
} | ||
|
||
export function createCloudUsageCollector(usageCollection: UsageCollectionSetup, config: Config) { | ||
const { isCloudEnabled } = config; | ||
const { isCloudEnabled, trialEndDate, isElasticStaffOwned } = config; | ||
const trialEndDateMs = trialEndDate ? new Date(trialEndDate).getTime() : undefined; | ||
return usageCollection.makeUsageCollector<CloudUsage>({ | ||
type: 'cloud', | ||
isReady: () => true, | ||
schema: { | ||
isCloudEnabled: { type: 'boolean' }, | ||
trialEndDate: { type: 'date' }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused here, it seems that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. haha! yeah... |
||
inTrial: { type: 'boolean' }, | ||
isElasticStaffOwned: { type: 'boolean' }, | ||
}, | ||
fetch: () => { | ||
return { | ||
isCloudEnabled, | ||
isElasticStaffOwned, | ||
trialEndDate, | ||
...(trialEndDateMs ? { inTrial: Date.now() <= trialEndDateMs } : {}), | ||
}; | ||
}, | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why optional? is it only for BWC reasons on the schema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This information comes from the cloud configuration. It may not be provided by the cloud deployment configuration (mind the
schema.maybe
).