add comments around usage
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
---
|
||||
'@backstage/backend-app-api': minor
|
||||
'@backstage/backend-plugin-api': minor
|
||||
---
|
||||
|
||||
Adds a new `instanceMetadataService` to hold information about a specific backend instance.
|
||||
**EXPERIMENTAL**: Adds a new `instanceMetadataService` to hold information about a specific backend instance.
|
||||
|
||||
@@ -97,6 +97,7 @@ const instanceRegistry = new (class InstanceRegistry {
|
||||
};
|
||||
})();
|
||||
|
||||
// Duplicating from `@backstage/backend-plugin-api` to avoid a deep import.
|
||||
type BackendFeatureMeta =
|
||||
| {
|
||||
type: 'plugin';
|
||||
@@ -126,6 +127,7 @@ function createInstanceMetadataServiceFactory(
|
||||
moduleId: feature.moduleId,
|
||||
};
|
||||
}
|
||||
// Ignore unknown feature types.
|
||||
return undefined;
|
||||
})
|
||||
.filter(Boolean) as BackendFeatureMeta[];
|
||||
|
||||
@@ -18,15 +18,19 @@ import {
|
||||
createBackendPlugin,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
|
||||
// Example usage of the instance metadata service to log the installed features.
|
||||
export default createBackendPlugin({
|
||||
pluginId: 'instance-metadata-logging',
|
||||
register(env) {
|
||||
env.registerInit({
|
||||
deps: {
|
||||
instanceMetadata: coreServices.EXPERIMENTAL_instanceMetadata,
|
||||
logger: coreServices.logger,
|
||||
},
|
||||
async init({ instanceMetadata }) {
|
||||
console.log('metadata', instanceMetadata.getInstalledFeatures());
|
||||
async init({ instanceMetadata, logger }) {
|
||||
logger.info(
|
||||
`Installed features on this instance: ${instanceMetadata.getInstalledFeatures()}`,
|
||||
);
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user