Skip to content

Commit

Permalink
It is sysinspect :)
Browse files Browse the repository at this point in the history
  • Loading branch information
isbm committed Sep 30, 2024
1 parent 17b61b9 commit 089562e
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Syspect
# Sysinspect

The name consists of three words:

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project = "Syspect"
project = "Sysinspect"
copyright = "2024, Bo Maryniuk"
author = "Bo Maryniuk"
version = "0.1"
Expand Down
12 changes: 6 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Welcome to the Project Syspect!
====================================
Welcome to the Project Sysinspect!
==================================

.. note::
This documentation covers **Syspect** — the solution to
This documentation covers **Sysinspect** — the solution to
examine any system, based on its architecture Model Description.

.. toctree::
:maxdepth: 1

modeldescr/overview

Welcome to Syspect: an engine of Anomaly Detection and Root Cause Analysis.
Welcome to Sysinspect: an engine of Anomaly Detection and Root Cause Analysis.
The name consists of two words "system" and "inspection", resulting in "suspicion".

This engine is indented to perform anomaly detection and root cause analysis on
Expand All @@ -20,12 +20,12 @@ modules with telemetry data in order to perform various testing scenarios.
Licence
-------

**Syspect** is distributed under Apache 2.0 Licence.
**Sysinspect** is distributed under Apache 2.0 Licence.

Limitations
-----------

Currently **Syspect** is an experimental concept.
Currently **Sysinspect** is an experimental concept.

Contributing
------------
Expand Down
2 changes: 1 addition & 1 deletion docs/modeldescr/states.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ of the specific area.
Usage
-----

:bi:`Syspect` can accept several states, excluding all others. If no keyword ``--states``
:bi:`Sysinspect` can accept several states, excluding all others. If no keyword ``--states``
is passed, then default state is selected:

.. code-block:: text
Expand Down
2 changes: 1 addition & 1 deletion examples/models/router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ checkbook:
The flow works the following way:
1. Checkbook provides only "entrance" spots where Syspect needs
1. Checkbook provides only "entrance" spots where Sysinspect needs
to start investigations.
2. An entity, if is a collection of other entities (a group) will
Expand Down
24 changes: 12 additions & 12 deletions libsysinspect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub mod runtime;
pub mod tpl;

