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

Gateway routes imported/exported/preferred metrics #477

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

LionelJouin
Copy link
Member

Description

Collect metrics of routes imported, exported and preferred for each gateways. The metrics are extracted and parsed from show protocol all command in bird.

Issue link

#419

Checklist

  • Purpose
    • Bug fix
    • New functionality
    • Documentation
    • Refactoring
    • CI
  • Test
    • Unit test
    • E2E Test
    • Tested manually
  • Introduce a breaking change
    • Yes (description required)
    • No

@LionelJouin LionelJouin force-pushed the observability-gateway branch 2 times, most recently from 213ddb9 to 5254e29 Compare November 7, 2023 13:15
@LionelJouin LionelJouin changed the title Gateway Route imported/exported/preferred metrics Gateway routes imported/exported/preferred metrics Nov 7, 2023
@LionelJouin LionelJouin marked this pull request as ready for review November 7, 2023 15:21
@LionelJouin
Copy link
Member Author

Here is a small experiment regarding cpu consumption with 2 exported routes and 1 imported.
watch -n 0.1 curl -k https://localhost:2224/metrics
Idle: 10m
1 req/sec: 15m
10 req/sec: 60m

@LionelJouin LionelJouin force-pushed the observability-gateway branch 2 times, most recently from 95c6cd0 to 78f29ee Compare November 10, 2023 12:49
routesPreferred: 0,
}

routes := regex.FindAllString(protocol, -1)
Copy link
Collaborator

@zolug zolug Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a lot of hassle with all those string operations that follow.
Wouldn't a regex using group matching be easier? https://regex101.com/r/SV8ouF/1
Then you could rely on the single map approach from here: https://stackoverflow.com/questions/60109288/regex-named-groups-in-golang
(You should be looking for 1 match per protocol if I got it right.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, I find it easier to maintain and troubleshoot this than a complex regex

ctx,
observer,
func(birdStats *BirdStats) int64 {
return int64(birdStats.routesImported)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels clumsy that the same operation has to be repeated 3 times in the background because 3 values must be extracted. Isn't there some recommendation in opentelemtry how to avoid this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think opentelemtry gives any recommendation. they are different types of metrics, like rx/tx bytes/packets for an interface.

@zolug
Copy link
Collaborator

zolug commented Jan 31, 2024

Here is a small experiment regarding cpu consumption with 2 exported routes and 1 imported. watch -n 0.1 curl -k https://localhost:2224/metrics Idle: 10m 1 req/sec: 15m 10 req/sec: 60m

Btw. with 100 000 IPv4 routes (net prefix /32) in Kind on my machine:
idle: 10m
1 req/sec: 20m
10 req/sec: 100m

@LionelJouin
Copy link
Member Author

Here is a small experiment regarding cpu consumption with 2 exported routes and 1 imported. watch -n 0.1 curl -k https://localhost:2224/metrics Idle: 10m 1 req/sec: 15m 10 req/sec: 60m

Btw. with 100 000 IPv4 routes (net prefix /32) in Kind on my machine: idle: 10m 1 req/sec: 20m 10 req/sec: 100m

Thanks for checking this, it seems acceptable. Usually Prometheus should fetch the metrics so often.

Collect metrics of routes imported, exported and preferred for each
gateways. The metrics are extracted and parsed from show protocol all
command in bird.
@LionelJouin LionelJouin merged commit 8802720 into master Feb 15, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants