Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(logs): Log noise filter #348

Merged
merged 30 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c8a9106
started work on filter manager
NikolaMilosa Apr 25, 2024
4aeb156
fixing separator
NikolaMilosa Apr 25, 2024
b2c57b6
started working on the newest glibc
NikolaMilosa Apr 25, 2024
b4580b0
fixing bazel base image
NikolaMilosa Apr 26, 2024
efa8931
Merge branch 'main' into nm-log-noise-filter
NikolaMilosa Jun 18, 2024
5aba5a4
running rustfmt
NikolaMilosa Jun 18, 2024
f630d76
Merge branch 'main' into nm-log-noise-filter
NikolaMilosa Jun 26, 2024
96ce602
refactoring
NikolaMilosa Jun 26, 2024
b997521
initial model
NikolaMilosa Jun 28, 2024
63bee34
repinning
NikolaMilosa Jun 28, 2024
81ea2ca
fixing bugs
NikolaMilosa Jun 28, 2024
8abcc8e
ensuring a buildable regex
NikolaMilosa Jun 28, 2024
c131487
clippy
NikolaMilosa Jun 28, 2024
4002765
Merge branch 'main' into nm-log-noise-filter
NikolaMilosa Jun 28, 2024
97e4e87
Merge branch 'main' into nm-log-noise-filter
NikolaMilosa Jul 1, 2024
d24aace
rolling back changes for bazel
NikolaMilosa Jul 1, 2024
f8e3c26
rolling back pre-commit fix
NikolaMilosa Jul 1, 2024
9ea6ef7
Merge branch 'main' into nm-log-noise-filter
NikolaMilosa Jul 1, 2024
1fbe9ae
applying suggestions
NikolaMilosa Jul 1, 2024
4b4c037
refactoring
NikolaMilosa Jul 1, 2024
4a6b93b
fixing bazel
NikolaMilosa Jul 1, 2024
d99b22c
started writing tests
NikolaMilosa Jul 1, 2024
16174dd
finishing backend tests
NikolaMilosa Jul 1, 2024
a6b6cbe
fixing running tests with bazel
NikolaMilosa Jul 1, 2024
e22917a
Merge branch 'main' into nm-log-noise-filter
NikolaMilosa Jul 1, 2024
a2e2e51
adding state file
NikolaMilosa Jul 1, 2024
80ff3a0
fixing clippy
NikolaMilosa Jul 1, 2024
8d3520d
adding fix
NikolaMilosa Jul 1, 2024
a791891
clippy
NikolaMilosa Jul 1, 2024
53bfe7a
Merge branch 'main' into nm-log-noise-filter
NikolaMilosa Jul 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 121 additions & 11 deletions Cargo.Bazel.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "982c13a29a128a09b521a6a2a453103ab8aea1f631648c92e4ca6072ed60a065",
"checksum": "24114f0ea682762469e382f2de27cc6ac7c4cc2499f58e73623fb7837eea9e8b",
"crates": {
"actix-codec 0.5.2": {
"name": "actix-codec",
Expand Down Expand Up @@ -28893,35 +28893,29 @@
],
"crate_features": {
"common": [
"elf",
"errno",
"general",
"ioctl",
"no_std"
],
"selects": {
"aarch64-unknown-linux-gnu": [
"elf",
"errno",
"prctl",
"std",
"system"
],
"arm-unknown-linux-gnueabi": [
"elf",
"errno",
"prctl",
"std",
"system"
],
"armv7-unknown-linux-gnueabi": [
"elf",
"errno",
"prctl",
"std",
"system"
],
"i686-unknown-linux-gnu": [
"elf",
"errno",
"prctl",
"std",
"system"
Expand All @@ -28937,8 +28931,6 @@
"system"
],
"x86_64-unknown-linux-gnu": [
"elf",
"errno",
"prctl",
"std",
"system"
Expand Down Expand Up @@ -29192,6 +29184,122 @@
},
"license": null
},
"log-noise-filter-backend 0.4.2": {
"name": "log-noise-filter-backend",
"version": "0.4.2",
"repository": null,
"targets": [],
"library_target_name": null,
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "axum 0.7.5",
"target": "axum"
},
{
"id": "clap 4.5.7",
"target": "clap"
},
{
"id": "regex 1.10.5",
"target": "regex"
},
{
"id": "serde 1.0.203",
"target": "serde"
},
{
"id": "serde_json 1.0.117",
"target": "serde_json"
},
{
"id": "slog 2.7.0",
"target": "slog"
},
{
"id": "slog-async 2.8.0",
"target": "slog_async"
},
{
"id": "slog-term 2.9.1",
"target": "slog_term"
},
{
"id": "tokio 1.38.0",
"target": "tokio"
}
],
"selects": {}
},
"edition": "2021",
"version": "0.4.2"
},
"license": null
},
"log-noise-filter-downloader 0.4.2": {
"name": "log-noise-filter-downloader",
"version": "0.4.2",
"repository": null,
"targets": [],
"library_target_name": null,
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "anyhow 1.0.86",
"target": "anyhow"
},
{
"id": "clap 4.5.7",
"target": "clap"
},
{
"id": "reqwest 0.12.5",
"target": "reqwest"
},
{
"id": "serde 1.0.203",
"target": "serde"
},
{
"id": "serde_json 1.0.117",
"target": "serde_json"
},
{
"id": "slog 2.7.0",
"target": "slog"
},
{
"id": "slog-async 2.8.0",
"target": "slog_async"
},
{
"id": "slog-term 2.9.1",
"target": "slog_term"
},
{
"id": "tokio 1.38.0",
"target": "tokio"
},
{
"id": "url 2.5.2",
"target": "url"
}
],
"selects": {}
},
"edition": "2021",
"version": "0.4.2"
},
"license": null
},
"lzma-sys 0.1.20": {
"name": "lzma-sys",
"version": "0.1.20",
Expand Down Expand Up @@ -50794,6 +50902,8 @@
"ic-management-backend 0.4.2": "rs/ic-management-backend",
"ic-management-types 0.4.2": "rs/ic-management-types",
"log-fetcher 0.4.2": "rs/log-fetcher",
"log-noise-filter-backend 0.4.2": "rs/ic-observability/log-noise-filter-backend",
"log-noise-filter-downloader 0.4.2": "rs/ic-observability/log-noise-filter-downloader",
"multiservice-discovery 0.4.2": "rs/ic-observability/multiservice-discovery",
"multiservice-discovery-downloader 0.4.2": "rs/ic-observability/multiservice-discovery-downloader",
"multiservice-discovery-shared 0.4.2": "rs/ic-observability/multiservice-discovery-shared",
Expand Down
31 changes: 31 additions & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ members = [
"rs/ic-management-backend",
"rs/ic-management-types",
"rs/ic-observability/config-writer-common",
"rs/ic-observability/log-noise-filter-backend",
"rs/ic-observability/log-noise-filter-downloader",
"rs/ic-observability/multiservice-discovery",
"rs/ic-observability/multiservice-discovery-downloader",
"rs/ic-observability/multiservice-discovery-shared",
Expand All @@ -18,7 +20,7 @@ members = [
"rs/canister-log-fetcher",
"rs/np-notifications",
"rs/rollout-controller",
"rs/slack-notifications",
"rs/slack-notifications",
]

resolver = "2"
Expand Down
2 changes: 2 additions & 0 deletions bazel/external_crates.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def external_crates_repository():
"//rs/ic-management-backend:Cargo.toml",
"//rs/ic-management-types:Cargo.toml",
"//rs/ic-observability/config-writer-common:Cargo.toml",
"//rs/ic-observability/log-noise-filter-backend:Cargo.toml",
"//rs/ic-observability/log-noise-filter-downloader:Cargo.toml",
"//rs/ic-observability/multiservice-discovery:Cargo.toml",
"//rs/ic-observability/multiservice-discovery-downloader:Cargo.toml",
"//rs/ic-observability/multiservice-discovery-shared:Cargo.toml",
Expand Down
2 changes: 1 addition & 1 deletion k8s/oci_images.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def python_oci_image_rules(name, src, base_image = "@distroless_python3"):
}
)

