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

Use libovsdb bindings for collecting ovs metrics #4637

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

crnithya
Copy link

@crnithya crnithya commented Aug 16, 2024

What this PR does and why is it needed

This PR creates an ovsdb client for a node's vswitch database at startup and monitors selected tables. OVS metrics is collected periodically from these tables instead of executing ovs-vsctl commands, for performance benefits.

Which issue(s) this PR fixes

Fixes #

Special notes for reviewers

How to verify it

Details to documentation updates

Description for the changelog

Does this PR introduce a user-facing change?


@crnithya crnithya requested a review from a team as a code owner August 16, 2024 22:44
@crnithya crnithya marked this pull request as draft August 16, 2024 22:44
@github-actions github-actions bot added the area/unit-testing Issues related to adding/updating unit tests label Aug 16, 2024
@jcaamano jcaamano requested review from jcaamano and removed request for ricky-rav August 21, 2024 08:20
@@ -0,0 +1,17 @@
package ops
Copy link
Contributor

Choose a reason for hiding this comment

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

So I would probably setup a different package for ovn and ovs ops: ops/ovn and ops/ovs

Also no need to qualify the methods themselves, if needed we can rely on package qualification: ops.ListOVSBridges vs ovsops.ListBridges

Copy link
Author

Choose a reason for hiding this comment

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

I have updated the code moving the ovs related ops under libovsdb/ops and also fixed the naming.
I can work on moving ovn related ops to ops/ovn as a different PR.

)

// Get OpenvSwitch table from the cache
func GetOVSOpenvSwitchTable(ovsClient libovsdbclient.Client) (*vswitchd.OpenvSwitch, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would probably leave this at GetOpenVSwitch

Copy link
Author

Choose a reason for hiding this comment

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

I have updated the naming

Copy link
Contributor

Choose a reason for hiding this comment

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

But how about GetOpenvSwitch? This not getting the OpenvSwitch table, just the single row that happens to be in that table. Maybe you and I are thinking in something different with Table. If so, do let me know.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed. Thanks for catching this misnomer, I started off with this getting the full table and changed later to single row.

go-controller/pkg/metrics/metrics.go Outdated Show resolved Hide resolved
go-controller/Makefile Outdated Show resolved Hide resolved
client.WithTable(&vswitchd.OpenvSwitch{}),
client.WithTable(&vswitchd.Bridge{}),
client.WithTable(&vswitchd.Port{}),
client.WithTable(&vswitchd.Interface{}),
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that metrics is not the best amortization of the extra memory consumption this brings. But I also guess as we further migrate things to libovsdb it would make more sense. What are the plans for further pieces? This is marked as WIP, do you plan to merge this before the other pieces come? Trying to get a sense of a timeline.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I am planning to start the migration to libovsdb with metrics first.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to have and merge all at once? Each bit could be a different commit here, and I would do a staggered review of each without waiting for the full set. The only problem would be rebases, but we don't expect a lot of changes on the OVS calls that we make.

It is more convenient for our downstream but I understand it might be too much to ask.

Copy link
Author

Choose a reason for hiding this comment

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

It will be difficult to address all at once. I have added another commit to this though, to address those OVN metrics using vsctl.

@crnithya crnithya changed the title [WIP] Use libovsdb package for collecting ovs metrics Use libovsdb package for collecting ovs metrics Sep 10, 2024
@crnithya crnithya marked this pull request as ready for review September 10, 2024 21:39
@crnithya crnithya changed the title Use libovsdb package for collecting ovs metrics Use libovsdb bindings for collecting ovs metrics Sep 10, 2024
@crnithya crnithya force-pushed the libovsdb_metrics branch 3 times, most recently from 0d4cebf to e5a8ef0 Compare September 18, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/unit-testing Issues related to adding/updating unit tests
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants