Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b8d6de32
Unverified
Commit
b8d6de32
authored
Jan 25, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Jan 25, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #72334 from danielqsj/kp
Change proxy metrics to conform metrics guidelines
parents
ac8e7720
1fb91a72
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
5 deletions
+39
-5
proxier.go
pkg/proxy/iptables/proxier.go
+2
-1
proxier.go
pkg/proxy/ipvs/proxier.go
+2
-1
metrics.go
pkg/proxy/metrics/metrics.go
+17
-1
metrics.go
pkg/proxy/winkernel/metrics.go
+16
-1
proxier.go
pkg/proxy/winkernel/proxier.go
+2
-1
No files found.
pkg/proxy/iptables/proxier.go
View file @
b8d6de32
...
@@ -639,7 +639,8 @@ func (proxier *Proxier) syncProxyRules() {
...
@@ -639,7 +639,8 @@ func (proxier *Proxier) syncProxyRules() {
start
:=
time
.
Now
()
start
:=
time
.
Now
()
defer
func
()
{
defer
func
()
{
metrics
.
SyncProxyRulesLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
metrics
.
SyncProxyRulesLatency
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
DeprecatedSyncProxyRulesLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
klog
.
V
(
4
)
.
Infof
(
"syncProxyRules took %v"
,
time
.
Since
(
start
))
klog
.
V
(
4
)
.
Infof
(
"syncProxyRules took %v"
,
time
.
Since
(
start
))
}()
}()
// don't sync rules till we've received services and endpoints
// don't sync rules till we've received services and endpoints
...
...
pkg/proxy/ipvs/proxier.go
View file @
b8d6de32
...
@@ -719,7 +719,8 @@ func (proxier *Proxier) syncProxyRules() {
...
@@ -719,7 +719,8 @@ func (proxier *Proxier) syncProxyRules() {
start
:=
time
.
Now
()
start
:=
time
.
Now
()
defer
func
()
{
defer
func
()
{
metrics
.
SyncProxyRulesLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
metrics
.
SyncProxyRulesLatency
.
Observe
(
metrics
.
SinceInSeconds
(
start
))
metrics
.
DeprecatedSyncProxyRulesLatency
.
Observe
(
metrics
.
SinceInMicroseconds
(
start
))
klog
.
V
(
4
)
.
Infof
(
"syncProxyRules took %v"
,
time
.
Since
(
start
))
klog
.
V
(
4
)
.
Infof
(
"syncProxyRules took %v"
,
time
.
Since
(
start
))
}()
}()
// don't sync rules till we've received services and endpoints
// don't sync rules till we've received services and endpoints
...
...
pkg/proxy/metrics/metrics.go
View file @
b8d6de32
...
@@ -30,8 +30,18 @@ var (
...
@@ -30,8 +30,18 @@ var (
SyncProxyRulesLatency
=
prometheus
.
NewHistogram
(
SyncProxyRulesLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
kubeProxySubsystem
,
Subsystem
:
kubeProxySubsystem
,
Name
:
"sync_proxy_rules_latency_seconds"
,
Help
:
"SyncProxyRules latency in seconds"
,
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
},
)
// DeprecatedSyncProxyRulesLatency is the latency of one round of kube-proxy syncing proxy rules.
DeprecatedSyncProxyRulesLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
Subsystem
:
kubeProxySubsystem
,
Name
:
"sync_proxy_rules_latency_microseconds"
,
Name
:
"sync_proxy_rules_latency_microseconds"
,
Help
:
"
SyncProxyRules latency
"
,
Help
:
"
(Deprecated) SyncProxyRules latency in microseconds
"
,
Buckets
:
prometheus
.
ExponentialBuckets
(
1000
,
2
,
15
),
Buckets
:
prometheus
.
ExponentialBuckets
(
1000
,
2
,
15
),
},
},
)
)
...
@@ -43,6 +53,7 @@ var registerMetricsOnce sync.Once
...
@@ -43,6 +53,7 @@ var registerMetricsOnce sync.Once
func
RegisterMetrics
()
{
func
RegisterMetrics
()
{
registerMetricsOnce
.
Do
(
func
()
{
registerMetricsOnce
.
Do
(
func
()
{
prometheus
.
MustRegister
(
SyncProxyRulesLatency
)
prometheus
.
MustRegister
(
SyncProxyRulesLatency
)
prometheus
.
MustRegister
(
DeprecatedSyncProxyRulesLatency
)
})
})
}
}
...
@@ -50,3 +61,8 @@ func RegisterMetrics() {
...
@@ -50,3 +61,8 @@ func RegisterMetrics() {
func
SinceInMicroseconds
(
start
time
.
Time
)
float64
{
func
SinceInMicroseconds
(
start
time
.
Time
)
float64
{
return
float64
(
time
.
Since
(
start
)
.
Nanoseconds
()
/
time
.
Microsecond
.
Nanoseconds
())
return
float64
(
time
.
Since
(
start
)
.
Nanoseconds
()
/
time
.
Microsecond
.
Nanoseconds
())
}
}
// SinceInSeconds gets the time since the specified start in seconds.
func
SinceInSeconds
(
start
time
.
Time
)
float64
{
return
time
.
Since
(
start
)
.
Seconds
()
}
pkg/proxy/winkernel/metrics.go
View file @
b8d6de32
...
@@ -29,8 +29,17 @@ var (
...
@@ -29,8 +29,17 @@ var (
SyncProxyRulesLatency
=
prometheus
.
NewHistogram
(
SyncProxyRulesLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
kubeProxySubsystem
,
Subsystem
:
kubeProxySubsystem
,
Name
:
"sync_proxy_rules_latency_seconds"
,
Help
:
"SyncProxyRules latency in seconds"
,
Buckets
:
prometheus
.
ExponentialBuckets
(
0.001
,
2
,
15
),
},
)
DeprecatedSyncProxyRulesLatency
=
prometheus
.
NewHistogram
(
prometheus
.
HistogramOpts
{
Subsystem
:
kubeProxySubsystem
,
Name
:
"sync_proxy_rules_latency_microseconds"
,
Name
:
"sync_proxy_rules_latency_microseconds"
,
Help
:
"
SyncProxyRules latency
"
,
Help
:
"
(Deprecated) SyncProxyRules latency in microseconds
"
,
Buckets
:
prometheus
.
ExponentialBuckets
(
1000
,
2
,
15
),
Buckets
:
prometheus
.
ExponentialBuckets
(
1000
,
2
,
15
),
},
},
)
)
...
@@ -41,6 +50,7 @@ var registerMetricsOnce sync.Once
...
@@ -41,6 +50,7 @@ var registerMetricsOnce sync.Once
func
RegisterMetrics
()
{
func
RegisterMetrics
()
{
registerMetricsOnce
.
Do
(
func
()
{
registerMetricsOnce
.
Do
(
func
()
{
prometheus
.
MustRegister
(
SyncProxyRulesLatency
)
prometheus
.
MustRegister
(
SyncProxyRulesLatency
)
prometheus
.
MustRegister
(
DeprecatedSyncProxyRulesLatency
)
})
})
}
}
...
@@ -48,3 +58,8 @@ func RegisterMetrics() {
...
@@ -48,3 +58,8 @@ func RegisterMetrics() {
func
sinceInMicroseconds
(
start
time
.
Time
)
float64
{
func
sinceInMicroseconds
(
start
time
.
Time
)
float64
{
return
float64
(
time
.
Since
(
start
)
.
Nanoseconds
()
/
time
.
Microsecond
.
Nanoseconds
())
return
float64
(
time
.
Since
(
start
)
.
Nanoseconds
()
/
time
.
Microsecond
.
Nanoseconds
())
}
}
// Gets the time since the specified start in seconds.
func
sinceInSeconds
(
start
time
.
Time
)
float64
{
return
time
.
Since
(
start
)
.
Seconds
()
}
pkg/proxy/winkernel/proxier.go
View file @
b8d6de32
...
@@ -938,7 +938,8 @@ func (proxier *Proxier) syncProxyRules() {
...
@@ -938,7 +938,8 @@ func (proxier *Proxier) syncProxyRules() {
start
:=
time
.
Now
()
start
:=
time
.
Now
()
defer
func
()
{
defer
func
()
{
SyncProxyRulesLatency
.
Observe
(
sinceInMicroseconds
(
start
))
SyncProxyRulesLatency
.
Observe
(
sinceInSeconds
(
start
))
DeprecatedSyncProxyRulesLatency
.
Observe
(
sinceInMicroseconds
(
start
))
klog
.
V
(
4
)
.
Infof
(
"syncProxyRules took %v"
,
time
.
Since
(
start
))
klog
.
V
(
4
)
.
Infof
(
"syncProxyRules took %v"
,
time
.
Since
(
start
))
}()
}()
// don't sync rules till we've received services and endpoints
// don't sync rules till we've received services and endpoints
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment