Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some collector classes for objects that get registered in a Colle…
…ctorSet (#19098) * Add some collector classes for objects that get registered in a CollectorSet * comment cleanup * don't pass an inline-defined logger to collectorSet * add a helper logger function so collector has access to logger at construction
- Loading branch information
Showing
13 changed files
with
190 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
x-pack/plugins/monitoring/server/kibana_monitoring/classes/collector.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { getCollectorLogger } from '../lib'; | ||
|
||
export class Collector { | ||
/* | ||
* @param {Object} server - server object | ||
* @param {String} properties.type - property name as the key for the data | ||
* @param {Function} properties.init (optional) - initialization function | ||
* @param {Function} properties.fetch - function to query data | ||
* @param {Function} properties.cleanup (optional) - cleanup function | ||
* @param {Boolean} properties.fetchAfterInit (optional) - if collector should fetch immediately after init | ||
*/ | ||
constructor(server, { type, init, fetch, cleanup, fetchAfterInit }) { | ||
this.type = type; | ||
this.init = init; | ||
this.fetch = fetch; | ||
this.cleanup = cleanup; | ||
this.fetchAfterInit = fetchAfterInit; | ||
|
||
this.log = getCollectorLogger(server); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
x-pack/plugins/monitoring/server/kibana_monitoring/classes/usage_collector.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { Collector } from './collector'; | ||
|
||
export class UsageCollector extends Collector { | ||
constructor(server, properties) { | ||
super(server, properties); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.