Skip to content

Commit

Permalink
Merge pull request #2934 from golemfactory/release/v0.14
Browse files Browse the repository at this point in the history
v0.14.0 mergeback
  • Loading branch information
kamirr authored Dec 8, 2023
2 parents 5592c5d + fa10df5 commit 07b2cd5
Show file tree
Hide file tree
Showing 8 changed files with 343 additions and 561 deletions.
19 changes: 12 additions & 7 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "yagna"
version = "0.13.2"
version = "0.14.0"
description = "Open platform and marketplace for distributed computations"
readme = "README.md"
authors = ["Golem Factory <contact@golem.network>"]
Expand Down Expand Up @@ -231,16 +231,16 @@ members = [
libsqlite3-sys = { version = "0.26.0", features = ["bundled"] }
#erc20_payment_lib = { version = "0.3.2", git = "https://github.com/golemfactory/erc20_payment_lib", rev = "2fb9949b43ccedf0dfad61926d567debd2d6086f" }
#erc20_payment_lib = { path = "../../payments/erc20_payment_lib/crates/erc20_payment_lib" }
erc20_payment_lib = { version = "=0.3.13" }
erc20_payment_lib = { version = "=0.3.17" }
rand = "0.8.5"
url = "2.3.1"
trust-dns-resolver = "0.22"
derive_more = "0.99.11"
ya-relay-stack = { git = "https://github.com/golemfactory/ya-relay.git", rev = "c92a75b0cf062fcc9dbb3ea2a034d913e5fad8e5" }

ya-relay-client = { git = "https://github.com/golemfactory/ya-relay.git", rev = "785c9c4271f514d47fe18018efb9438007ae611a" }
gftp = { version = "0.4.0", path="core/gftp" }
ya-agreement-utils = { version = "0.6", path="utils/agreement-utils" }
gftp = { version = "0.4.0", path = "core/gftp" }
ya-agreement-utils = { version = "0.6", path = "utils/agreement-utils" }


[patch.crates-io]
Expand Down
25 changes: 25 additions & 0 deletions core/metrics/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,33 @@ impl MetricsService {
actix_web::Scope::new("metrics-api/v1")
// TODO:: add wrapper injecting Bearer to avoid hack in auth middleware
.route("/expose", actix_web::web::get().to(export_metrics))
.route("/sorted", actix_web::web::get().to(export_metrics_sorted))
}
}
//algorith is returning metrics in random order, which is fine for prometheus, but not for human checking metrics
pub fn sort_metrics_txt(metrics: &str) -> String {
let Some(first_line_idx) = metrics.find('\n') else {
return metrics.to_string();
};
let (first_line, metrics_content) = metrics.split_at(first_line_idx);

let mut entries = metrics_content
.split("\n\n") //splitting by double new line to get separate metrics
.map(|s| {
let trimmed = s.trim();
let mut lines = trimmed.split('\n').collect::<Vec<_>>();
lines.sort(); //sort by properties
lines.join("\n")
})
.collect::<Vec<String>>();
entries.sort(); //sort by metric name

first_line.to_string() + "\n" + entries.join("\n\n").as_str()
}

async fn export_metrics_sorted() -> String {
sort_metrics_txt(&METRICS.lock().await.export())
}

pub async fn export_metrics() -> String {
METRICS.lock().await.export()
Expand Down
Loading

0 comments on commit 07b2cd5

Please sign in to comment.