Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Snowflake
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
trinity-1686a
Snowflake
Commits
91379a42
Verified
Commit
91379a42
authored
3 years ago
by
shelikhoo
Browse files
Options
Downloads
Patches
Plain Diff
Add Raw Data Output for bytesLogger
parent
6cb82618
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
proxy/lib/util.go
+5
-0
5 additions, 0 deletions
proxy/lib/util.go
with
5 additions
and
0 deletions
proxy/lib/util.go
+
5
−
0
View file @
91379a42
...
...
@@ -11,6 +11,7 @@ type bytesLogger interface {
AddOutbound
(
int
)
AddInbound
(
int
)
ThroughputSummary
()
string
GetStat
()
(
in
int
,
out
int
)
}
// bytesNullLogger Default bytesLogger does nothing.
...
...
@@ -25,6 +26,8 @@ func (b bytesNullLogger) AddInbound(amount int) {}
// ThroughputSummary in bytesNullLogger does nothing
func
(
b
bytesNullLogger
)
ThroughputSummary
()
string
{
return
""
}
func
(
b
bytesNullLogger
)
GetStat
()
(
in
int
,
out
int
)
{
return
-
1
,
-
1
}
// bytesSyncLogger uses channels to safely log from multiple sources with output
// occuring at reasonable intervals.
type
bytesSyncLogger
struct
{
...
...
@@ -92,3 +95,5 @@ func (b *bytesSyncLogger) ThroughputSummary() string {
t
:=
time
.
Now
()
return
fmt
.
Sprintf
(
"Traffic throughput (up|down): %d %s|%d %s -- (%d OnMessages, %d Sends, over %d seconds)"
,
inbound
,
inUnit
,
outbound
,
outUnit
,
b
.
outEvents
,
b
.
inEvents
,
int
(
t
.
Sub
(
b
.
start
)
.
Seconds
()))
}
func
(
b
*
bytesSyncLogger
)
GetStat
()
(
in
int
,
out
int
)
{
return
b
.
inbound
,
b
.
outbound
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment