Skip to content

Commit

Permalink
change response time from nano to millisecond
Browse files Browse the repository at this point in the history
  • Loading branch information
xudesheng committed May 11, 2022
1 parent a367d3b commit 10089d6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added

## [v4.3.1] - 2022-05-011

### Changed
- Support to expose metrics in Prometheus format (http://localhost:19090/metrics).
- Changed the response time unit from nano to milliseconds.

## [v4.3.0] - 2022-05-011

### Added
Expand Down
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 = "tsample"
version = "4.3.0"
version = "4.3.1"
authors = ["xudesheng <[email protected]>"]
edition = "2021"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/prometheus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub async fn prometheus_thread(
if field.0 == "ResponseTime" {
response_time
.with_label_values(&[&write_spec.measurement])
.observe(value);
.observe(value / 1000000.0); // convert to milliseconds from nanoseconds
} else {
let map = gauge_map.read().expect("Read Lock poisoned.");
let mut label_values: Vec<&str> = vec![];
Expand Down

0 comments on commit 10089d6

Please sign in to comment.