Skip to content

Add checks for invalid metric names and labels.#59

Merged
brian-brazil merged 1 commit intomasterfrom
checks
Feb 9, 2015
Merged

Add checks for invalid metric names and labels.#59
brian-brazil merged 1 commit intomasterfrom
checks

Conversation

@brian-brazil
Copy link
Copy Markdown
Contributor

Document who's responsible for checking produced metrics are valid.

Closes #28
@juliusv

Document who's responsible for checking produced metrics are valid.

Closes #28
@juliusv
Copy link
Copy Markdown
Member

juliusv commented Feb 9, 2015

👍 in principle, but the build is failing with OOM. @brian-brazil @beorn7 Is lack of memory for Java client library tests a known issue?

@brian-brazil
Copy link
Copy Markdown
Contributor Author

This happens a fair bit of the time on the pushgateway test. All tests are passing on my laptop.

brian-brazil added a commit that referenced this pull request Feb 9, 2015
Add checks for invalid metric names and labels.
@brian-brazil brian-brazil merged commit 2cf3887 into master Feb 9, 2015
@brian-brazil brian-brazil deleted the checks branch June 3, 2015 15:41
@checketts
Copy link
Copy Markdown
Contributor

checketts commented Dec 20, 2016

This fix doesn't catch hyphens in the metric name.

Gauge.build().name("a-invalidname").labelNames("validLabel").help("h").create();

@brian-brazil
Copy link
Copy Markdown
Contributor Author

Are you sure your're using a recent enough version of the code?

@checketts
Copy link
Copy Markdown
Contributor

Sorry for leaving that off. I'm using version 0.0.19

@checketts
Copy link
Copy Markdown
Contributor

Oh my code snippet was misleading. My actual code (in an exporter) is doing:

return new MetricFamilySamples(cleanName, Type.GAUGE, help, samples);

So it is bypassing the check. Sorry for the noise.

@brian-brazil
Copy link
Copy Markdown
Contributor Author

Custom collectors don't have sanity checks, it's up to you to ensure they're sane.

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.

Metric and label names should be checked for validity

3 participants