-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the `tui`'s Threads view This new view relies on the Logstash's hot-threads API to display the busiest threads and their traces. In addition to that, it also added the `User-Agent` header to HTTP requests, and fixed minor UI issues.
- Loading branch information
Showing
19 changed files
with
807 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ documentation = "https://github.com/edmocosta/tuistash" | |
keywords = ["logstash", "tui", "cli", "terminal"] | ||
categories = ["command-line-utilities"] | ||
authors = ["Edmo Vamerlatti Costa <[email protected]>"] | ||
version = "0.3.0" | ||
version = "0.4.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
@@ -29,7 +29,8 @@ crossterm = { version = "0.27.0", default-features = false, features = ["event-s | |
num-format = { version = "0.4", default-features = false, features = ["with-num-bigint"] } | ||
human_format = { version = "1.1" } | ||
uuid = { version = "1.4", features = ["v4"] } | ||
time = { version = "0.3", features = ["default", "formatting", "local-offset"] } | ||
time = { version = "0.3", features = ["default", "formatting", "local-offset", "parsing"] } | ||
regex = { version = "1.10.5", features = [] } | ||
|
||
[[bin]] | ||
name = "tuistash" | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use std::collections::HashMap; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Default, Debug, Clone, Serialize, Deserialize)] | ||
#[serde(default)] | ||
pub struct NodeHotThreads { | ||
pub hot_threads: HotThreads, | ||
} | ||
|
||
#[derive(Default, Debug, Clone, Serialize, Deserialize)] | ||
#[serde(default)] | ||
pub struct HotThreads { | ||
pub time: String, | ||
pub busiest_threads: u64, | ||
#[serde(with = "threads")] | ||
pub threads: HashMap<i64, Thread>, | ||
} | ||
|
||
mod threads { | ||
use std::collections::HashMap; | ||
|
||
use serde::de::{Deserialize, Deserializer}; | ||
use serde::ser::Serializer; | ||
|
||
use super::Thread; | ||
|
||
pub fn serialize<S>(map: &HashMap<i64, Thread>, serializer: S) -> Result<S::Ok, S::Error> | ||
where | ||
S: Serializer, | ||
{ | ||
serializer.collect_seq(map.values()) | ||
} | ||
|
||
pub fn deserialize<'de, D>(deserializer: D) -> Result<HashMap<i64, Thread>, D::Error> | ||
where | ||
D: Deserializer<'de>, | ||
{ | ||
let vertices = Vec::<Thread>::deserialize(deserializer)?; | ||
let mut map = HashMap::with_capacity(vertices.len()); | ||
|
||
for item in vertices { | ||
map.insert(item.thread_id, item); | ||
} | ||
|
||
Ok(map) | ||
} | ||
} | ||
|
||
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)] | ||
#[serde(default)] | ||
pub struct Thread { | ||
pub name: String, | ||
pub thread_id: i64, | ||
pub percent_of_cpu_time: f64, | ||
pub state: String, | ||
pub traces: Vec<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.