Skip to content

Conversation

@lixir
Copy link
Contributor

@lixir lixir commented Dec 26, 2021

Hello! You can add this function to be able to get a list of all values for a specific label.

@sesheta sesheta added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 26, 2021
@sesheta
Copy link
Contributor

sesheta commented Dec 26, 2021

Pre-Commit Test failed! Click here
[INFO] Initializing environment for https://github.com/Lucas-C/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pycqa/pydocstyle.git.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://gitlab.com/PyCQA/flake8.
[INFO] Initializing environment for https://gitlab.com/PyCQA/flake8:pep8-naming.
[INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/pydocstyle.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://gitlab.com/PyCQA/flake8.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Tabs remover.............................................................Passed
Trim Trailing Whitespace.................................................Passed
Check for merge conflicts................................................Passed
Fix End of Files.........................................................Passed
Check for added large files..............................................Passed
Check for byte-order marker..............................................Passed
Check for case conflicts.................................................Passed
Check docstring is first.................................................Passed
Check JSON...............................................................Passed
Check for broken symlinks............................(no files to check)Skipped
Detect Private Key.......................................................Passed
Check python ast.........................................................Passed
Debug Statements (Python)................................................Passed
pydocstyle...............................................................Passed
Check Toml...............................................................Passed
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
mypy.....................................................................Passed
black....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

prometheus_api_client/exceptions.py:4:8: N818 exception name 'PrometheusApiClientException' should be named with an Error suffix

@sesheta
Copy link
Contributor

sesheta commented Dec 26, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign 4n4nd after the PR has been reviewed.
You can assign the PR to them by writing /assign @4n4nd in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Collaborator

@chauhankaranraj chauhankaranraj left a comment

Choose a reason for hiding this comment

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

Hello, thanks for the contribution, this is great!

Just a thought, would it be a good idea to update the all_metrics function to use this functoin internally like so:

self.get_label_values(label_name="__name__")

/cc @4n4nd @lixir

@sesheta sesheta requested a review from 4n4nd January 4, 2022 13:34
@sesheta
Copy link
Contributor

sesheta commented Jan 4, 2022

@chauhankaranraj: GitHub didn't allow me to request PR reviews from the following users: lixir.

Note that only AICoE members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Hello, thanks for the contribution, this is great!

Just a thought, would it be a good idea to update the all_metrics function to use this functoin internally like so:

self.get_label_values(label_name="__name__")

/cc @4n4nd @lixir

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sesheta
Copy link
Contributor

sesheta commented Jan 5, 2022

Pre-Commit Test failed! Click here
[INFO] Initializing environment for https://github.com/Lucas-C/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pycqa/pydocstyle.git.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://gitlab.com/PyCQA/flake8.
[INFO] Initializing environment for https://gitlab.com/PyCQA/flake8:pep8-naming.
[INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/pydocstyle.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://gitlab.com/PyCQA/flake8.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Tabs remover.............................................................Passed
Trim Trailing Whitespace.................................................Passed
Check for merge conflicts................................................Passed
Fix End of Files.........................................................Passed
Check for added large files..............................................Passed
Check for byte-order marker..............................................Passed
Check for case conflicts.................................................Passed
Check docstring is first.................................................Passed
Check JSON...............................................................Passed
Check for broken symlinks............................(no files to check)Skipped
Detect Private Key.......................................................Passed
Check python ast.........................................................Passed
Debug Statements (Python)................................................Passed
pydocstyle...............................................................Passed
Check Toml...............................................................Passed
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
mypy.....................................................................Passed
black....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

prometheus_api_client/exceptions.py:4:8: N818 exception name 'PrometheusApiClientException' should be named with an Error suffix

@lixir
Copy link
Contributor Author

lixir commented Jan 5, 2022

Hi, @chauhankaranraj! Thanks, I replaced the duplicate code in aafd99b.

@lixir lixir requested a review from chauhankaranraj January 5, 2022 22:07
Copy link
Collaborator

@chauhankaranraj chauhankaranraj left a comment

Choose a reason for hiding this comment

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

Hi, @chauhankaranraj! Thanks, I replaced the duplicate code in aafd99b.

Awesome, thanks!
/lgtm

@sesheta sesheta added the lgtm Indicates that a PR is ready to be merged. label Jan 6, 2022
Copy link
Owner

@4n4nd 4n4nd left a comment

Choose a reason for hiding this comment

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

@lixir could you please add a small test for this function? (Example)

@sesheta sesheta removed the lgtm Indicates that a PR is ready to be merged. label Jan 9, 2022
@sesheta
Copy link
Contributor

sesheta commented Jan 9, 2022

New changes are detected. LGTM label has been removed.

@sesheta sesheta added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 9, 2022
@sesheta
Copy link
Contributor

sesheta commented Jan 9, 2022

Pre-Commit Test failed! Click here
[INFO] Initializing environment for https://github.com/Lucas-C/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pycqa/pydocstyle.git.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://gitlab.com/PyCQA/flake8.
[INFO] Initializing environment for https://gitlab.com/PyCQA/flake8:pep8-naming.
[INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/pydocstyle.git.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/mirrors-mypy.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://gitlab.com/PyCQA/flake8.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Tabs remover.............................................................Passed
Trim Trailing Whitespace.................................................Passed
Check for merge conflicts................................................Passed
Fix End of Files.........................................................Passed
Check for added large files..............................................Passed
Check for byte-order marker..............................................Passed
Check for case conflicts.................................................Passed
Check docstring is first.................................................Passed
Check JSON...............................................................Passed
Check for broken symlinks............................(no files to check)Skipped
Detect Private Key.......................................................Passed
Check python ast.........................................................Passed
Debug Statements (Python)................................................Passed
pydocstyle...............................................................Passed
Check Toml...............................................................Passed
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
mypy.....................................................................Passed
black....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

prometheus_api_client/exceptions.py:4:8: N818 exception name 'PrometheusApiClientException' should be named with an Error suffix

@lixir
Copy link
Contributor Author

lixir commented Jan 9, 2022

Hi @4n4nd! I have added tests for get_label_values() in b64d90a.

self.assertEqual(metrics_list, self.pc.get_label_values("__name__"))
# Check for the "job" label.
label_values = self.pc.get_label_values("job")
self.assertTrue(len(label_values) > 0, "no metrics received from prometheus")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here I added a check for this label(job) for your test server (http://demo.robustperception.io:9090/). I am comparing the number of values to zero. If you need to compare the result with the current value and it will not change over time, I can make an edit.
Current value for "job" label: ['alertmanager', 'node', 'prometheus', 'pushgateway']

@lixir lixir requested a review from 4n4nd January 13, 2022 06:26
@sesheta
Copy link
Contributor

sesheta commented Apr 13, 2022

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@sesheta sesheta added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 13, 2022
@sesheta
Copy link
Contributor

sesheta commented May 13, 2022

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten

@sesheta sesheta added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 13, 2022
@4n4nd 4n4nd closed this Jun 8, 2022
@4n4nd 4n4nd reopened this Jun 8, 2022
@4n4nd
Copy link
Owner

4n4nd commented Jun 8, 2022

@lixir sorry for the delay in review. This PR look good 👍
Thanks for working on it!

@4n4nd 4n4nd merged commit fa9436b into 4n4nd:master Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants