Skip to content

Commit

Permalink
Merge pull request #55 from aparcar/openmetrics
Browse files Browse the repository at this point in the history
add support for OpenMetrics message format
  • Loading branch information
bheisler authored Aug 16, 2022
2 parents 0941755 + b736ea2 commit d4875cf
Show file tree
Hide file tree
Showing 5 changed files with 414 additions and 258 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

# [Unreleased]
### Added
- New message output format for [OpenMetrics](https://openmetrics.io).

## [1.1.0] - 2021-07-28
### Fixed
Expand Down Expand Up @@ -66,4 +68,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[1.0.0]: https://github.com/bheisler/cargo-criterion/compare/1.0.0-alpha3...1.0.0
[1.0.1]: https://github.com/bheisler/cargo-criterion/compare/1.0.0-alpha3...1.0.1
[1.0.1]: https://github.com/bheisler/cargo-criterion/compare/1.0.1...1.1.0
[Unreleased]: https://github.com/bheisler/cargo-criterion/compare/1.1.0...HEAD
[Unreleased]: https://github.com/bheisler/cargo-criterion/compare/1.1.0...HEAD
6 changes: 4 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,13 @@ impl PlottingBackend {
#[derive(Debug)]
pub enum MessageFormat {
Json,
OpenMetrics,
}
impl MessageFormat {
fn from_str(s: &str) -> MessageFormat {
match s {
"json" => MessageFormat::Json,
"openmetrics" => MessageFormat::OpenMetrics,
other => panic!("Unknown message format: {}", other),
}
}
Expand Down Expand Up @@ -412,10 +414,10 @@ bencher: Emulates the output format of the bencher crate and nightly-only libtes
.arg(Arg::with_name("message-format")
.long("message-format")
.takes_value(true)
.possible_values(&["json"])
.possible_values(&["json", "openmetrics"])
.help("If set, machine-readable output of the requested format will be printed to stdout.")
.long_help(
"Change the machine-readable output format. Possible values are [json].
"Change the machine-readable output format. Possible values are [json, openmetrics].
Machine-readable information on the benchmarks will be printed in the requested format to stdout.
All of cargo-criterion's other output will be printed to stderr.
Expand Down
Loading

0 comments on commit d4875cf

Please sign in to comment.