Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
491e6897
Commit
491e6897
authored
Sep 14, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
metrics: set summary unit
we have to use milleseconds since graphite doesnt support float64
parent
5b74bea4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
pkg/metrics/metrics.go
+6
-6
pkg/middleware/request_metrics.go
+2
-1
pkg/services/alerting/eval_handler.go
+2
-2
No files found.
pkg/metrics/metrics.go
View file @
491e6897
...
...
@@ -102,7 +102,7 @@ func init() {
M_Http_Request_Summary
=
prometheus
.
NewSummaryVec
(
prometheus
.
SummaryOpts
{
Name
:
"http_request_duration"
,
Name
:
"http_request_duration
_milleseconds
"
,
Help
:
"http request summary"
,
},
[]
string
{
"handler"
,
"statuscode"
,
"method"
},
...
...
@@ -127,19 +127,19 @@ func init() {
})
M_Api_Dashboard_Save
=
prometheus
.
NewSummary
(
prometheus
.
SummaryOpts
{
Name
:
"api_dashboard_save"
,
Name
:
"api_dashboard_save
_milleseconds
"
,
Help
:
"summary for dashboard save duration"
,
Namespace
:
exporterName
,
})
M_Api_Dashboard_Get
=
prometheus
.
NewSummary
(
prometheus
.
SummaryOpts
{
Name
:
"api_dashboard_get"
,
Name
:
"api_dashboard_get
_milleseconds
"
,
Help
:
"summary for dashboard get duration"
,
Namespace
:
exporterName
,
})
M_Api_Dashboard_Search
=
prometheus
.
NewSummary
(
prometheus
.
SummaryOpts
{
Name
:
"api_dashboard_search"
,
Name
:
"api_dashboard_search
_milleseconds
"
,
Help
:
"summary for dashboard search duration"
,
Namespace
:
exporterName
,
})
...
...
@@ -223,13 +223,13 @@ func init() {
})
M_DataSource_ProxyReq_Timer
=
prometheus
.
NewSummary
(
prometheus
.
SummaryOpts
{
Name
:
"api_dataproxy_request_all"
,
Name
:
"api_dataproxy_request_all
_milleseconds
"
,
Help
:
"summary for dashboard search duration"
,
Namespace
:
exporterName
,
})
M_Alerting_Execution_Time
=
prometheus
.
NewSummary
(
prometheus
.
SummaryOpts
{
Name
:
"alerting_execution_time_seconds"
,
Name
:
"alerting_execution_time_
milli
seconds"
,
Help
:
"summary of alert exeuction duration"
,
Namespace
:
exporterName
,
})
...
...
pkg/middleware/request_metrics.go
View file @
491e6897
...
...
@@ -21,7 +21,8 @@ func RequestMetrics(handler string) macaron.Handler {
code
:=
sanitizeCode
(
status
)
method
:=
sanitizeMethod
(
req
.
Method
)
metrics
.
M_Http_Request_Total
.
WithLabelValues
(
handler
,
code
,
method
)
.
Inc
()
metrics
.
M_Http_Request_Summary
.
WithLabelValues
(
handler
,
code
,
method
)
.
Observe
(
time
.
Since
(
now
)
.
Seconds
())
duration
:=
time
.
Since
(
now
)
.
Nanoseconds
()
/
int64
(
time
.
Millisecond
)
metrics
.
M_Http_Request_Summary
.
WithLabelValues
(
handler
,
code
,
method
)
.
Observe
(
float64
(
duration
))
if
strings
.
HasPrefix
(
req
.
RequestURI
,
"/api/datasources/proxy"
)
{
countProxyRequests
(
status
)
...
...
pkg/services/alerting/eval_handler.go
View file @
491e6897
...
...
@@ -63,8 +63,8 @@ func (e *DefaultEvalHandler) Eval(context *EvalContext) {
context
.
EndTime
=
time
.
Now
()
context
.
Rule
.
State
=
e
.
getNewState
(
context
)
elapsedTime
:=
context
.
EndTime
.
Sub
(
context
.
StartTime
)
.
Seconds
(
)
metrics
.
M_Alerting_Execution_Time
.
Observe
(
elapsedTime
)
elapsedTime
:=
context
.
EndTime
.
Sub
(
context
.
StartTime
)
.
Nanoseconds
()
/
int64
(
time
.
Millisecond
)
metrics
.
M_Alerting_Execution_Time
.
Observe
(
float64
(
elapsedTime
)
)
}
// This should be move into evalContext once its been refactored.
...
...
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