-
Notifications
You must be signed in to change notification settings - Fork 108
GATEWAYS-4306: exporting metrics for conntrack per zone #137
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
Closed
Closed
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
e306589
GATEWAYS-4306: exporting metrics for conntrack per zone
shrouti1995 80916dc
GATEWAYS-4306: scaling with event driven approach
shrouti1995 8b03af1
code cleanup
shrouti1995 e8eeddb
GATEWAYS-4306: updating go.mod
shrouti1995 dc73f17
GATEWAYS-4306: updating test cases
shrouti1995 7b31316
GATEWAYS-4306: editing go.mod again
shrouti1995 02ce3ca
conntrack destroy rate limiting part 1
shrouti1995 15e3b1a
conntrack destroy rate limiting part 2
shrouti1995 b1b102c
configuration update
shrouti1995 9796da5
configuration update
shrouti1995 df047c7
review suggestions
shrouti1995 51dbc5b
review comments addressed
shrouti1995 0f97bc6
fix: adding license
shrouti1995 578db7f
editing dynamic strings
shrouti1995 33d1c71
go fmt check edits
shrouti1995 3d1d088
go lint check edits
shrouti1995 68f438c
ci cd version upgrades
shrouti1995 4809d11
clean go.mod
shrouti1995 ff11970
using io instead if ioutil
shrouti1995 5ac45d4
fixing build issue
shrouti1995 64416ca
fixing build issue
shrouti1995 457550e
adding back toolchain
shrouti1995 6b139de
test cases issue solve
shrouti1995 3f97fdb
simplify by mapping with zmKey
shrouti1995 6b5e843
solve lint issue
shrouti1995 70905a1
resolve conflicts
shrouti1995 1a1e9d1
security issue
shrouti1995 4c0669e
Apply suggestions from code review
shrouti1995 96ff4a1
code review suggestions
shrouti1995 5125d48
code restructure
shrouti1995 eeb4fce
Apply suggestions from code review
shrouti1995 98dcb70
code review suggestion
shrouti1995 893e7c6
code review suggestion
shrouti1995 b77cf7d
code review suggestion : with simpler defer
shrouti1995 48399e8
code review suggestion : adding wait group and var name change
shrouti1995 18d82e3
code review suggestion : dead code cleanup
shrouti1995 db13380
Apply suggestions from code review : adding defer to unlocks
shrouti1995 e0c37ee
changing goroutine syntax
shrouti1995 9a9e749
using atomic.Int64
shrouti1995 30a0450
Apply suggestions from code review : enhance readability and minor me…
shrouti1995 864df4e
code review suggestions
shrouti1995 7626e98
code review suggestion : remove unnecessary logs
shrouti1995 77ad346
unnecessary comment and variable deleted
shrouti1995 dbb6cbd
adding all channel close for restart and increasing threasholds
shrouti1995 40aed58
removing unnecessary code
shrouti1995 644fc15
Update ovsnl/conntrack_linux.go
shrouti1995 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // Copyright 2017 DigitalOcean. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package ovsnl | ||
|
|
||
| import ( | ||
| "sync" | ||
| "sync/atomic" | ||
| "time" | ||
|
|
||
| "github.com/ti-mo/conntrack" | ||
| ) | ||
|
|
||
| // Tunables - adjust for your environment | ||
| const ( | ||
| eventChanSize = 512 * 1024 | ||
| eventWorkerCount = 100 | ||
| destroyFlushIntvl = 100 * time.Millisecond // flush aggregated DESTROYs every 100ms for minimal lag | ||
| destroyDeltaCap = 200000 // maximum distinct (zone,mark) entries in destroyDeltas | ||
| dropsWarnThreshold = 10000 // threshold of missedEvents to log a stronger warning | ||
| ) | ||
|
|
||
| // ZoneMarkAggregator keeps live counts (zmKey -> count) with bounded ingestion | ||
| type ZoneMarkAggregator struct { | ||
| // primary counts (zmKey -> count) - simplified flat mapping | ||
| counts map[ZoneMarkKey]int | ||
| countsMu sync.RWMutex | ||
| eventRate float64 | ||
|
|
||
| // conntrack listening connection | ||
| listenCli *conntrack.Conn | ||
| listenerMu sync.Mutex // Protects listener restart operations | ||
|
|
||
| // lifecycle | ||
| stopCh chan struct{} | ||
| wg sync.WaitGroup | ||
|
|
||
| // bounded event ingestion | ||
| eventsCh chan conntrack.Event | ||
|
|
||
| // aggregated DESTROY deltas (bounded by destroyDeltaCap) | ||
| deltaMu sync.Mutex | ||
| destroyDeltas map[ZoneMarkKey]int | ||
|
|
||
| // metrics / health | ||
| eventCount atomic.Int64 | ||
| lastEventTime time.Time | ||
| missedEvents atomic.Int64 | ||
| lastHealthCheck time.Time | ||
| } | ||
|
|
||
| // ZoneMarkKey is a compact key for (zone,mark) | ||
| type ZoneMarkKey struct { | ||
| Zone uint16 | ||
| Mark uint32 | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.