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
43e59162
Commit
43e59162
authored
Apr 28, 2015
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7430 from fgrzadkowski/master_metrics
Add summary metrics to apiserver for easier debugging and future use in performance tests
parents
534a2fd2
c1c24f64
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
apiserver.go
pkg/apiserver/apiserver.go
+9
-0
No files found.
pkg/apiserver/apiserver.go
View file @
43e59162
...
...
@@ -65,11 +65,19 @@ var (
},
[]
string
{
"verb"
,
"resource"
,
"client"
},
)
requestLatenciesSummary
=
prometheus
.
NewSummaryVec
(
prometheus
.
SummaryOpts
{
Name
:
"apiserver_request_latencies_summary"
,
Help
:
"Response latency summary in microseconds for each verb and resource."
,
},
[]
string
{
"verb"
,
"resource"
},
)
)
func
init
()
{
prometheus
.
MustRegister
(
requestCounter
)
prometheus
.
MustRegister
(
requestLatencies
)
prometheus
.
MustRegister
(
requestLatenciesSummary
)
}
// monitor is a helper function for each HTTP request handler to use for
...
...
@@ -77,6 +85,7 @@ func init() {
func
monitor
(
verb
,
resource
*
string
,
client
string
,
httpCode
*
int
,
reqStart
time
.
Time
)
{
requestCounter
.
WithLabelValues
(
*
verb
,
*
resource
,
client
,
strconv
.
Itoa
(
*
httpCode
))
.
Inc
()
requestLatencies
.
WithLabelValues
(
*
verb
,
*
resource
,
client
)
.
Observe
(
float64
((
time
.
Since
(
reqStart
))
/
time
.
Microsecond
))
requestLatenciesSummary
.
WithLabelValues
(
*
verb
,
*
resource
)
.
Observe
(
float64
((
time
.
Since
(
reqStart
))
/
time
.
Microsecond
))
}
// monitorFilter creates a filter that reports the metrics for a given resource and action.
...
...
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