-
Notifications
You must be signed in to change notification settings - Fork 604
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
Add basic mesos cllector #106
Conversation
adfa688
to
24b6de0
Compare
src/collectors/mesos/mesos.py
Outdated
stats = set(x) | set(y) | ||
summed_stats = {} | ||
for k in stats: | ||
summed_stats.update({k: x.get(k, 0) + y.get(k, 0)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest dict comprehension here
summed_stats = {
key: x.get(key, 0) + y.get(key. 0)
for key in stats
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
24b6de0
to
7c09499
Compare
@deejay1 this seems reasonable, thoughts on merging? |
f182e6f
to
ff37a0b
Compare
@josegonzalez After the fixes now 👍 |
LGTM 👍 |
13e3910
to
f487aeb
Compare
I was sure that this was merged. I rebased on top of the master. Unfortunately this version is not compatible with previous one. @MichaelDoyle what do you think about using |
@janisz first pass looks pretty useful. going to try and run this locally and see what the diff looks like |
return len(value) - decimal - 1 | ||
|
||
def _sanitize_metric_name(self, name): | ||
return name.replace('.', '_').replace('/', '_') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of this change. I prefer the nesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used only on framework_id
and executor_id
. So for this input
...
"frameworks": [
{
"checkpoint": true,
"completed_executors": [],
"executors": [],
"failover_timeout": 604800,
"hostname": "master.mesos.local",
"id": "105146",
"name": "marathon-0.7.6",
"role": "*",
"user": "root"
}
]
...
{
"executor_id": "com.domain.group_anotherApp.08002432371b",
"executor_name": "Command Executor (Task: com.domain.group_anotherApp.08002432371b) (Command: sh -c 'start...')",
"framework_id": "105146",
"source": "com.domain.group_anotherApp.08002432371b",
"statistics": {
"cpus_limit": 1.6,
"cpus_system_time_secs": 2.19,
"cpus_user_time_secs": 7.74,
"mem_anon_bytes": 103370752,
"mem_file_bytes": 86016,
"mem_limit_bytes": 557842432,
"mem_mapped_file_bytes": 45056,
"mem_rss_bytes": 103456768,
"timestamp": 1422535725.82344
}
}
you will get following metric:
"frameworks.marathon-0_7_6.executors.com_domain_group_anotherApp.mem_mapped_file_bytes": 45056
If there will be nesting you will end up with nested version of marathon in framework branch. But I think executor_id
could be spited so there will be tree com/domain/group/
. Good catch I will fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. It its only used for framework_name
f487aeb
to
2f3014c
Compare
Are these extra URLs documented anywhere? Specifically:
Only |
|
Hey, any updates on this? |
Next Mesos release will remove/rename some endpoints. I need to handle it in this PR. |
|
2f3014c
to
393244c
Compare
I changed @MichaelDoyle How I should handle API changes in Mesos 0.25, should I add config option |
@shortdudey123 @josegonzalez Are you interested in merging this PR after I rebase it? |
@janisz yes please :) |
Collector retrive all data from [/metrics/snapshot](https://github.com/apache/mesos/blob/b1225aca32d0592c8ea2fab52f24dae26d643b1a/3rdparty/libprocess/src/metrics/metrics.cpp#L48-L58) for one host provided in configuration.
@shortdudey123 Rebased. I included commits that we added since this PR was started. There are some bugfixes and features. I think preserving history of this commits will be good to see who and why made specific change. |
Fixed some pep8 issues'
Changes Unknown when pulling e784b43 on janisz:mesos_collector into ** on python-diamond:master**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs/collectors/MesosCollector.md
also needs to be regenerated to pick up the updated help section
src/collectors/mesos/mesos.py
Outdated
|
||
|
||
class MesosCollector(diamond.collector.Collector): | ||
def __init__(self, config=None, handlers=[], name=None, configfile=None): | ||
self.master = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably don't need this since this is the default that is set under get_default_config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted
src/collectors/mesos/mesos.py
Outdated
""" | ||
Execute a Mesos API call. | ||
""" | ||
url = 'http://%s:%s/%s' % (host, port, path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets keep the scheme
option in here and not remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
"registrar.state_store_ms.p9999": (17.8412544, 6) | ||
} | ||
|
||
self.setDocExample(collector=self.collector.__class__.__name__, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.setDocExample
should only be called once (already called in test_should_work_for_slave_with_real_data
). Remove this one or the other one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted
Fixed issues. How can I generate docs? |
Changes Unknown when pulling 3e0e413 on janisz:mesos_collector into ** on python-diamond:master**. |
|
Changes Unknown when pulling 05e9131 on janisz:mesos_collector into ** on python-diamond:master**. |
Thanks, regenerated the docs. |
Collector retrive all data from /metrics/snapshot for one host provided in configuration.