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
bfcb3cd9
Commit
bfcb3cd9
authored
Mar 16, 2018
by
immutablet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instrument transformer.go with latency metrics.
parent
04a6613f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
metrics.go
staging/src/k8s.io/apiserver/pkg/storage/value/metrics.go
+15
-13
transformation_testcase.go
test/integration/master/transformation_testcase.go
+1
-2
No files found.
staging/src/k8s.io/apiserver/pkg/storage/value/metrics.go
View file @
bfcb3cd9
...
@@ -23,16 +23,16 @@ import (
...
@@ -23,16 +23,16 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus"
)
)
const
(
valueSubsystem
=
"value"
)
var
(
var
(
TransformerOperationalLatencies
=
prometheus
.
NewSummaryVec
(
transformerLatencies
=
prometheus
.
NewHistogramVec
(
prometheus
.
SummaryOpts
{
prometheus
.
HistogramOpts
{
Subsystem
:
valueSubsystem
,
Namespace
:
"apiserver"
,
Name
:
"apiserver_storage_transformation_latency_microseconds"
,
Subsystem
:
"storage"
,
Help
:
"Latency in microseconds of value transformation operations."
,
Name
:
"transformation_latencies_microseconds"
,
Help
:
"Latencies in microseconds of value transformation operations."
,
// In-process transformations (ex. AES CBC) complete on the order of 20 microseconds. However, when
// external KMS is involved latencies may climb into milliseconds.
Buckets
:
prometheus
.
ExponentialBuckets
(
5
,
2
,
14
),
},
},
[]
string
{
"transformation_type"
},
[]
string
{
"transformation_type"
},
)
)
...
@@ -42,14 +42,16 @@ var registerMetrics sync.Once
...
@@ -42,14 +42,16 @@ var registerMetrics sync.Once
func
RegisterMetrics
()
{
func
RegisterMetrics
()
{
registerMetrics
.
Do
(
func
()
{
registerMetrics
.
Do
(
func
()
{
prometheus
.
MustRegister
(
TransformerOperational
Latencies
)
prometheus
.
MustRegister
(
transformer
Latencies
)
})
})
}
}
func
RecordTransformation
(
transformationType
string
,
start
time
.
Time
)
{
func
RecordTransformation
(
transformationType
string
,
start
time
.
Time
)
{
TransformerOperationalLatencies
.
WithLabelValues
(
transformationType
)
.
Observe
(
float64
(
sinceInMicroseconds
(
start
)))
since
:=
sinceInMicroseconds
(
start
)
transformerLatencies
.
WithLabelValues
(
transformationType
)
.
Observe
(
float64
(
since
))
}
}
func
sinceInMicroseconds
(
start
time
.
Time
)
time
.
Duration
{
func
sinceInMicroseconds
(
start
time
.
Time
)
int64
{
return
time
.
Since
(
start
)
/
time
.
Microsecond
elapsedNanoseconds
:=
time
.
Since
(
start
)
.
Nanoseconds
()
return
elapsedNanoseconds
/
int64
(
time
.
Microsecond
)
}
}
test/integration/master/transformation_testcase.go
View file @
bfcb3cd9
...
@@ -48,7 +48,7 @@ const (
...
@@ -48,7 +48,7 @@ const (
encryptionConfigFileName
=
"encryption.conf"
encryptionConfigFileName
=
"encryption.conf"
testNamespace
=
"secret-encryption-test"
testNamespace
=
"secret-encryption-test"
testSecret
=
"test-secret"
testSecret
=
"test-secret"
latencySummaryMetricsFamily
=
"
value_apiserver_storage_transformation_latency
_microseconds"
latencySummaryMetricsFamily
=
"
apiserver_storage_transformation_latencies
_microseconds"
)
)
type
unSealSecret
func
(
cipherText
[]
byte
,
ctx
value
.
Context
,
config
encryptionconfig
.
ProviderConfig
)
([]
byte
,
error
)
type
unSealSecret
func
(
cipherText
[]
byte
,
ctx
value
.
Context
,
config
encryptionconfig
.
ProviderConfig
)
([]
byte
,
error
)
...
@@ -248,7 +248,6 @@ func (e *transformTest) printMetrics() error {
...
@@ -248,7 +248,6 @@ func (e *transformTest) printMetrics() error {
}
}
metricsOfInterest
:=
[]
string
{
latencySummaryMetricsFamily
}
metricsOfInterest
:=
[]
string
{
latencySummaryMetricsFamily
}
for
_
,
mf
:=
range
metrics
{
for
_
,
mf
:=
range
metrics
{
if
contains
(
metricsOfInterest
,
*
mf
.
Name
)
{
if
contains
(
metricsOfInterest
,
*
mf
.
Name
)
{
for
_
,
metric
:=
range
mf
.
GetMetric
()
{
for
_
,
metric
:=
range
mf
.
GetMetric
()
{
...
...
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