Skip to content

Commit

Permalink
Admit [0-9]* in in cernan metric names (#15)
Browse files Browse the repository at this point in the history
As pointed out by John, cernan is not able to ingest all the names
that it emits. In particular, consider foo.bar.999. Cernan would
reject this as a bad message.

This resolves #14.

Signed-off-by: Brian L. Troutwine <blt@postmates.com>
  • Loading branch information
blt authored Jun 21, 2016
1 parent ca2ca92 commit 74291e4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cernan"
version = "0.1.2"
version = "0.1.3"
authors = ["Brian L. Troutwine <blt@postmates.com>"]
build = "build.rs"

Expand Down
2 changes: 2 additions & 0 deletions src/metric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ mod tests {

#[test]
fn test_parse_metric_payload() {
assert_eq!(statsd::parse_MetricPayload("foo.bar.99:12.3|ms").unwrap(),
[Metric::new("foo.bar.99", 12.3, MetricKind::Timer)]);
assert_eq!(statsd::parse_MetricPayload("foo.bar:12.3|ms").unwrap(),
[Metric::new("foo.bar", 12.3, MetricKind::Timer)]);
assert_eq!(statsd::parse_MetricPayload("first:1.1|ms\nsnd:2.2|g\n").unwrap(),
Expand Down
2 changes: 1 addition & 1 deletion src/metrics/statsd.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Kind: MetricKind = {
"c@" <Num> => MetricKind::Counter(<>),
};

MetricName: String = <s:r"[_A-Za-z\.-]+"> => String::from_str(s).unwrap();
MetricName: String = <s:r"[A-Za-z][_A-Z0-9a-z\.-]*"> => String::from_str(s).unwrap();

Num: f64 = <s:r"[-+]?[0-9]+\.?[0-9]*"> => f64::from_str(s).unwrap();

Expand Down

0 comments on commit 74291e4

Please sign in to comment.