Add PlatformCollector to collect information about the platform by mortenlj · Pull Request #152 · prometheus/client_python · GitHub
Skip to content

Add PlatformCollector to collect information about the platform#152

Merged
brian-brazil merged 6 commits into
prometheus:masterfrom
mortenlj:master
Mar 30, 2017
Merged

Add PlatformCollector to collect information about the platform#152
brian-brazil merged 6 commits into
prometheus:masterfrom
mortenlj:master

Conversation

@mortenlj

Copy link
Copy Markdown
Contributor

In the same vein as prometheus/client_java@bdc6f25 and prometheus/client_js@ee561e2, this PR adds Python version and some other metadata as labels on a small set of metrics.

This has turned out to be very useful for creating common dashboards across implementation languages, allowing the dashboard to extract metadata from the metrics exposed.

Python, machine and system information is collected once at startup, and
exposed as labels on a metric with value 1.

Python, machine and system information is collected once at startup, and
exposed as labels on a metric with value 1.
@brian-brazil

Copy link
Copy Markdown
Contributor

@mortenlj

Copy link
Copy Markdown
Contributor Author

Yeah, I can see the point about the machine info, I'll remove that.

I'll remove the windows, linux, darwin stuff too, as that is also something the node exporter can handle.

What do you think about the java info? If you are using jython, which java version your application is using becomes relevant, and it's not something the node exporter can tell you (it might tell you which java versions are installed, but not necessarily which one is used to run your application).

@brian-brazil

Copy link
Copy Markdown
Contributor

Keeping Jython stats makes sense. There's an open question on how to handle a mix of Jython and client_java stats, but noone has asked about it yet.

Comment thread prometheus_client/platform_collector.py Outdated
def _java(self):
java_version, _, vminfo, osinfo = self._platform.java_ver()
vm_name, vm_release, vm_vendor = vminfo
system, kernel, _ = osinfo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is unused

Comment thread prometheus_client/platform_collector.py Outdated


class PlatformCollector(object):
"""Collector for platform information"""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"Python platform" would be a little clearer.

@brian-brazil brian-brazil merged commit 91171a0 into prometheus:master Mar 30, 2017
@brian-brazil

Copy link
Copy Markdown
Contributor

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