-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[cloud plugin] Add serverless projectId to configuration and contract #161728
Changes from all commits
3f516be
7e9c9ee
1eace31
e03a804
0fee2ce
a975063
eb67f7c
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 |
---|---|---|
|
@@ -71,6 +71,21 @@ export interface CloudSetup { | |
url?: string; | ||
secretToken?: string; | ||
}; | ||
/** | ||
* `true` when running on Serverless Elastic Cloud | ||
* Note that `isCloudEnabled` will always be true when `isServerlessEnabled` is. | ||
*/ | ||
isServerlessEnabled: boolean; | ||
/** | ||
* Serverless configuration | ||
*/ | ||
serverless: { | ||
/** | ||
* The serverless projectId. | ||
* Will always be present if `isServerlessEnabled` is `true` | ||
*/ | ||
projectId?: string; | ||
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. NIT I wonder if it should be the whole Could the fact that the "serverless" property is defined be enough to determine that "serverless is enabled"? This way we would get rid of the Serverless does not sound like something you can enable / disable, either you are or not on serverless, WDYT? 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. For now it would make more sense. The thing is, we will likely add more serverless attributes to this section, and given their presence may be optional, it could complicate the thing (the same reason why the props are each individually nullable for ESS-related props) |
||
}; | ||
} | ||
|
||
/** | ||
|
@@ -94,6 +109,8 @@ export class CloudPlugin implements Plugin<CloudSetup, CloudStart> { | |
|
||
public setup(core: CoreSetup, { usageCollection }: PluginsSetup): CloudSetup { | ||
const isCloudEnabled = getIsCloudEnabled(this.config.id); | ||
const isServerlessEnabled = !!this.config.serverless?.project_id; | ||
|
||
registerCloudDeploymentMetadataAnalyticsContext(core.analytics, this.config); | ||
registerCloudUsageCollector(usageCollection, { | ||
isCloudEnabled, | ||
|
@@ -121,6 +138,10 @@ export class CloudPlugin implements Plugin<CloudSetup, CloudStart> { | |
url: this.config.apm?.url, | ||
secretToken: this.config.apm?.secret_token, | ||
}, | ||
isServerlessEnabled, | ||
serverless: { | ||
projectId: this.config.serverless?.project_id, | ||
}, | ||
}; | ||
} | ||
|
||
|
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.
optional nit: it'd be great to leave a comment saying that it doesn't include anything sensitive, just in case we have to conduct an audit of this file at some point.