feat: add telemetry subcrate #15
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Discussion
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Platform
All
Platform
Android
Platform
IOS
Platform
Linux
Platform
MacOS
Platform
Mobile
Platform
UNIX
Platform
Web
Platform
Windows
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
Testing
Not needed
Testing
Required
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: nonsensical-dev/zenyx-engine#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "nici/zenyx-engine-telemetry:telemetry"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -1 +1 @@
include!("main.rs");
include!("main.rs");
Why is this even being changed?
@ -0,0 +1,684 @@
{
Again, this can be inlined.
probably shouldn't tho.
as to not pollute the source file
@ -0,0 +36,4 @@
#[derive(Debug, Serialize, Default)]
pub struct DisplayInfo {
resolution: String,
refresh_rate: String,
Nit, this could be a float instead.
Or even an int...
I suggested a float as some monitors run at strange refresh rates, such as 59.97 hz, so a float would be the only way to store that as a non-string value.
ah fair
@ -0,0 +332,4 @@
edition: String,
version: String,
architecture: String,
kernel: String,
kernel
andde
should be optional askernel
is only applicable on macOS and Linux, andde
is only applicable on Linux.@ -0,0 +346,4 @@
} else if cfg!(target_pointer_width = "32") {
String::from("32 bit")
} else {
String::from("16 bit")
16-bit is not supported, I'd rather this just say "unknown" or something similar.
@ -0,0 +621,4 @@
pub fn format_duration(duration: StdDuration) -> String {
let mut parts = Vec::new();
let mut remaining = duration.as_secs();
let units = [
This should be done with
1chrono
timeago
instead.chrono
does not support relative time, use the suggested crate instead, it's quite minimal. ↩︎Chrono supports relative time. That's what
chrono::Duration
is for. To format it, one can simply use the serialize or display implementation which return the duration in ISO8601impl Display for TimeDelta
(Duration
is just an alias forTimeDelta
)If only the docs were actually properly searchable 🤦♀️
@ -0,0 +1,3 @@
fn main() {
This file should not be in the subcrate.
@ -0,0 +1,318 @@
{
This could be inlined as a static or done some other way that doesn't require this file.
again
inline_str!()
I agree with lily on almost all. Although I would request you to create seperate files for the modules and only use inline modules for tests etc. as unnecessarily long files are difficult to work with
Maybe also fix the weird UTF-8 bugs in the json dumps
Please fix your Git identity, the email associated with your commits is not the one linked to your account. Additionally, like BitSyndicate said, please separate this into multiple files and multiple commits.
Structs are generally not type safe, and have finite values that are being ignored. Examples can be found on these lines:
22..27
31..34
36..40
210..217
278..284
286..291
330..336
370..377
410..413
608..612
as a specific example, looking at the structs in the gpu module
DriverInfo
,AdapterInfo
,GPUInfo
, andDisplayInfo
, they use strings for known uint values and cannot be logically compared:As a more intricate suggestion, making use of the
Versions
crate would be ideal for this use-case. To quote their example:Other than the type safety, the code makes many assumptions via
.unwrap()
and.expect()
calls, instead of having fallible functions.In addition, the code also lacks documentation and tests, even in potentially ambigous areas, for example:
Without context, anyone reading this would not know that vendors have predetermined ID's assigned to them, which should be clarified.
Due to the former, I wouldn't feel comfortable using this crate in the main engine quite yet. If these issues are corrected, this PR will be reconsidered for merging.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.