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

router: extend packet processing metrics #4422

Merged
merged 29 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3109ace
router: initial draft of local/transit/incoming/outgoing awareness in…
jiceatscion Oct 4, 2023
c005f7a
Merge branch 'scionproto:master' into router_metrics
jiceatscion Oct 5, 2023
73b602b
router: Make the added metrics and the tests get along.
jiceatscion Oct 6, 2023
f7222de
router: Add the size-class dimension to metrics.
jiceatscion Oct 6, 2023
b5d0b88
router: missed a refactoring spot or two.
jiceatscion Oct 6, 2023
adcb417
router: fix metrics labels initialization.
jiceatscion Oct 9, 2023
509ba2a
router: Cleanup the sizeClass metrics label and give lint some code f…
jiceatscion Oct 10, 2023
b2d65bc
router: add custom exporter for more /proc/pid/stat info.
jiceatscion Oct 11, 2023
bc4b73a
router: Some refinements to the new process metrics.
jiceatscion Oct 12, 2023
5117ccb
router: replace iowait metrics with scheduler stats metrics.
jiceatscion Oct 13, 2023
e42fa42
Merge branch 'scionproto:master' into router_metrics
jiceatscion Oct 16, 2023
5f74905
router: Add relabeling for the pkt metrics.
jiceatscion Oct 16, 2023
3e72e81
router: make amends to the style police.
jiceatscion Oct 17, 2023
cc1e2b6
router: reduce the cost of the processmetrics collector.
jiceatscion Oct 20, 2023
037e4f5
router: code formating.
jiceatscion Oct 20, 2023
227f413
router: delete files~ accidentally committed.
jiceatscion Oct 23, 2023
1c1e4bb
router: Simplified the schedstats map out. Was a case of expensive YA…
jiceatscion Oct 23, 2023
9380f5a
router: cleanup naming, error reporting and logging.
jiceatscion Oct 23, 2023
d7c0b23
git: add ignore pattern for emacs backupi files.
jiceatscion Oct 23, 2023
c6f6782
router: refactored traffic type in metrics.
jiceatscion Oct 24, 2023
cfdcd09
router: make maxSizeClass smaller by supporting only the paket size s…
jiceatscion Oct 25, 2023
726f9ef
router: fix formatting
jiceatscion Oct 25, 2023
90b0441
router: restore JOB_METRIC_RELABEL even if empty.
jiceatscion Oct 25, 2023
231c59a
router: Simplified the relationship between readUpTo and runForwarder.
jiceatscion Oct 25, 2023
9133b95
router: Use writeMsg buffer as tmp buffer rather than persistent queue.
jiceatscion Oct 26, 2023
8f3acaf
router: moved all the metrics code to metrics.go
jiceatscion Oct 26, 2023
7d17454
router: minor cleanup
jiceatscion Oct 26, 2023
aefb839
router: code cleanup
jiceatscion Oct 26, 2023
f27c4c2
Merge branch 'master' into router_metrics
matzf Oct 30, 2023
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ _build
node_modules

# gobra
#######
*.vpr
tmp/
logger.log

# emacs backup files
####################
*~
12 changes: 8 additions & 4 deletions demo/file_transfer/file_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,15 @@ def _get_br_traffic(self, endpoint):
conn.request('GET', '/metrics')
resp = conn.getresponse()
metrics = resp.read().decode('utf-8')
total = 0
regexp = re.compile(r"""^router_input_bytes_total{.*interface="internal".*\s(.*)$""")
for line in metrics.splitlines():
m = re.search(r"""^router_input_bytes_total{interface="internal".*\s(.*)$""", line)
if m is not None:
return float(m.group(1)) / 1024 / 1024
return None
try:
m = regexp.search(line)
total += float(m.group(1)) / 1024 / 1024
except (TypeError, AttributeError, ValueError):
pass
return total

def setup_prepare(self):
print("setting up the infrastructure")
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ require (
github.com/pelletier/go-toml v1.9.5
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/procfs v0.12.0
github.com/quic-go/quic-go v0.38.1
github.com/sergi/go-diff v1.3.1
github.com/smartystreets/goconvey v1.7.2
Expand All @@ -44,7 +45,7 @@ require (
go4.org/netipx v0.0.0-20230125063823-8449b0a6169f
golang.org/x/crypto v0.6.0
golang.org/x/net v0.10.0
golang.org/x/sync v0.2.0
golang.org/x/sync v0.3.0
golang.org/x/tools v0.9.1
google.golang.org/grpc v1.57.0
google.golang.org/grpc/examples v0.0.0-20230222033013-5353eaa44095
Expand Down Expand Up @@ -97,7 +98,6 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/quic-go/qtls-go1-20 v0.3.3 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
Expand All @@ -112,7 +112,7 @@ require (
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230815205213-6bfd019c3878 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
github.com/quic-go/qtls-go1-20 v0.3.3 h1:17/glZSLI9P9fDAeyCHBFSWSqJcwx1byhLwP5eUIDCM=
github.com/quic-go/qtls-go1-20 v0.3.3/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
github.com/quic-go/quic-go v0.38.1 h1:M36YWA5dEhEeT+slOu/SwMEucbYd0YFidxG3KlGPZaE=
Expand Down Expand Up @@ -564,8 +564,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -617,8 +617,8 @@ golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
12 changes: 6 additions & 6 deletions go_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1012,8 +1012,8 @@ def go_deps():
go_repository(
name = "com_github_prometheus_procfs",
importpath = "github.com/prometheus/procfs",
sum = "h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=",
version = "v0.8.0",
sum = "h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=",
version = "v0.12.0",
)
go_repository(
name = "com_github_quic_go_qpack",
Expand Down Expand Up @@ -1482,14 +1482,14 @@ def go_deps():
go_repository(
name = "org_golang_x_sync",
importpath = "golang.org/x/sync",
sum = "h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=",
version = "v0.2.0",
sum = "h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=",
version = "v0.3.0",
)
go_repository(
name = "org_golang_x_sys",
importpath = "golang.org/x/sys",
sum = "h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=",
version = "v0.8.0",
sum = "h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=",
version = "v0.12.0",
)
go_repository(
name = "org_golang_x_term",
Expand Down
60 changes: 60 additions & 0 deletions pkg/private/processmetrics/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
srcs = [
"processmetrics_linux.go",
"processmetrics_other.go",
],
importpath = "github.com/scionproto/scion/pkg/private/processmetrics",
visibility = ["//visibility:public"],
deps = select({
"@io_bazel_rules_go//go/platform:aix": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:android": [
"//pkg/private/serrors:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prometheus_procfs//:go_default_library",
],
"@io_bazel_rules_go//go/platform:darwin": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:dragonfly": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:freebsd": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:illumos": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:ios": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:js": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:linux": [
"//pkg/private/serrors:go_default_library",
"@com_github_prometheus_client_golang//prometheus:go_default_library",
"@com_github_prometheus_procfs//:go_default_library",
],
"@io_bazel_rules_go//go/platform:netbsd": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:openbsd": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:plan9": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:solaris": [
"//pkg/private/serrors:go_default_library",
],
"@io_bazel_rules_go//go/platform:windows": [
"//pkg/private/serrors:go_default_library",
],
"//conditions:default": [],
}),
)
Loading
Loading