#[derive(Debug)]
pub enum SyspectError {
pub enum SysinspectError {
// Specific errors
ModelMultipleIndex(String),
ModelDSLError(String),
Expand All @@ -21,24 +21,24 @@ pub enum SyspectError {
SerdeYaml(serde_yaml::Error),
}

impl Error for SyspectError {
impl Error for SysinspectError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
match self {
SyspectError::IoErr(err) => Some(err),
SysinspectError::IoErr(err) => Some(err),
_ => None,
}
}
}

impl Display for SyspectError {
impl Display for SysinspectError {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
let msg = match self {
SyspectError::ModelMultipleIndex(m) => {
SysinspectError::ModelMultipleIndex(m) => {
format!("Another {} file found as '{}'", mspec::MODEL_INDEX, m)
}
SyspectError::IoErr(err) => format!("(I/O) {err}"),
SyspectError::SerdeYaml(err) => format!("(YAML) {err}"),
SyspectError::ModelDSLError(err) => format!("(DSL) {err}"),
SysinspectError::IoErr(err) => format!("(I/O) {err}"),
SysinspectError::SerdeYaml(err) => format!("(YAML) {err}"),
SysinspectError::ModelDSLError(err) => format!("(DSL) {err}"),
};

write!(f, "{msg}")?;
Expand All @@ -47,15 +47,15 @@ impl Display for SyspectError {
}

/// Handle IO errors
impl From<io::Error> for SyspectError {
impl From<io::Error> for SysinspectError {
fn from(err: io::Error) -> Self {
SyspectError::IoErr(err)
SysinspectError::IoErr(err)
}
}

/// Handle YAML errors
impl From<serde_yaml::Error> for SyspectError {
impl From<serde_yaml::Error> for SysinspectError {
fn from(err: serde_yaml::Error) -> Self {
SyspectError::SerdeYaml(err)
SysinspectError::SerdeYaml(err)
}
}
18 changes: 9 additions & 9 deletions libsysinspect/src/mdl/mspec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::SyspectError;
use crate::SysinspectError;
use serde_yaml::Value;
use std::{fs, path::PathBuf};
use walkdir::WalkDir;
Expand All @@ -23,7 +23,7 @@ impl SpecLoader {
}

/// Collect YAML parts of the model from a different files
fn collect_parts(&mut self) -> Result<Vec<Value>, SyspectError> {
fn collect_parts(&mut self) -> Result<Vec<Value>, SysinspectError> {
let mut out = Vec::<Value>::new();

for etr in WalkDir::new(&self.pth).follow_links(true).into_iter().filter_map(Result::ok) {
Expand All @@ -40,7 +40,7 @@ impl SpecLoader {

if fname == MODEL_INDEX {
if self.init {
return Err(SyspectError::ModelMultipleIndex(etr.path().as_os_str().to_str().unwrap().to_string()));
return Err(SysinspectError::ModelMultipleIndex(etr.path().as_os_str().to_str().unwrap().to_string()));
} else {
self.init = true;
out.insert(0, serde_yaml::from_str::<Value>(&fs::read_to_string(etr.path())?)?);
Expand All @@ -49,7 +49,7 @@ impl SpecLoader {
// Get YAML chunks
match serde_yaml::from_str::<Value>(&fs::read_to_string(etr.path())?) {
Ok(chunk) => out.push(chunk),
Err(err) => return Err(SyspectError::ModelDSLError(format!("Unable to parse {fname}: {err}"))),
Err(err) => return Err(SysinspectError::ModelDSLError(format!("Unable to parse {fname}: {err}"))),
}
}
}
Expand All @@ -59,9 +59,9 @@ impl SpecLoader {
}

/// Merge YAML parts
fn merge_parts(&mut self, chunks: &mut Vec<Value>) -> Result<Value, SyspectError> {
fn merge_parts(&mut self, chunks: &mut Vec<Value>) -> Result<Value, SysinspectError> {
if chunks.len() == 0 {
return Err(SyspectError::ModelMultipleIndex("blah happened".to_string()));
return Err(SysinspectError::ModelMultipleIndex("blah happened".to_string()));
// XXX: Add one more exception
}

Expand All @@ -86,7 +86,7 @@ impl SpecLoader {
// Non-null "b" implies a structure, which is not formed as a key/val,
// therefore cannot be added to the DSL root
if !b.is_null() {
return Err(SyspectError::ModelDSLError(format!(
return Err(SysinspectError::ModelDSLError(format!(
"Mapping expected, but this structure passed: {:?}\n\t > {:?}",
a, b
)));
Expand All @@ -99,13 +99,13 @@ impl SpecLoader {

/// Load model spec by merging all the data parts and validating
/// its content.
fn load(&mut self) -> Result<ModelSpec, SyspectError> {
fn load(&mut self) -> Result<ModelSpec, SysinspectError> {
let mut parts = self.collect_parts()?;
Ok(serde_yaml::from_value(self.merge_parts(&mut parts)?)?)
}
}

/// Load spec from a given path
pub fn load(path: &str) -> Result<ModelSpec, SyspectError> {
pub fn load(path: &str) -> Result<ModelSpec, SysinspectError> {
Ok(SpecLoader::new(path).load()?)
}
6 changes: 3 additions & 3 deletions libsysinspect/src/mdl/mspecdef.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use serde_yaml::Value;

use crate::SyspectError;
use crate::SysinspectError;

/// Model Specification
/// ===================
Expand Down Expand Up @@ -34,7 +34,7 @@ pub struct ModelSpec {
}

impl ModelSpec {
fn find(&self, v: Value) -> Result<Value, SyspectError> {
fn find(&self, v: Value) -> Result<Value, SysinspectError> {
match v {
/*
Value::Sequence(v) => {
Expand All @@ -54,7 +54,7 @@ impl ModelSpec {
_ => {}
}

Err(SyspectError::ModelDSLError("Object not found".to_string()))
Err(SysinspectError::ModelDSLError("Object not found".to_string()))
}

/// Traverse the namespace by "foo:bar:person.name" syntax.
Expand Down

0 comments on commit 089562e

Please sign in to comment.