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

pybind/mgr/prometheus: add file_sd_config command #21061

Merged
merged 1 commit into from Apr 26, 2018

Conversation

Projects
None yet
5 participants
@jan--f
Copy link
Member

commented Mar 27, 2018

This command returns a valid list of static targets pointing to the mgr
prometheus modules for a cluster. The output can be stored in a
file and the file be listed under the file_sd_config stanza in the
prometheus configuration.

Signed-off-by: Jan Fajerski jfajerski@suse.com

@jan--f jan--f added the mgr label Mar 27, 2018

@jan--f jan--f requested review from jcsp and b-ranto Mar 27, 2018

@jan--f

This comment has been minimized.

Copy link
Member Author

commented Mar 27, 2018

Note that this depends on #20875 to return something sensible.

ret = [
{
"targets": targets,
"labels": {}

This comment has been minimized.

Copy link
@b-ranto

b-ranto Apr 3, 2018

Contributor

Maybe I am missing something but why are there these empty labels?

This comment has been minimized.

Copy link
@jan--f

jan--f Apr 3, 2018

Author Member

This is just the prometheus file_sd_config format. I thought prometheus would not like not having the label key, but it turns out that it start fine when this key is missing (at least with version 2.1.0). As this doesn't add anyhting I'm happy to remove it.

I guess an argument could be made for a user clearly seeing where a per-target label config would be added, but again: happy to do without it.

This comment has been minimized.

Copy link
@b-ranto

b-ranto Apr 3, 2018

Contributor

Ah, ok, that makes sense, with the explanation I am fine either way (having/not having the labels key in the dict).

@b-ranto

b-ranto approved these changes Apr 3, 2018

@jcsp

jcsp approved these changes Apr 23, 2018

@jcsp jcsp added this to the mimic milestone Apr 23, 2018

}
]
return 0, "", json.dumps(ret)

def handle_command(self, cmd):
if cmd['prefix'] == 'prometheus self-test':
self.collect()

This comment has been minimized.

Copy link
@jcsp

jcsp Apr 23, 2018

Contributor

What about adding a call to get_file_sd_config() inside the self test bit, so we have some coverage of this? Or alternatively call the command explicitly from the tests.

@jcsp

This comment has been minimized.

Copy link
Contributor

commented Apr 24, 2018

This passes tests, but since the tests aren't touching the new code I'd rather wait until they are before merging

@tchaikov tchaikov removed their assignment Apr 24, 2018

@jan--f jan--f force-pushed the jan--f:jan-prometheus-file-sd-command branch from b3eccef to 6478fa0 Apr 24, 2018

@jan--f

This comment has been minimized.

Copy link
Member Author

commented Apr 24, 2018

@jcsp added some basic smoke testing

@jan--f jan--f force-pushed the jan--f:jan-prometheus-file-sd-command branch 2 times, most recently from 96e718e to f0adcc9 Apr 24, 2018

@liewegas

This comment has been minimized.

Copy link
Member

commented Apr 24, 2018

http://pulpito.ceph.com/sage-2018-04-24_16:58:54-rados-wip-sage3-testing-2018-04-24-1010-distro-basic-smithi/2434783

2018-04-24T19:31:19.592 INFO:tasks.cephfs_test_runner:======================================================================
2018-04-24T19:31:19.594 INFO:tasks.cephfs_test_runner:ERROR: test_file_sd_command (tasks.mgr.test_prometheus.TestPrometheus)
2018-04-24T19:31:19.594 INFO:tasks.cephfs_test_runner:----------------------------------------------------------------------
2018-04-24T19:31:19.595 INFO:tasks.cephfs_test_runner:Traceback (most recent call last):
2018-04-24T19:31:19.595 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/git.ceph.com_ceph-c_wip-sage3-testing-2018-04-24-1010/qa/tasks/mgr/test_prometheus.py", line 25, in test_file_sd_command
2018-04-24T19:31:19.595 INFO:tasks.cephfs_test_runner:    mgr_map = self.get_mgr_map()
2018-04-24T19:31:19.595 INFO:tasks.cephfs_test_runner:AttributeError: 'TestPrometheus' object has no attribute 'get_mgr_map'
2018-04-24T19:31:19.595 INFO:tasks.cephfs_test_runner:
2018-04-24T19:31:19.595 INFO:tasks.cephfs_test_runner:----------------------------------------------------------------------
2018-04-24T19:31:19.595 INFO:tasks.cephfs_test_runner:Ran 1 test in 35.642s
2018-04-24T19:31:19.595 INFO:tasks.cephfs_test_runner:
2018-04-24T19:31:19.595 INFO:tasks.cephfs_test_runner:FAILED (errors=1)
2018-04-24T19:31:19.595 INFO:tasks.cephfs_test_runner:
2018-04-24T19:31:19.596 INFO:tasks.cephfs_test_runner:======================================================================
2018-04-24T19:31:19.596 INFO:tasks.cephfs_test_runner:ERROR: test_file_sd_command (tasks.mgr.test_prometheus.TestPrometheus)
2018-04-24T19:31:19.596 INFO:tasks.cephfs_test_runner:----------------------------------------------------------------------
2018-04-24T19:31:19.596 INFO:tasks.cephfs_test_runner:Traceback (most recent call last):
2018-04-24T19:31:19.596 INFO:tasks.cephfs_test_runner:  File "/home/teuthworker/src/git.ceph.com_ceph-c_wip-sage3-testing-2018-04-24-1010/qa/tasks/mgr/test_prometheus.py", line 25, in test_file_sd_command
2018-04-24T19:31:19.596 INFO:tasks.cephfs_test_runner:    mgr_map = self.get_mgr_map()
2018-04-24T19:31:19.596 INFO:tasks.cephfs_test_runner:AttributeError: 'TestPrometheus' object has no attribute 'get_mgr_map'
pybind/mgr/prometheus: add file_sd_config command
This command returns a valid list of static targets pointing to the mgr
prometheus modules for a cluster. The output can be stored in a
file and the file be listed under the file_sd_config stanza in the
prometheus configuration.

Signed-off-by: Jan Fajerski <jfajerski@suse.com>
@jan--f

This comment has been minimized.

Copy link
Member Author

commented Apr 25, 2018

@liewegas tests are fixed now...sorry about that, couldn't build Ceph last night.

@jan--f jan--f force-pushed the jan--f:jan-prometheus-file-sd-command branch from f0adcc9 to 2eb0b41 Apr 25, 2018

@jcsp

jcsp approved these changes Apr 26, 2018

@liewegas

This comment has been minimized.

@liewegas liewegas merged commit 510762f into ceph:master Apr 26, 2018

5 checks passed

Docs: build check OK - docs built
Details
Signed-off-by all commits in this PR are signed
Details
Unmodified Submodules submodules for project are unmodified
Details
make check make check succeeded
Details
make check (arm64) make check succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.