Skip to content

Reflective version of #305#341

Merged
brian-brazil merged 2 commits intomasterfrom
unknown repository
Feb 16, 2018
Merged

Reflective version of #305#341
brian-brazil merged 2 commits intomasterfrom
unknown repository

Conversation

@marcust
Copy link
Copy Markdown
Contributor

@marcust marcust commented Feb 14, 2018

This is a reflective version of #305

I've actually no idea how to write meaningful tests for that, it works in my context.

*
* Can be replaced with a simple access once JDK 1.7 compatibility is baseline.
*
* @author marcus
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.

We don't use these in this repo

import java.util.logging.Logger;

/**
* A backward compatible way to get the buffer MX beans as well
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.

Full sentences with full stops please.

getCount = bufferPoolMXBeanClass.getMethod("getCount");

} catch (ClassNotFoundException e) {
LOGGER.info("BufferPoolMXBean not available, not metrics for buffer pools will be exported");
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.

I'm not sure we should be putting this in the logs, just debug is fine.

s/not/no/

@Override
public List<MetricFamilySamples> collect() {
List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>();
addBufferPoolMetrics(mfs);
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 function can be inlined.


void addBufferPoolMetrics(List<MetricFamilySamples> sampleFamilies) {
GaugeMetricFamily used = new GaugeMetricFamily(
"jvm_buffer_pool_bytes_used",
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.

jvm_buffer_pool_used_bytes

The unit goes last

@brian-brazil brian-brazil merged commit d7eef0f into prometheus:master Feb 16, 2018
@brian-brazil
Copy link
Copy Markdown
Contributor

Thanks!

@marcust marcust deleted the feature/buffer-pools branch February 16, 2018 11:08
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