tarball_name = "{}-tarball".format(binary.name)
tarball_name = "tarball".format(binary.name)
oci_tarball(
name = tarball_name,
image = image_rule_name,
Expand Down
25 changes: 25 additions & 0 deletions rs/ic-observability/log-noise-filter-backend/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
load("@crate_index_dre//:defs.bzl", "aliases", "all_crate_deps")
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_test")
load("@//rs:oci_images.bzl", "rust_binary_oci_image_rules")

DEPS = []

rust_binary(
name = "log-noise-filter-backend",
srcs = glob(["src/**/*.rs"]),
aliases = aliases(),
proc_macro_deps = all_crate_deps(
proc_macro = True,
),
stamp = 1,
deps = all_crate_deps(
normal = True,
) + DEPS,
)

rust_binary_oci_image_rules(
name = "oci_image",
src = ":log-noise-filter-backend",
base_image = "@debian-slim"
)

20 changes: 20 additions & 0 deletions rs/ic-observability/log-noise-filter-backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "log-noise-filter-backend"
version.workspace = true
edition.workspace = true
authors.workspace = true
description.workspace = true
documentation.workspace = true

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { workspace = true }
axum = "0.7.4"
slog = { workspace = true }
slog-async = { workspace = true }
slog-term = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
regex = { workspace = true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use std::collections::BTreeMap;

use axum::{extract::State, http::StatusCode, Json};

use super::Server;

pub async fn delete_criteria(
State(state): State<Server>,
Json(criteria): Json<Vec<u32>>,
) -> Result<Json<BTreeMap<u32, String>>, (StatusCode, String)> {
match state.delete_criteria(criteria).await {
Ok(()) => Ok(Json(state.get_criteria_mapped().await)),
Err(missing) => Err((StatusCode::NOT_FOUND, format!("Missing indexes: {:?}", missing))),
}
}
10 changes: 10 additions & 0 deletions rs/ic-observability/log-noise-filter-backend/src/handlers/get.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use std::collections::BTreeMap;

use axum::http::StatusCode;
use axum::{extract::State, Json};

use super::Server;

pub(crate) async fn get_criteria(State(state): State<Server>) -> Result<Json<BTreeMap<u32, String>>, (StatusCode, String)> {
Ok(Json(state.get_criteria_mapped().await))
}
Loading
Loading