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

MetricName should check for name format #27

Open
pocman opened this issue Dec 15, 2017 · 2 comments
Open

MetricName should check for name format #27

pocman opened this issue Dec 15, 2017 · 2 comments

Comments

@pocman
Copy link

pocman commented Dec 15, 2017

Something like that would be nice.

case class MetricName(name: String) extends AnyVal {
 assert(PrometheusMetricFormat.findFirstIn(name).isDefined, s"$name does not match required metric format ${PrometheusMetricFormat.regex}"))
}
@fiadliel
Copy link
Owner

I'll consider it; I do hate having the API throw if used incorrectly (though lost metric information could be as painful in some cases).

I assume you know that the standard way of creating MetricName values is with the metric"" string interpolator? This will validate the metric format at compile time.

@pocman
Copy link
Author

pocman commented Dec 18, 2017 via email

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

No branches or pull requests

2 participants