Skip to content
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

Modify prometheus monitor #974

Merged
merged 1 commit into from
Sep 15, 2020

Conversation

nklincoln
Copy link
Contributor

Contributes to #964

  • Adds basic auth
  • changes to "include" option, that is regex based
  • changes to array of query objects to run

Requires companion docs for breaking change

Signed-off-by: nkl199@yahoo.co.uk nkl199@yahoo.co.uk

const response = await this.prometheusQueryClient.getByEncodedUrl(queryString);

// Retrieve base mapped statistics and coerce into correct format
const resultMap = PrometheusQueryHelper.extractStatisticFromRange(response, params.statistic, params.label);
const resultMap = PrometheusQueryHelper.extractStatisticFromRange(response, queryObject.statistic, queryObject.label);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good if this variable described what it actually contained


const metricArray = [];
let newQuery = true;
for (const [key, value] of resultMap.entries()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be be a bit more descriptive on what a key really is and what the value might be ?

* @param {string} key the key to test fro inclusion
* @returns {boolean} boolean flag for inclusion
*/
includeStatistic(key) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we be more specific then just key ?


/**
* Check if the passed key should be included
* @param {string} key the key to test fro inclusion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fro -> for

const resourceStats = [];
const chartArray = [];
for (const metricKey of Object.keys(this.include)) {
let newKey = true;
for (const queryObject of this.queries) {
// Each metric is of the form
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment say's metric, but all I see is queryObject so not sure how they relate.

Signed-off-by: nkl199@yahoo.co.uk <nkl199@yahoo.co.uk>
@nklincoln nklincoln merged commit 969bab6 into hyperledger:master Sep 15, 2020
@nklincoln nklincoln deleted the prometheus-monitor branch September 25, 2020 11:45
danielporto pushed a commit to danielporto/caliper that referenced this pull request Nov 3, 2020
Signed-off-by: nkl199@yahoo.co.uk <nkl199@yahoo.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants